/* evosim showcase — Direction A "Dark Lab"
   Tokens per design-system handoff (docs/frontend-brief.md, page 07). */

:root {
  --bg: #0D0F11;
  --surface: #16191D;
  --surface-2: #1C2126;
  --border: #23282E;
  --text: #E8EAED;
  --muted: #9BA3AB;
  --accent: #F0A33C;
  --accent-2: #4FC3C8;
  --untrained: #6B7280;
  --display: "Liter", -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  line-height: 1.55;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.cursor { color: var(--accent); }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: #0D0F11;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  text-decoration: none;
}

.cta:hover { filter: brightness(1.1); }
.cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- hero ---------- */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding: 3.5rem 2rem 2.5rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.lede {
  color: var(--muted);
  max-width: 34rem;
  margin: 0;
}

.hero-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

.hero-meta p { margin: 0.35rem 0; }

/* ---------- filters ---------- */

.filters {
  display: flex;
  gap: 0.6rem;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem 3rem;
  max-width: 1400px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--muted); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
}

/* untrained = muted · dashed · BEFORE */
.card.before { border-style: dashed; border-color: var(--untrained); }
.card.before video { filter: saturate(0.35) brightness(0.8); }

.before-tag {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--bg);
  background: var(--untrained);
  border-radius: 3px;
  padding: 0.15rem 0.45rem;
  z-index: 1;
}

.card-body { padding: 0.75rem 0.9rem 0.85rem; }

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.kind {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.kind .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--untrained);
}

.kind[data-kind="locomotion"] { color: var(--accent); }
.kind[data-kind="locomotion"] .dot { background: var(--accent); }
.kind[data-kind="manipulation"] { color: var(--accent-2); }
.kind[data-kind="manipulation"] .dot { background: var(--accent-2); }
.kind[data-kind="classic control"] { color: var(--untrained); }

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.policy {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
}

.card.before .policy {
  color: var(--untrained);
  border-style: dashed;
  border-color: var(--untrained);
}

.mu {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.card.before .mu { color: var(--untrained); }

/* ---------- detail dialog ---------- */

.detail {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 980px;
  width: calc(100% - 2.5rem);
  padding: 2rem;
}

.detail::backdrop { background: rgba(0, 0, 0, 0.72); }

/* corner ticks */
.tick {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
}
.tick.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.tick.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.tick.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.tick.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.detail-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 2;
}

.detail-close:hover { border-color: var(--accent); color: var(--accent); }
.detail-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2rem;
}

.detail-video {
  width: 100%;
  display: block;
  background: #000;
  border-radius: 4px;
}

.progress {
  height: 3px;
  background: var(--surface-2);
  margin-top: 0.6rem;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
}

.media-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.detail-kind {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

.detail-kind .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.detail-title { margin: 0 0 0.8rem; font-size: 1.7rem; letter-spacing: -0.01em; }

.detail-desc { color: var(--muted); margin: 0 0 1.4rem; }

.detail-stats { margin: 0 0 1.4rem; }

.detail-stats div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-stats div:first-child { border-top: 1px solid var(--border); }

.detail-stats dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-stats dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
}

.detail-stats dd.stat-return { color: var(--accent); }
.detail.untrained dd.stat-return { color: var(--untrained); }

.detail-cmd {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.1rem;
  overflow-x: auto;
  white-space: nowrap;
}

.detail-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  margin: 0 0 1.4rem;
}

.detail-links a { color: var(--accent); text-decoration: none; }
.detail-links a:hover { text-decoration: underline; }
.detail-links span { color: var(--muted); }

.detail-hints {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-meta { text-align: left; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar, .hero, .filters, .gallery, .footer { padding-left: 1rem; padding-right: 1rem; }
  .filters {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 5;
  }
  .gallery { grid-template-columns: 1fr; }
  .card video { aspect-ratio: 16 / 10; }
  .detail { padding: 1.1rem; width: calc(100% - 1rem); }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
