/* ============ TOKENS ============ */
  :root {
    /* neutrals biased cool-slate so the warm amber accent reads as a deliberate choice */
    --bg:        #eef1f5;
    --bg-dot:    rgba(20, 32, 54, 0.045);
    --surface:   #ffffff;
    --surface-2: #f6f8fb;
    --ink:       #121821;
    --ink-soft:  #47525f;
    --muted:     #7b8794;
    --hair:      #dde3ea;
    --hair-2:    #e8edf2;

    --accent:      #c9781a;   /* warm signal amber — reserved for the "live link" affordance */
    --accent-ink:  #a35f10;
    --accent-wash: rgba(201, 120, 26, 0.10);

    --live:      #17916a;
    --live-wash: rgba(23, 145, 106, 0.12);
    --prog:      #b06d0c;
    --prog-wash: rgba(176, 109, 12, 0.12);

    --shadow:    0 1px 2px rgba(16,24,33,.05), 0 1px 3px rgba(16,24,33,.04);
    --shadow-lift: 0 14px 30px -12px rgba(16,24,33,.28), 0 4px 10px -6px rgba(16,24,33,.15);

    --sans: 'Inter', system-ui, sans-serif;
    --font-disp: 'Bricolage Grotesque', system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;

    --maxw: 1180px;
    --radius: 15px;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg:        #0b0e13;
      --bg-dot:    rgba(150, 180, 220, 0.05);
      --surface:   #14191f;
      --surface-2: #191f27;
      --ink:       #eef1f5;
      --ink-soft:  #aeb8c4;
      --muted:     #78828f;
      --hair:      #262d38;
      --hair-2:    #20262f;

      --accent:      #f0ab4d;
      --accent-ink:  #f6c079;
      --accent-wash: rgba(240, 171, 77, 0.13);

      --live:      #35c493;
      --live-wash: rgba(53, 196, 147, 0.14);
      --prog:      #f0ab4d;
      --prog-wash: rgba(240, 171, 77, 0.14);

      --shadow:    0 1px 2px rgba(0,0,0,.4);
      --shadow-lift: 0 16px 34px -12px rgba(0,0,0,.7), 0 4px 12px -6px rgba(0,0,0,.5);
    }
  }
  /* explicit toggle wins over the media query in BOTH directions */
  :root[data-theme="light"] {
    --bg:#eef1f5; --bg-dot:rgba(20,32,54,.045); --surface:#fff; --surface-2:#f6f8fb;
    --ink:#121821; --ink-soft:#47525f; --muted:#7b8794; --hair:#dde3ea; --hair-2:#e8edf2;
    --accent:#c9781a; --accent-ink:#a35f10; --accent-wash:rgba(201,120,26,.10);
    --live:#17916a; --live-wash:rgba(23,145,106,.12); --prog:#b06d0c; --prog-wash:rgba(176,109,12,.12);
    --shadow:0 1px 2px rgba(16,24,33,.05), 0 1px 3px rgba(16,24,33,.04);
    --shadow-lift:0 14px 30px -12px rgba(16,24,33,.28), 0 4px 10px -6px rgba(16,24,33,.15);
  }
  :root[data-theme="dark"] {
    --bg:#0b0e13; --bg-dot:rgba(150,180,220,.05); --surface:#14191f; --surface-2:#191f27;
    --ink:#eef1f5; --ink-soft:#aeb8c4; --muted:#78828f; --hair:#262d38; --hair-2:#20262f;
    --accent:#f0ab4d; --accent-ink:#f6c079; --accent-wash:rgba(240,171,77,.13);
    --live:#35c493; --live-wash:rgba(53,196,147,.14); --prog:#f0ab4d; --prog-wash:rgba(240,171,77,.14);
    --shadow:0 1px 2px rgba(0,0,0,.4);
    --shadow-lift:0 16px 34px -12px rgba(0,0,0,.7), 0 4px 12px -6px rgba(0,0,0,.5);
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background-color: var(--bg);
    background-image: radial-gradient(var(--bg-dot) 1px, transparent 1.4px);
    background-size: 24px 24px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
  }

  .page { max-width: var(--maxw); margin: 0 auto; padding: clamp(22px, 4vw, 52px) clamp(16px, 4vw, 34px) 72px; }

  /* ============ MASTHEAD ============ */
  .masthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
  .kicker {
    font-family: var(--mono);
    font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase;
    color: var(--accent-ink); font-weight: 600;
    display: inline-flex; align-items: center; gap: 9px;
  }
  .kicker::before { content:""; width: 22px; height: 1.5px; background: var(--accent); opacity:.75; display:inline-block; }
  h1 {
    font-family: var(--font-disp);
    font-size: clamp(30px, 5.2vw, 48px);
    line-height: 1.02; letter-spacing: -0.025em; font-weight: 780;
    margin: 14px 0 0; text-wrap: balance;
  }
  .lede { margin: 12px 0 0; max-width: 52ch; color: var(--ink-soft); font-size: 15.5px; }

  .theme-toggle {
    flex: none;
    font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
    display: inline-flex; align-items: center; gap: 9px;
    padding: 9px 14px; border-radius: 999px;
    background: var(--surface); color: var(--ink-soft);
    border: 1px solid var(--hair); cursor: pointer;
    box-shadow: var(--shadow); transition: border-color .18s, color .18s, transform .18s;
  }
  .theme-toggle:hover { border-color: var(--accent); color: var(--ink); }
  .theme-toggle:active { transform: scale(.97); }
  .theme-toggle .ico { width: 15px; height: 15px; display: grid; place-items: center; }
  .theme-toggle .lbl-dark, .theme-toggle .ico-moon { display: none; }
  :root[data-theme="dark"] .theme-toggle .lbl-light, :root[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
  :root[data-theme="dark"] .theme-toggle .lbl-dark, :root[data-theme="dark"] .theme-toggle .ico-moon { display: inline; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle .lbl-light, :root:not([data-theme]) .theme-toggle .ico-sun { display: none; }
    :root:not([data-theme]) .theme-toggle .lbl-dark, :root:not([data-theme]) .theme-toggle .ico-moon { display: inline; }
  }

  /* ============ STATS ============ */
  .stats {
    margin-top: clamp(26px, 4vw, 40px);
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
    background: var(--hair); border: 1px solid var(--hair);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  }
  .stat { background: var(--surface); padding: 18px 20px; }
  .stat .n { font-size: clamp(26px, 4vw, 34px); font-weight: 760; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .stat .k { font-family: var(--mono); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
  .stat.accent .n { color: var(--accent-ink); }
  @media (max-width: 640px){ .stats { grid-template-columns: repeat(2,1fr); } }

  /* ============ CONTROLS ============ */
  .controls {
    margin: 30px 0 18px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
  }
  .filters { display: flex; flex-wrap: wrap; gap: 8px; }
  .pill {
    font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
    padding: 7px 13px; border-radius: 999px; cursor: pointer;
    background: transparent; color: var(--ink-soft);
    border: 1px solid var(--hair); transition: all .16s;
    display: inline-flex; align-items: center; gap: 7px;
  }
  .pill .c { color: var(--muted); font-size: 11px; }
  .pill:hover { border-color: var(--accent); color: var(--ink); }
  .pill[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .pill[aria-pressed="true"] .c { color: var(--bg); opacity: .7; }
  .count { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

  /* ============ GRID + CARDS ============ */
  .grid {
    display: grid; gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  }
  .card {
    position: relative; background: var(--surface);
    border: 1px solid var(--hair); border-radius: var(--radius);
    padding: 20px 20px 17px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; min-height: 232px;
    transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s, border-color .2s;
    animation: rise .5s both;
  }
  .card.is-linked { cursor: pointer; }
  .card.is-linked:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); border-color: var(--accent); }
  .card:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

  /* stretched primary link */
  .card-primary { position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
  .card-primary:focus { outline: none; }
  .card.is-linked:hover .card-name { color: var(--accent-ink); }

  .card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
  .chip {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase;
    color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--hair-2);
    padding: 4px 9px; border-radius: 6px; font-weight: 600;
  }
  .status { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-weight: 600; }
  .status .dot { width: 7px; height: 7px; border-radius: 50%; }
  .status.live { color: var(--live); background: var(--live-wash); }
  .status.live .dot { background: var(--live); box-shadow: 0 0 0 3px var(--live-wash); }
  .status.prog { color: var(--prog); background: var(--prog-wash); }
  .status.prog .dot { background: var(--prog); }

  .card-name { font-family: var(--font-disp); font-size: 20px; font-weight: 720; letter-spacing: -0.018em; margin: 0; line-height: 1.15; transition: color .2s; }
  .tagline { margin: 5px 0 0; font-size: 13px; color: var(--accent-ink); font-weight: 550; }
  .desc { margin: 11px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }

  .tech { list-style: none; margin: 15px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
  .tech li { font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--hair-2); border-radius: 5px; padding: 3px 7px; background: var(--surface-2); }

  .card-foot {
    margin-top: auto; padding-top: 15px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border-top: 1px solid var(--hair-2);
  }
  .domain { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
  .domain .host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card.is-linked:hover .domain { color: var(--ink-soft); }
  .gate { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); border: 1px solid var(--hair-2); border-radius: 5px; padding: 1px 5px; font-size: 10px; letter-spacing: .03em; }
  .gate svg { width: 9px; height: 9px; }

  .open { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: color .2s, gap .2s; }
  .open .arw { transition: transform .2s; }
  .card.is-linked:hover .open { color: var(--accent-ink); }
  .card.is-linked:hover .open .arw { transform: translate(2px, -2px); }

  .repo { position: relative; z-index: 2; font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 5px; transition: color .16s; }
  .repo:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
  .repo svg { width: 13px; height: 13px; }

  /* Private source: stated, not linked — a "code" link nobody can open is a 404 with extra steps. */
  .repo-private {
    font-family: var(--mono); font-size: 11px; letter-spacing: .02em;
    color: var(--muted); display: inline-flex; align-items: center; gap: 5px;
    white-space: nowrap;
  }
  .repo-private svg { width: 10px; height: 10px; flex: none; }

  /* Internal / employer work: on the record, deliberately not a destination. */
  .int-tag {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
    font-weight: 700; color: var(--ink-soft); background: var(--surface-2);
    border: 1px solid var(--hair); border-radius: 5px; padding: 3px 7px;
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  }
  .int-tag svg { width: 9px; height: 9px; flex: none; }

  .card.is-static { background: var(--surface-2); }
  .card.is-static .card-foot { color: var(--muted); }
  .note { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .02em; }

  .card.hide { display: none; }

  /* ============ TIERS: hub / featured / also-built ============ */
  /* Section eyebrows encode prominence, which is real information here:
     featured = start here, all builds = the catalog, also built = the long tail. */
  .sec { margin-top: 34px; }
  .sec:first-of-type { margin-top: 0; }
  .sec-label {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .19em;
    text-transform: uppercase; color: var(--muted); font-weight: 600;
    margin: 0 0 12px; display: flex; align-items: baseline; gap: 9px;
  }
  .sec-label::after { content:""; flex: 1; height: 1px; background: var(--hair); }
  .sec-label .c { font-weight: 500; opacity: .75; }
  .card-top-l { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }

  /* Hub — the curated portfolio this index feeds. Full width, not a build card. */
  .hub {
    position: relative; display: flex; align-items: center; justify-content: space-between;
    gap: 18px; flex-wrap: wrap;
    background: var(--accent-wash); border: 1px solid var(--accent);
    border-radius: var(--radius); padding: 18px 22px; margin-bottom: 6px;
    transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s;
    color: inherit; text-decoration: none;
  }
  .hub:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
  .hub:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
  .hub-eyebrow {
    font-family: var(--mono); font-size: 10px; letter-spacing: .17em; text-transform: uppercase;
    color: var(--accent-ink); font-weight: 700;
  }
  .hub-name { font-family: var(--font-disp); font-size: 21px; font-weight: 740; letter-spacing: -0.02em; margin: 3px 0 0; }
  .hub-desc { margin: 5px 0 0; font-size: 13.5px; color: var(--ink-soft); max-width: 62ch; }
  .hub-go {
    font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--accent-ink);
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  }
  .hub:hover .hub-go .arw { transform: translate(2px,-2px); }

  /* Featured — wider tracks and a marked card, no decorative rail. */
  .grid.feat { grid-template-columns: repeat(auto-fill, minmax(408px, 1fr)); }
  @media (max-width: 560px){ .grid.feat { grid-template-columns: 1fr; } }
  .card.is-feat { background: color-mix(in srgb, var(--accent-wash) 55%, var(--surface)); min-height: 250px; }
  .card.is-feat .card-name { font-size: 22.5px; }
  .card.is-feat .desc { font-size: 14px; }
  .feat-tag {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase;
    font-weight: 700; color: var(--accent-ink); border: 1px solid var(--accent);
    border-radius: 5px; padding: 3px 7px;
  }

  /* Also built — compact rows, deliberately not cards. */
  .also { border-top: 1px solid var(--hair); }
  .also-row {
    display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
    padding: 11px 4px; border-bottom: 1px solid var(--hair-2);
    text-decoration: none; color: inherit;
  }
  a.also-row:hover { background: var(--surface-2); }
  a.also-row:hover .also-name { color: var(--accent-ink); }
  .also-name { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; min-width: 190px; }
  .also-tag { font-size: 13px; color: var(--ink-soft); flex: 1; min-width: 180px; }
  .also-host { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }

  /* ============ FOOTER ============ */
  .foot { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--hair); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .foot p { margin: 0; font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
  .foot a { color: var(--accent-ink); text-decoration: none; }
  .foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) {
    .card { animation: none !important; }
    * { transition: none !important; }
  }
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
  }


  /* Search Box Styling */
  .search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 240px;
  }
  .search-box svg {
    position: absolute;
    left: 14px;
    color: var(--muted);
    pointer-events: none;
  }
  .search-box input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    border-radius: 999px;
    border: 1px solid var(--hair);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
  }

  /* Bento Grid Glow Effects */
  .card {
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
    border: 1px solid var(--hair);
    position: relative;
    overflow: hidden;
  }
  .card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .card:hover::before {
    opacity: 1;
  }


  /* ==================== COMMAND PALETTE ==================== */
  .cmd-palette {
    position: fixed; inset: 0; z-index: 2000;
    display: none; align-items: flex-start; justify-content: center;
    padding-top: max(10vh, 60px); opacity: 0; transition: opacity 0.2s ease;
  }
  .cmd-palette.open { display: flex; opacity: 1; }
  .cmd-overlay {
    position: absolute; inset: 0;
    background: rgba(8, 12, 20, 0.75);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .cmd-dialog {
    position: relative; z-index: 2; width: min(640px, 92vw);
    background: var(--surface, #14191f);
    border: 1px solid var(--hair, #262d38);
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px var(--accent);
    display: flex; flex-direction: column;
    max-height: 70vh; animation: cmdPop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @keyframes cmdPop {
    from { transform: scale(0.96) translateY(-10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
  }
  .cmd-input-wrap {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--hair, #262d38);
    background: transparent;
  }
  .cmd-input-wrap svg { color: var(--accent); flex-shrink: 0; }
  .cmd-input-wrap input {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: var(--sans); font-size: 16px; color: var(--ink, #fff);
  }
  .cmd-kbd {
    font-family: var(--mono, monospace); font-size: 11px;
    padding: 3px 7px; border-radius: 5px;
    background: var(--surface-2, rgba(255,255,255,0.06));
    border: 1px solid var(--hair, rgba(255,255,255,0.1));
    color: var(--muted);
  }
  .cmd-results {
    overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px;
  }
  .cmd-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 14px; border-radius: 8px; cursor: pointer;
    color: var(--ink, #fff); text-decoration: none; font-size: 14px;
    transition: background 0.15s;
  }
  .cmd-item:hover, .cmd-item.active {
    background: var(--accent-wash, rgba(99,102,241,0.15));
    color: var(--accent-ink, #8b5cf6);
  }
  .cmd-item-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
  .cmd-item-badge {
    font-family: var(--mono, monospace); font-size: 10px;
    padding: 2px 6px; border-radius: 4px; background: var(--surface-2);
    color: var(--muted); text-transform: uppercase;
  }
  .cmd-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-top: 1px solid var(--hair, #262d38);
    font-family: var(--mono, monospace); font-size: 11px; color: var(--muted);
    background: var(--surface-2, rgba(0,0,0,0.2));
  }
  .cmd-footer kbd {
    background: var(--surface); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--hair);
  }

  /* Kbd shortcut pill on masthead / nav */
  .cmd-trigger-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--hair);
    color: var(--muted); font-family: var(--mono); font-size: 12px;
    cursor: pointer; transition: border-color 0.2s, color 0.2s;
  }
  .cmd-trigger-btn:hover { border-color: var(--accent); color: var(--ink); }

  /* Clickable tech tags */
  .tech li {
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .tech li:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
    background: var(--accent-wash);
  }


/* ==================== TELEMETRY HUD BAR ==================== */
.telemetry-hud {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; overflow-x: auto; padding: 10px 20px;
  background: var(--surface-2, rgba(13, 19, 34, 0.8));
  border: 1px solid var(--hair, rgba(255,255,255,0.1));
  border-radius: 999px; margin: 20px 0 30px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-family: var(--mono, monospace); font-size: 11.5px;
  scrollbar-width: none;
}
.telemetry-hud::-webkit-scrollbar { display: none; }
.hud-item {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.hud-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal, #14b8a6);
  box-shadow: 0 0 8px var(--teal, #14b8a6);
  animation: hudPulse 2s infinite ease-in-out;
}
@keyframes hudPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.hud-label { color: var(--muted, #8b96ab); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-val { color: var(--ink, #fff); font-weight: 700; }
.hud-sep { color: var(--hair, rgba(255,255,255,0.15)); }

/* ==================== ECOSYSTEM GRAPH CANVAS ==================== */
.ecosystem-container {
  position: relative; width: 100%; height: 380px;
  background: var(--surface-2, rgba(13, 19, 34, 0.6));
  border: 1px solid var(--hair, rgba(255,255,255,0.1));
  border-radius: 20px; overflow: hidden; margin: 28px 0 40px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.3);
}
.ecosystem-container canvas {
  display: block; width: 100%; height: 100%; cursor: pointer;
}
.ecosystem-header {
  position: absolute; top: 16px; left: 20px; z-index: 2;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--accent-ink, #8b5cf6);
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.ecosystem-hint {
  position: absolute; bottom: 14px; right: 20px; z-index: 2;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  pointer-events: none; opacity: 0.8;
}

/* ==================== SPECULAR CURSOR GLARE ==================== */
.card, .project-card, .hub, .stat-item {
  --glare-x: 50%;
  --glare-y: 50%;
  --glare-opacity: 0;
  position: relative;
}
.card::after, .project-card::after, .hub::after, .stat-item::after {
  content: '';
  position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(
    500px circle at var(--glare-x) var(--glare-y),
    rgba(255, 255, 255, 0.14),
    transparent 50%
  );
  opacity: var(--glare-opacity);
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
}
[data-theme="light"] .card::after,
[data-theme="light"] .project-card::after,
[data-theme="light"] .hub::after,
[data-theme="light"] .stat-item::after {
  background: radial-gradient(
    500px circle at var(--glare-x) var(--glare-y),
    rgba(99, 102, 241, 0.12),
    transparent 50%
  );
}


/* 3D Solar System Styles */
.solar-system-wrapper {
  width: 100%;
  height: 480px;
  position: relative;
  background: radial-gradient(circle at center, rgba(13,19,34,0.3) 0%, transparent 70%);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 3rem;
  overflow: hidden;
  cursor: grab;
}
.solar-system-wrapper:active { cursor: grabbing; }

/* The orbit map is drawn for a dark sky — starfield and label colors have no
   light-mode variants. Rather than a washed-out grey haze, frame it as a dark
   viewport in light theme, like a window onto space. */
[data-theme="light"] .solar-system-wrapper {
  background: radial-gradient(circle at center, #101522 0%, #0b0e13 78%);
  border-color: rgba(16, 24, 33, 0.18);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .solar-system-wrapper {
    background: radial-gradient(circle at center, #101522 0%, #0b0e13 78%);
    border-color: rgba(16, 24, 33, 0.18);
  }
}

.solar-hint {
  position: absolute;
  bottom: 1rem;
  right: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
  z-index: 10;
}

/* Map chrome: caption (top-left), toggle (top-right). The toggle ships `hidden`
   in the markup and is revealed by the engine only once the scene exists, so a
   WebGL failure never leaves a dead button behind. */
.solar-caption {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  z-index: 10;
  margin: 0;
  max-width: min(60%, 420px);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.solar-toggle {
  position: absolute;
  top: 0.85rem;
  right: 1.25rem;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(13, 19, 34, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e9f0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.solar-toggle:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(240, 171, 77, 0.18);
}
.solar-toggle[aria-pressed="false"] { color: #8b96ab; }
.solar-toggle[hidden] { display: none; }
@media (max-width: 640px) {
  .solar-caption { font-size: 0.65rem; max-width: 55%; }
  .solar-toggle { padding: 6px 11px; font-size: 0.66rem; }
}

/* Crisp HTML CSS2D Labels */
.solar-label {
  font-family: var(--sans);
  background: rgba(13, 19, 34, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 12px;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  /* NEVER transition `transform` here. CSS2DRenderer rewrites transform on every
     animation frame to track the 3D position; a transition on it restarts a 200ms
     animation 60x/second, so the label never reaches its target and smears toward
     the origin. Transition only the properties the renderer does not own. */
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, scale 0.2s ease;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.solar-label:hover {
  /* `scale` (the standalone property) composes with the renderer's `transform`
     instead of replacing it — using transform here would rip the label off its planet. */
  scale: 1.1;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
}

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

.label-sun {
  font-size: 0.9rem;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.label-moon {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-color: rgba(255,255,255,0.05);
  color: #94a3b8;
}

/* Hovered planet: its label lights up so the sphere reads as clickable. */
.solar-label.is-hot {
  border-color: rgba(240, 171, 77, 0.65);
  background: rgba(240, 171, 77, 0.16);
  color: #fff;
}

/* Build names are opt-in via the toggle — 22 labels at once overlap badly. */
.solar-system-wrapper.hide-build-labels .label-moon { display: none; }

/* --- Map labels v2: captions, not chrome ---
   Hidden until asked: the toggle reveals stack labels; hovering a planet reveals
   just that planet's (.is-hot). Labels are never click targets — they orbit with
   their planet and chasing a moving hitbox is a miserable interaction — so they
   take no pointer events at all. Fade uses opacity/visibility; `transform` stays
   owned by CSS2DRenderer (see the smear note above). */
.solar-label {
  pointer-events: none !important;
  cursor: default;
  /* Opacity-only fade, no visibility choreography: pointer-events already makes
     hidden labels inert, and a delayed discrete `visibility` transition depends on
     the main-thread animation clock, which throttled/occluded tabs freeze. */
  opacity: 0;
  transition: opacity 0.25s ease;
}
#solar-system-container.show-labels .solar-label,
.solar-label.is-hot {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .solar-label { transition: none; }
}
