/* ============================================================
   Design tokens — Terminal
   ============================================================ */
:root {
  --bg: #0A0D11;
  --panel: #10161C;
  --panel-head: #161D24;
  --panel-alt: #0D1217;
  --border: #212B33;
  --border-dim: #263640;
  --ink: #E7EEF0;
  --muted: #9AA7AE;
  --dim: #7C8B94;
  --dot: #3A444D;
  --accent: #1FCFC0;
  --accent-hover: #17ADA1;
  --accent-ink: #0A0D11;
  --danger: #F5402F;
  --danger-ink: #F0A79E;

  --font-display: 'Space Grotesk', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Fragment Mono', 'SF Mono', Consolas, monospace;

  --sidebar-w: 264px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); margin: 0; text-wrap: balance; }

@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
.cursor { animation: blink 1s steps(1) infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.pulse-dot { animation: pulse 2s ease-in-out infinite; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   App shell — persistent sidebar + main column
   ============================================================ */
.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
}

.sidebar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 22px;
}

.sidebar-bar .logo { margin-bottom: 0; }

/* ---- Mobile nav toggle (hidden on desktop) ---- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  background: var(--panel-alt);
  border: 1px solid var(--dot);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { border-color: var(--border-dim); background: var(--border); }

.nav-toggle-icon { position: relative; width: 16px; height: 12px; flex-shrink: 0; }
.nav-toggle-icon span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-toggle-icon span:nth-child(1) { top: 0; }
.nav-toggle-icon span:nth-child(2) { top: 5px; }
.nav-toggle-icon span:nth-child(3) { top: 10px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.nav-toggle-label { color: var(--muted); }

.logo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.logo .user { color: var(--accent); }
.logo .host { color: var(--dim); }

.sidebar-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.sidebar-cmd { font-size: 12px; color: var(--dim); margin-bottom: 10px; }

.tree { font-size: 13px; margin-bottom: 10px; }
.tree-group { color: var(--dim); padding: 9px 8px 3px; }

.navlink {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 4px;
}
.navlink:hover { background: var(--panel-head); color: var(--ink); }
.navlink.top { padding-left: 8px; }
.navlink.leaf { padding-left: 22px; }

.navlink .status { font-size: 10.5px; flex-shrink: 0; }
.navlink .status.is-live { color: var(--accent); }
.navlink .status.is-beta { color: var(--dim); }

.sidebar-spacer { flex: 1; }

.sidebar-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

/* ---- Buttons (shared) ---- */
.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 11px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: inline-block;
  text-align: center;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { border-color: var(--dot); color: var(--ink); }
.btn-ghost:hover { background: var(--border); color: var(--ink); }
.sidebar .btn { display: block; }

/* ---- Main column ---- */
.main-col { flex: 1; min-width: 0; }

.pane {
  padding: 40px 48px;
  border-bottom: 1px solid var(--border);
}
.pane:last-child { border-bottom: none; }

.pane-cmd { font-size: 12px; color: var(--dim); margin-bottom: 12px; }
.pane h2 { font-size: clamp(21px, 2.4vw, 25px); margin-bottom: 14px; }
.pane-intro { font-size: 14px; line-height: 1.7; color: var(--muted); max-width: 700px; margin: 0 0 18px; }

/* ---- Hero (compact — identity already lives in the sidebar) ---- */
.hero-pane { padding-bottom: 32px; }
.output-label { font-size: 12px; color: var(--danger); margin-bottom: 12px; }
.hero-pane h1 { font-size: clamp(24px, 3vw, 36px); line-height: 1.25; max-width: 680px; margin-bottom: 16px; }
.hero-pane .lede { font-size: 14px; color: var(--muted); max-width: 600px; margin: 0 0 26px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 640px;
}
.hero-stat { background: var(--panel-alt); padding: 14px; }
.hero-stat .value { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--accent); }
.hero-stat .label { font-size: 10.5px; color: var(--dim); margin-top: 3px; }

/* ---- About ---- */
.about-pane p { font-size: 14px; line-height: 1.75; color: var(--muted); max-width: 760px; margin: 0 0 14px; }
.about-pane p:last-child { margin-bottom: 0; }

.env-line { display: flex; gap: 8px; font-size: 13px; line-height: 1.9; flex-wrap: wrap; }
.env-line .key { color: var(--accent); }
.env-line .val { color: var(--muted); }
.env-block { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border-dim); }

/* ---- Legend ---- */
.legend { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--dim); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-dot.filled { background: var(--accent); }
.legend-dot.outline { border: 1px solid var(--dim); }

/* ---- Spec cards (project cards: meta column + detail column) ---- */
.spec-card {
  display: flex;
  gap: 30px;
  padding: 26px 0;
  border-top: 1px solid var(--border-dim);
}
.spec-card.is-compact { padding: 22px 0; }

.spec-meta {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-row { display: flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: 0.4px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.filled { background: var(--accent); }
.status-dot.outline { border: 1px solid var(--dim); }
.status-row.is-accent { color: var(--accent); }
.status-row.is-muted { color: var(--muted); }

.stat-list { display: flex; flex-direction: column; gap: 6px; }
.stat { font-size: 12px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; color: var(--muted); }
.stat b { color: var(--accent); font-weight: 600; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border-dim); border-radius: 4px; padding: 4px 9px; }

.spec-detail { flex: 1; min-width: 0; }
.spec-detail h3 { font-size: 20px; margin-bottom: 5px; }
.spec-detail.is-compact h3 { font-size: 18px; }
.spec-subtitle { font-size: 12px; color: var(--dim); margin-bottom: 14px; }
.spec-desc { font-size: 14px; line-height: 1.75; color: var(--muted); max-width: 640px; margin: 0 0 16px; }
.spec-detail.is-compact .spec-desc { font-size: 13.5px; max-width: 600px; }

.decisions { border-top: 1px dashed var(--border-dim); padding-top: 14px; margin-bottom: 16px; }
.decision-line { display: flex; gap: 8px; font-size: 13px; line-height: 1.7; color: var(--muted); margin-bottom: 7px; }
.decision-line:last-child { margin-bottom: 0; }
.decision-line .marker { color: var(--dim); flex-shrink: 0; }

.diagram { font-size: 12px; line-height: 1.85; color: var(--muted); margin-bottom: 16px; }
.diagram-cmd { color: var(--accent); font-size: 13px; margin-bottom: 6px; }
.diagram-line .marker { color: var(--dim); }
.diagram-line .badge { color: var(--accent); }
.diagram-line .badge.is-beta { color: var(--dim); }

.confidential-box { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 4px; padding: 11px 13px; max-width: 480px; margin-bottom: 14px; font-size: 12px; }
.confidential-box .line { display: flex; gap: 8px; }
.confidential-box .line + .line { margin-top: 4px; }
.confidential-box .cmd-prompt { color: var(--accent); }
.confidential-box .resp-prompt { color: var(--danger); }
.confidential-box .resp-text { color: var(--danger-ink); }

.caption { font-size: 12px; color: var(--dim); margin: 0 0 14px; }
.spec-links { display: flex; gap: 12px; flex-wrap: wrap; }

.exhibit { margin: 0 0 16px; max-width: 420px; }
.exhibit img { width: 100%; aspect-ratio: 1568 / 744; object-fit: cover; border: 1px solid var(--border); border-radius: 4px; }
.exhibit figcaption { font-size: 10.5px; color: var(--dim); margin-top: 5px; }

.shots-cmd { font-size: 12px; margin-bottom: 2px; color: var(--muted); }
.shots-cmd .prompt { color: var(--accent); margin-right: 6px; }
.shots-listing { font-size: 11px; color: var(--dim); margin-bottom: 10px; }
.shots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 16px; max-width: 560px; }
.shots-grid figure { margin: 0; }
.shots-grid img { width: 100%; aspect-ratio: 1568 / 744; object-fit: cover; border: 1px solid var(--border); border-radius: 4px; }
.shots-grid figcaption { font-size: 10px; color: var(--dim); margin-top: 4px; }

.placeholder-note { color: var(--dim); font-style: italic; }

/* ---- Contact ---- */
.contact-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 36px 40px; }
.contact-card h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 14px; }
.contact-card .lede { font-size: 14px; line-height: 1.75; color: var(--muted); max-width: 520px; margin: 0 0 24px; }
.contact-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.exit-line { margin-top: 30px; font-size: 12.5px; color: var(--dim); }
.exit-line .prompt { color: var(--accent); }
.footer-meta { margin-top: 16px; font-size: 12px; color: var(--dim); }
.footer-meta a { color: var(--dim); }
.footer-meta a:hover { color: var(--muted); }

/* ============================================================
   Responsive — sidebar collapses to a top block under ~880px
   ============================================================ */
@media (max-width: 880px) {
  .app-shell { flex-direction: column; align-items: stretch; }
  .sidebar {
    width: 100%;
    height: auto;
    overflow: visible;
    position: sticky;
    top: 0;
    z-index: 30;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 18px;
  }

  .nav-toggle { display: inline-flex; }

  /* Collapsed by default; JS toggles .is-open on .sidebar and syncs
     aria-expanded on the button. Panel floats over content so opening
     it never reflows the page underneath. */
  .sidebar-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--panel-alt);
    border-bottom: 1px solid var(--border);
    padding: 14px 18px 20px;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.45);
  }
  .sidebar.is-open .sidebar-panel { display: flex; }

  .sidebar-spacer { display: none; }
  .sidebar-cta { padding-top: 16px; }

  .pane { padding: 28px 20px; }
  .spec-card { flex-direction: column; gap: 16px; }
  .spec-meta { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
  .stat-list { flex-direction: row; flex-wrap: wrap; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Screenshot lightbox
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
}
.lightbox[hidden] { display: none; }

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: var(--border); }
