  :root {
    --transition: 0.25s ease;
    /* Type scale — golden ratio (φ ≈ 1.618) modular steps from 1rem base.
       Refactored Nov 2026 from 24 arbitrary sizes down to 7 mathematically
       derived steps. Visible hierarchy is clearer; maintenance is one variable. */
    --fs-xs: 0.618rem;    /* ~10px — micro labels, captions */
    --fs-sm: 0.786rem;    /* ~12.6px — small UI labels, nav items, chips */
    --fs-md: 1rem;        /* 16px — body text, chat messages */
    --fs-lg: 1.272rem;    /* ~20.4px — emphasis, card descriptions */
    --fs-xl: 1.618rem;    /* ~25.9px — section headings, card titles */
    --fs-2xl: 2.058rem;   /* ~32.9px — page headings */
    --fs-3xl: 2.618rem;   /* ~41.9px — hero display */

    /* Display-tier font (chat-welcome title, page titles, project chips,
       work card titles, POV piece titles, project detail hero). Uses
       JetBrains Mono — already loaded for the eyebrow/scope labels, so no
       additional font payload. Body sans (Inter) and serif (Source Serif 4)
       stay as-is for the body / topnav / avatars / POV essay copy. */
    --font-display: 'JetBrains Mono', Menlo, Consolas, monospace;
  }
  [data-theme="light"] {
    --bg-primary: #FFFFFF; --bg-secondary: #F8F6FC; --bg-card: #FFFFFF;
    --bg-sidebar: #F4F1FA; --bg-hover: #EBE5F5;
    --text-primary: #14102B; --text-secondary: #534762; --text-muted: #978CA8;
    /* Primary: royal violet. 6.5:1 on white (AAA Large / AA Normal).
       --accent-solid carries the white-text-safe shade for filled bg.
       --accent-hover is the darker variant used on filled-button :hover states. */
    --accent: #6D28D9; --accent-solid: #6D28D9; --accent-hover: #5B21B6;
    --accent-light: rgba(109,40,217,0.08); --accent-mid: rgba(109,40,217,0.14);
    /* Secondary: deep emerald. 5.2:1 on white. Used on .wc-scope,
       .pov-piece-eyebrow, and em.key for a supporting signal accent. */
    --accent-2: #0F8755; --accent-2-solid: #0F8755;
    --accent-2-light: rgba(15,135,85,0.08); --accent-2-mid: rgba(15,135,85,0.14);
    --border: #E5DEEF; --border-light: #F1ECF7;
  }
  [data-theme="dark"] {
    --bg-primary: #13121C; --bg-secondary: #1C1B2A; --bg-card: #211F30;
    --bg-sidebar: #181725; --bg-hover: #2A2840;
    --text-primary: #F4F2FA; --text-secondary: #A39EB5; --text-muted: #6E6885;
    /* Primary: lavender for text (8.5:1 on graphite — AAA). Solid uses
       deeper violet so white text on it still passes AA (5.0:1).
       --accent-hover is the darker variant used on filled-button :hover states. */
    --accent: #A78BFA; --accent-solid: #6D4FCA; --accent-hover: #5B21B6;
    --accent-light: rgba(167,139,250,0.10); --accent-mid: rgba(167,139,250,0.18);
    /* Secondary: mint for text (9.8:1 on graphite — AAA). Solid uses
       deeper emerald (5.2:1 with white). */
    --accent-2: #34D399; --accent-2-solid: #0F8755;
    --accent-2-light: rgba(52,211,153,0.10); --accent-2-mid: rgba(52,211,153,0.18);
    --border: #2A2840; --border-light: #1C1B2A;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  /* The safe-area zone above the topnav (iPhone status bar / notch / Dynamic
     Island) is painted via html so it visually blends with the topnav. */
  html { background: var(--bg-sidebar); }
  body {
    font-family: 'Inter', sans-serif; background: var(--bg-primary);
    color: var(--text-primary); height: 100vh; overflow: hidden;
    /* Push body content below the iOS status bar / notch via safe-area-inset.
       border-box (from the universal reset above) keeps total height = 100vh,
       so the safe-area space eats into the content box rather than overflowing. */
    padding-top: env(safe-area-inset-top, 0px);
    display: flex; flex-direction: column;
    transition: background var(--transition), color var(--transition);
  }

  /* ===== TOP NAV ===== */
  .topnav {
    /* 76px tall (was 56) — content vertically centered, giving the buttons
       symmetric breathing room above (toward status bar) and below.
       `position: relative` so the mobile-menu (absolute child) anchors to
       the topnav's actual bottom edge — no env() math, no detachment. */
    position: relative;
    width: 100%; height: 76px; flex-shrink: 0;
    background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 1.5rem 0 1.5rem;
    transition: background var(--transition), border-color var(--transition);
    z-index: 50;
  }
  .topnav-left {
    display: flex; align-items: center; gap: 0.5rem;
  }
  .topnav-name {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-lg);
    font-weight: 700; white-space: nowrap;
  }
  .topnav-center {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-hover); border-radius: 10px; padding: 3px;
  }
  .nav-item {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.4rem 0.85rem; border-radius: 8px; cursor: pointer;
    font-size: var(--fs-md); font-weight: 500; color: var(--text-secondary);
    border: none; background: none; white-space: nowrap;
    transition: all 0.15s ease;
  }
  .nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
  .nav-item.active { background: var(--bg-card); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
  .nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
  .topnav-right {
    display: flex; align-items: center; gap: 0.75rem;
  }
  .topnav-links {
    display: flex; align-items: center; gap: 0.6rem;
  }
  .topnav-links a {
    font-size: var(--fs-sm); color: var(--text-muted); text-decoration: none;
    transition: color 0.2s ease; display: flex; align-items: center; gap: 0.3rem;
  }
  .topnav-links a:hover { color: var(--accent); }
  .topnav-links a svg { width: 14px; height: 14px; }
  .theme-toggle {
    background: none; border: 1px solid var(--border); border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: border-color var(--transition), color var(--transition);
    color: var(--text-muted);
  }
  .theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
  .theme-toggle svg { width: 16px; height: 16px; }

  /* Meet — gateway link to /hi (digital business card + agent manifest).
     Mirrors .topnav-share visually: 32px circle, hairline border, same hover.
     Stays visible at mobile breakpoints (it's a primary entry point, not a
     desktop-only convenience). Envelope icon — universal "reach out", distinct
     from Chat's speech bubble.

     NOTE on naming: the URL is /hi (matches the page's "Hi. I'm Jorge."
     greeting) but the button label is "Meet" (action verb in topnav). The
     class name follows the label. */
  .topnav-meet {
    background: none; border: 1px solid var(--border); border-radius: 50%;
    width: 32px; height: 32px; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
    color: var(--text-secondary); text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }
  .topnav-meet:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
  .topnav-meet svg { width: 15px; height: 15px; }

  /* Project chips bar (work page) */
  .project-chips {
    display: flex; gap: 0.4rem; padding: 1rem 2.5rem 0.5rem;
    overflow-x: auto; flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }
  .project-chips::-webkit-scrollbar { height: 0; }
  .project-item {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.75rem; border-radius: 20px; cursor: pointer;
    font-size: var(--fs-sm); color: var(--text-secondary);
    border: 1px solid var(--border); background: var(--bg-card);
    white-space: nowrap; flex-shrink: 0;
    transition: all 0.15s ease;
  }
  .project-item:hover { border-color: var(--accent); color: var(--text-primary); }
  .project-item.active { background: var(--accent-light); color: var(--accent); font-weight: 500; border-color: var(--accent); }
  .project-item .dot { display: none; }
  .project-company {
    font-size: var(--fs-xs); color: var(--text-muted); margin-left: 0.15rem;
    opacity: 0.7;
  }

  /* ===== MAIN AREA ===== */
  .main {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden;
  }

  /* ===== PAGE: CHAT W/ JORGE ===== */
  .page { display: none; flex: 1; flex-direction: column; overflow: hidden; }
  .page.active { display: flex; }

  /* Chat page */
  .chat-page { flex-direction: row !important; }
  .chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; padding: 0 40px; }
  .chat-canvas {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
  }

  /* Right panel — hidden in all viewports per Nov 2026 decision.
     The component (Progress / Artifacts / Context) didn't earn its place in the
     UI. Hiding via `display: none` removes from the accessibility tree (screen
     readers + keyboard nav can't reach it). Also hides the topnav panel-toggle
     button so users don't see a dead control. Keep the markup + JS in place so
     we can flip it back on if we want it later — just remove these rules. */
  .right-panel,
  .right-panel-backdrop,
  .panel-toggle {
    display: none !important;
  }
  .right-panel {
    width: 300px; flex-shrink: 0;
    display: flex; flex-direction: column;
    gap: 0.6rem; padding: 0.75rem;
    margin: 0.75rem 0.75rem 0.75rem 0;
    height: auto; align-self: stretch;
    max-height: calc(100% - 1.5rem);
    overflow: hidden;
    transition: width 0.3s ease, padding 0.3s ease, margin 0.3s ease, opacity 0.2s ease;
  }
  .right-panel.collapsed {
    width: 0; padding-left: 0; padding-right: 0;
    margin-left: 0; margin-right: 0;
    opacity: 0; pointer-events: none;
  }
  .rp-section {
    background: var(--bg-sidebar); border: 1px solid var(--border);
    border-radius: 12px;
    display: flex; flex-direction: column;
    flex: 1 1 auto; min-height: 0;
    overflow: hidden;
    transition: background var(--transition), border-color var(--transition);
  }
  .rp-section.collapsed {
    flex: 0 0 auto; /* shrink to header only */
  }
  .rp-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 0.95rem;
    cursor: pointer; user-select: none;
    flex-shrink: 0;
    transition: background 0.15s ease;
  }
  .rp-section-header:hover { background: var(--bg-hover); }
  .rp-section-title {
    font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary);
  }
  .rp-section-icon {
    width: 14px; height: 14px; color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
  }
  .rp-section.collapsed .rp-section-icon { transform: rotate(-90deg); }
  .rp-section-body {
    padding: 0 0.95rem 0.85rem;
    overflow-y: auto; min-height: 0;
    flex: 1 1 auto;
    /* Custom scrollbar for the section bodies */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .rp-section-body::-webkit-scrollbar { width: 6px; }
  .rp-section-body::-webkit-scrollbar-track { background: transparent; }
  .rp-section-body::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: 3px;
  }
  .rp-section.collapsed .rp-section-body { display: none; }

  /* Panel toggle button in topnav */
  .panel-toggle {
    background: transparent; border: 1px solid var(--border);
    width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    margin-left: 0.4rem;
  }
  .panel-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
  }
  .panel-toggle svg { width: 16px; height: 16px; }

  /* Progress items */
  .progress-item {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.3rem 0; font-size: var(--fs-sm); color: var(--text-secondary);
    line-height: 1.4;
  }
  .progress-check {
    width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid var(--border); display: flex;
    align-items: center; justify-content: center; margin-top: 1px;
    transition: all 0.3s ease;
  }
  .progress-item.done .progress-check {
    background: #4A90D9; border-color: #4A90D9;
  }
  .progress-item.done .progress-check svg { opacity: 1; }
  .progress-check svg {
    width: 10px; height: 10px; color: #fff; opacity: 0;
    transition: opacity 0.2s ease;
  }
  .progress-label { transition: all 0.3s ease; }
  .progress-item.done .progress-label {
    text-decoration: line-through; color: var(--text-muted);
  }

  /* Artifacts */
  .artifact-link {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.5rem; border-radius: 6px;
    font-size: var(--fs-sm); color: var(--text-secondary);
    text-decoration: none; transition: all 0.15s ease;
    margin-bottom: 2px;
  }
  .artifact-link:hover { background: var(--bg-hover); color: var(--text-primary); }
  .artifact-icon {
    width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-xs); font-weight: 700; font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase; letter-spacing: 0.02em;
  }
  .artifact-icon.pdf { background: #FDECEA; color: #C0392B; }
  .artifact-icon.link { background: #E8F0FE; color: #1A73E8; }
  .artifact-icon.email { background: #FFF3E0; color: #E65100; }
  [data-theme="dark"] .artifact-icon.pdf { background: rgba(192,57,43,0.15); }
  [data-theme="dark"] .artifact-icon.link { background: rgba(26,115,232,0.15); }
  [data-theme="dark"] .artifact-icon.email { background: rgba(230,81,0,0.15); }
  .artifact-name { font-weight: 500; }

  /* Context */
  .context-sub {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: 0.5rem; margin-top: 0.65rem;
  }
  .context-sub:first-child { margin-top: 0; }
  .context-source {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0; font-size: var(--fs-sm); color: var(--text-secondary);
  }
  .context-source-icon {
    width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0;
  }
  .status-row {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.25rem 0; font-size: var(--fs-sm); color: var(--text-secondary);
    line-height: 1.45;
  }
  .status-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    margin-top: 4px;
  }
  .status-dot.green { background: #4CAF50; }
  .status-dot.blue { background: #4A90D9; }
  .status-dot.amber { background: #F5A623; }

  @media (max-width: 1100px) {
    .right-panel { width: 240px; }
  }
  /* On mobile the right panel becomes a slide-in drawer from the right.
     `.collapsed` (the default state on mobile) hides it off-canvas; tapping
     the panel-toggle button in the topnav removes `.collapsed`, sliding it in.
     A backdrop dims the rest of the UI and dismisses the drawer on tap. */
  @media (max-width: 900px) {
    .right-panel {
      position: fixed;
      top: calc(76px + env(safe-area-inset-top, 0px));
      right: 0;
      bottom: 0;
      width: min(85vw, 340px);
      max-height: none;
      margin: 0;
      padding: 0.75rem;
      background: var(--bg-sidebar);
      border-left: 1px solid var(--border);
      box-shadow: -8px 0 24px rgba(0,0,0,0.18);
      transform: translateX(0);
      transition: transform 0.25s ease;
      z-index: 48;
      overflow-y: auto;
      opacity: 1;
    }
    .right-panel.collapsed {
      transform: translateX(100%);
      width: min(85vw, 340px);
      padding: 0.75rem;
      margin: 0;
      opacity: 1;
      pointer-events: none;
    }
    .right-panel-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.4);
      z-index: 47;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }
    body:has(.right-panel:not(.collapsed)) .right-panel-backdrop {
      opacity: 1;
      pointer-events: auto;
    }
  }
  .chat-welcome-area {
    text-align: center; padding: 2rem; max-width: 520px;
  }
  .cw-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent-light); border: 1.5px solid var(--accent-mid);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: var(--fs-lg); font-weight: 700;
    font-family: 'Source Serif 4', serif; margin: 0 auto 1.25rem;
  }
  .cw-title {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-xl);
    font-weight: 700; margin-bottom: 0.5rem;
  }
  .cw-desc {
    font-size: var(--fs-md); color: var(--text-secondary); line-height: 1.6;
    margin-bottom: 2rem;
  }
  .cw-chips {
    display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  }
  .cw-chip {
    font-size: var(--fs-sm); font-family: 'Inter', sans-serif; font-weight: 500;
    padding: 0.5rem 1rem; border-radius: 20px;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease;
  }
  .cw-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

  /* Chat messages area (replaces welcome) */
  .chat-messages-area {
    flex: 1; overflow-y: auto; padding: 1.5rem 2rem;
    max-width: 100%; width: 100%;
    display: none; flex-direction: column; gap: 1rem;
  }
  .chat-messages-area.active { display: flex; }

  .msg { display: flex; flex-wrap: wrap; gap: 0.65rem; animation: msgIn 0.3s ease; }
  @keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
  .msg-user { justify-content: flex-end; }
  .msg-agent { justify-content: flex-start; }
  .msg-avatar {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-xs); font-weight: 700; font-family: 'Source Serif 4', serif;
    background: var(--accent-light); color: var(--accent);
    border: 1px solid var(--accent-mid); margin-top: 2px;
  }
  .msg-bubble {
    padding: 0.75rem 1rem; border-radius: 14px;
    font-size: var(--fs-md); line-height: 1.6; max-width: 80%;
  }
  .msg-user .msg-bubble { background: var(--accent-solid); color: #fff; border-bottom-right-radius: 4px; }
  .msg-agent .msg-bubble { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); border-bottom-left-radius: 4px; }

  /* Listen pill (Web Speech API). Appears after an agent reply finishes streaming.
     Uses the visitor's device voice — free, private, accessibility-aligned.
     Pill format (icon + label) makes the affordance discoverable at a glance —
     a lone speaker glyph is too ambiguous in chat context. */
  .msg-speak {
    /* Force a new row across ALL viewport widths (mobile + tablet + desktop)
       so the pill is always below the bubble, not beside it.
       - `flex-basis: 100%` claims the full row → forces a wrap.
       - `max-width: max-content` keeps the visible pill at content width.
       - 36px left margin aligns under the bubble (avatar 26 + gap ~10). */
    flex-basis: 100%;
    max-width: max-content;
    margin: 8px 0 2px 36px;
    height: 30px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer; flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 6px;
    align-self: flex-start;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  }
  .msg-speak::after { content: 'Listen'; }
  .msg-speak.speaking::after { content: 'Stop'; }
  .msg-speak:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
  }
  .msg-speak:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .msg-speak.speaking {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-mid);
  }
  .msg-speak svg { width: 14px; height: 14px; pointer-events: none; flex-shrink: 0; }
  .msg-speak .icon-stop { display: none; }
  .msg-speak.speaking .icon-play { display: none; }
  .msg-speak.speaking .icon-stop { display: block; }
  @media (prefers-reduced-motion: no-preference) {
    .msg-speak.speaking svg { animation: speak-pulse 1.2s ease-in-out infinite; }
  }
  @keyframes speak-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
  }

  /* Reference cards — full-width stacked, tap to open project deep dive */
  .msg-refs {
    display: flex; flex-direction: column; gap: 0.5rem;
    margin: 0.5rem 0 0 34px;
    flex-basis: 100%; width: calc(100% - 34px); max-width: calc(100% - 34px);
  }
  .msg-ref {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.85rem; min-height: 76px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px;
    width: 100%; text-align: left; cursor: pointer;
    font-family: inherit; color: var(--text-primary);
    text-decoration: none;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  }
  .msg-ref:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
  .msg-ref:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
  }
  .msg-ref-thumb {
    width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0;
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
  }
  .msg-ref-thumb.no-image {
    background: linear-gradient(135deg, var(--accent-light) 0%, transparent 100%);
    color: var(--accent); font-size: var(--fs-xs); font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.08em; text-transform: uppercase;
  }
  .msg-ref-body { flex: 1; min-width: 0; }
  .msg-ref-title {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-md); font-weight: 600;
    line-height: 1.25; display: flex; align-items: center; gap: 0.4rem;
    color: var(--text-primary);
  }
  .msg-ref-title svg.lock { width: 11px; height: 11px; opacity: 0.5; flex-shrink: 0; }
  .msg-ref-org {
    font-size: var(--fs-sm); color: var(--text-muted); margin-top: 0.2rem;
    font-family: 'Inter', sans-serif;
  }
  .msg-ref-arrow {
    width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted);
    transition: color 0.18s ease, transform 0.18s ease;
  }
  .msg-ref:hover .msg-ref-arrow { color: var(--accent); transform: translateX(2px); }

  /* Metrics card — surfaced under answers that are fundamentally about scale */
  .msg-metrics {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.4rem; margin: 0.6rem 0 0 34px; max-width: 80%;
  }
  .msg-metric {
    padding: 0.7rem 0.6rem; text-align: center;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-card);
  }
  .msg-metric-value {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-lg); font-weight: 700;
    color: var(--accent); line-height: 1.15;
  }
  .msg-metric-label {
    font-size: var(--fs-xs); color: var(--text-muted); margin-top: 0.25rem;
    line-height: 1.3; letter-spacing: 0.02em;
  }

  /* Contact card — surfaced as a soft redirect for gaps the corpus can't fully fill */
  .msg-contact {
    display: flex; flex-direction: column; gap: 0.55rem;
    margin: 0.6rem 0 0 34px; max-width: 80%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-card);
  }
  .msg-contact-label {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
  }
  .msg-contact-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
  .msg-contact-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.45rem 0.75rem; font-size: var(--fs-sm);
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-primary); color: var(--text-primary);
    text-decoration: none; cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
    font-family: 'Inter', sans-serif;
  }
  .msg-contact-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
  .msg-contact-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

  /* Markdown subset inside chat bubbles */
  .msg-bubble h3.md-h3 {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-md); font-weight: 700;
    margin: 0.7rem 0 0.3rem; color: var(--text-primary); line-height: 1.3;
  }
  .msg-bubble h4.md-h4 {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs); font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
    margin: 0.7rem 0 0.25rem;
  }
  .msg-bubble strong { font-weight: 700; color: var(--text-primary); }
  .msg-bubble em { font-style: italic; }
  .msg-bubble blockquote.md-quote {
    margin: 0.55rem 0; padding: 0.3rem 0 0.3rem 0.7rem;
    border-left: 2px solid var(--accent);
    font-style: italic; font-size: var(--fs-md); line-height: 1.55;
    color: var(--text-primary);
  }
  .msg-bubble ul.md-list { margin: 0.4rem 0; padding-left: 1.1rem; }
  .msg-bubble ul.md-list li { margin-bottom: 0.2rem; line-height: 1.55; }
  .msg-bubble h3.md-h3:first-child,
  .msg-bubble h4.md-h4:first-child,
  .msg-bubble blockquote.md-quote:first-child,
  .msg-bubble ul.md-list:first-child { margin-top: 0; }

  .quick-actions {
    display: flex; flex-wrap: wrap; gap: 0.35rem; padding-left: 34px; margin-top: 0.25rem;
  }
  .qa-btn {
    font-size: var(--fs-sm); padding: 0.35rem 0.65rem; border-radius: 6px;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
  }
  .qa-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

  .typing-dots { display: flex; gap: 3px; padding: 0.75rem 1rem; }
  .td { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: bounce 1.4s infinite; }
  .td:nth-child(2) { animation-delay: 0.15s; }
  .td:nth-child(3) { animation-delay: 0.3s; }
  @keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-3px)} }

  /* Chat input bar */
  .chat-input-bar {
    padding: 0.75rem 0 1.25rem; flex-shrink: 0;
    max-width: 100%; width: 100%;
  }
  .input-container {
    display: flex; gap: 0.5rem; padding: 0.5rem 0.5rem 0.5rem 1rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; transition: border-color 0.2s ease;
    align-items: center;
  }
  .input-container:focus-within { border-color: var(--accent); }
  .chat-input {
    flex: 1; border: none; outline: none; font-size: 16px;
    font-family: 'Inter', sans-serif; background: transparent;
    color: var(--text-primary);
  }
  .chat-input::placeholder { color: var(--text-muted); }
  .send-btn {
    width: 34px; height: 34px; border-radius: 8px; border: none;
    background: var(--accent-solid); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.2s ease; flex-shrink: 0;
  }
  .send-btn:hover { opacity: 0.85; }
  .send-btn svg { width: 14px; height: 14px; }


  /* ===== PAGE: HIS WORK ===== */
  .work-page { flex-direction: column; }

  /* Work grid (default when no project selected) */
  .work-grid-view {
    flex: 1; overflow-y: auto; padding: 1.5rem 2.5rem 2.5rem;
  }
  .work-grid-header {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-xl);
    font-weight: 700; margin-bottom: 0.5rem;
  }
  .work-grid-desc {
    font-size: var(--fs-md); color: var(--text-secondary); margin-bottom: 2rem;
    max-width: 500px; line-height: 1.6;
  }
  .work-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }
  .work-card {
    padding: 1.5rem; border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-card); cursor: pointer; transition: all 0.2s ease;
  }
  .work-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 30px var(--accent-light); }
  .wc-scope {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: 0.5rem;
  }
  .wc-title {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-md);
    font-weight: 700; margin-bottom: 0.2rem;
  }
  .wc-company { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 0.6rem; }
  .wc-desc { font-size: var(--fs-md); color: var(--text-secondary); line-height: 1.6; }

  /* Project detail view */
  .project-detail {
    flex: 1; overflow-y: auto; display: none; flex-direction: column;
  }
  .project-detail.active { display: flex; }

  .pd-back {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: var(--fs-sm); font-family: 'Inter', sans-serif; font-weight: 500;
    color: var(--text-muted); background: none; border: none;
    cursor: pointer; padding: 0; margin-bottom: 0.85rem;
    transition: color 0.2s ease;
  }
  .pd-back:hover { color: var(--accent); }
  .pd-back svg { width: 14px; height: 14px; }

  .pd-header {
    padding: 1rem 2rem 0.75rem;
  }
  .pd-badge {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    color: var(--accent); letter-spacing: 0.12em; text-transform: uppercase;
    background: var(--accent-light); padding: 0.3rem 0.65rem;
    border-radius: 5px; display: inline-block; margin-bottom: 0.65rem;
  }
  .pd-title {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-xl);
    font-weight: 700; margin-bottom: 0.25rem;
  }
  .pd-subtitle { font-size: var(--fs-sm); color: var(--text-secondary); }

  /* ===== SPLIT HERO (D2) ===== */
  .hero-split {
    width: 100%; display: flex;
    border-bottom: 1px solid var(--border);
    min-height: 320px;
  }
  .hero-split-media {
    flex: 1.4; background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem; overflow: hidden; position: relative;
    flex-direction: column;
  }
  .hero-split-info {
    flex: 1; padding: 2rem 1.75rem;
    display: flex; flex-direction: column; justify-content: center;
    border-left: 1px solid var(--border);
  }
  .hero-split-info .hi-company {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: 0.5rem;
  }
  .hero-split-info .hi-title {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-xl); font-weight: 700;
    line-height: 1.3; margin-bottom: 0.3rem;
  }
  .hero-split-info .hi-subtitle {
    font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 0.75rem;
  }
  .hero-split-info .hi-desc {
    font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.6;
    margin-bottom: 1.25rem;
  }
  .hero-split-info .hi-tags {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
  }
  .hero-split-info .hi-tag {
    font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted);
    background: var(--bg-secondary); padding: 0.25rem 0.6rem;
    border-radius: 4px; border: 1px solid var(--border);
  }

  /* Gradient fallback hero (no images) */
  .pd-hero-template {
    /* Hero placeholder locked to the golden ratio (1.618:1) so every project's
       hero reads as the same cinematic frame, regardless of imagery state. */
    width: 100%; aspect-ratio: 1.618 / 1; min-height: 220px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    /* Light: purple primary holding to the 1/φ stop, then green trailing edge */
    background: linear-gradient(135deg, #6D28D9 0%, #5B21B6 61.8%, #10B981 100%);
  }
  [data-theme="dark"] .pd-hero-template {
    background: linear-gradient(135deg, #1E1432 0%, #4C1D95 61.8%, #34D399 100%);
  }
  .pd-hero-template .hero-title {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-3xl); font-weight: 700;
    color: rgba(255,255,255,0.92); letter-spacing: -0.02em;
    text-align: center; padding: 0 2rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.15);
  }
  .pd-hero-template .hero-pattern {
    position: absolute; inset: 0; opacity: 0.06;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.8) 1px, transparent 0);
    background-size: 28px 28px;
  }
  /* NDA-protected project badge — restored 2026-06 (after the password modal
     was killed). Sets honest expectations that visuals stay private by
     design (interview-only), not "coming soon". Rendered conditionally by
     selectProject() for the 4 AWS keys. Pill sits bottom-center over the
     gradient placeholder; dark translucent bg + backdrop-blur reads on the
     bright purple→mint hero without needing a darker hero variant.
     Allows wrap on narrow viewports so the combined "NDA-protected ·
     Visuals shared during a formal interview" copy doesn't overflow. */
  .pd-hero-lock {
    position: absolute; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    max-width: calc(100% - 2rem);
    background: rgba(0,0,0,0.40);
    color: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 18px;
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    white-space: normal;  /* wrap when pill is wider than the placeholder */
  }
  .pd-hero-lock svg { width: 14px; height: 14px; flex-shrink: 0; }
  .pd-hero-lock span { display: inline-block; }

  /* Carousel */
  .carousel-wrapper {
    width: 100%; height: 100%; display: flex;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 0.75rem;
  }
  .carousel-viewport {
    /* Match the placeholder hero's φ aspect ratio so image-based heroes and
       template heroes feel like the same component, not two different shapes. */
    width: 100%; aspect-ratio: 1.618 / 1; min-height: 220px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
  }
  .carousel-viewport img {
    max-width: 100%; max-height: 300px; height: auto;
    object-fit: contain; border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transition: opacity 0.3s ease;
  }
  [data-theme="dark"] .carousel-viewport img {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  }
  .carousel-viewport img.c-hidden { display: none; }
  .carousel-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--bg-card); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.15s ease; color: var(--text-secondary);
    font-size: var(--fs-md); line-height: 1;
  }
  .carousel-nav:hover { background: var(--bg-hover); color: var(--text-primary); }
  .carousel-nav.c-prev { left: 0.5rem; }
  .carousel-nav.c-next { right: 0.5rem; }
  .carousel-dots {
    display: flex; gap: 6px; align-items: center;
    padding-bottom: 0.25rem;
  }
  .carousel-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border); cursor: pointer;
    transition: all 0.2s ease;
  }
  .carousel-dot.active {
    background: var(--accent); width: 20px; border-radius: 4px;
  }
  .carousel-thumbs {
    display: flex; gap: 6px; padding-bottom: 0.25rem;
  }
  .carousel-thumb {
    width: 48px; height: 36px; border-radius: 4px;
    overflow: hidden; cursor: pointer; opacity: 0.5;
    border: 2px solid transparent;
    transition: all 0.2s ease;
  }
  .carousel-thumb.active { opacity: 1; border-color: var(--accent); }
  .carousel-thumb:hover { opacity: 0.85; }
  .carousel-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .image-counter {
    position: absolute; top: 0.75rem; right: 0.75rem;
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    color: var(--text-muted); background: var(--bg-card);
    padding: 0.2rem 0.5rem; border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }

  /* ===== STAR TOGGLE ===== */
  .star-toggle-row {
    display: flex; justify-content: flex-end; align-items: center;
    gap: 0.4rem; padding: 1.25rem 2rem 0;
  }
  .star-toggle-link {
    font-size: var(--fs-sm); font-family: 'Inter', sans-serif; font-weight: 500;
    color: var(--accent); background: none; border: none;
    cursor: pointer; padding: 0;
    transition: color 0.2s ease, opacity 0.2s ease;
  }
  .star-toggle-link:hover:not(:disabled) { color: var(--text-primary); }
  .star-toggle-link:disabled { color: var(--text-muted); opacity: 0.4; cursor: default; }
  .star-toggle-sep { font-size: var(--fs-sm); color: var(--text-muted); }

  /* ===== STAR ACCORDION (stacked) ===== */
  .star-cards {
    display: flex; flex-direction: column;
    gap: 0; padding: 1.25rem 2rem 2.5rem;
  }
  .star-card {
    border: 1px solid var(--border); border-radius: 0;
    background: var(--bg-card); overflow: hidden;
    transition: all 0.2s ease;
  }
  .star-card:first-child { border-radius: 12px 12px 0 0; }
  .star-card:last-child { border-radius: 0 0 12px 12px; }
  .star-card + .star-card { border-top: none; }
  .star-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,0.03); z-index: 1; position: relative; }

  .star-card-header {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.5rem; cursor: pointer;
    transition: background 0.15s ease;
  }
  .star-card-header:hover { background: var(--bg-hover); }

  .star-card-label {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs);
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-light);
    padding: 0.35rem 0.7rem; border-radius: 5px;
    flex-shrink: 0; white-space: nowrap; font-weight: 600;
  }
  .star-card-heading {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-md); font-weight: 700;
    line-height: 1.3; flex: 1;
  }
  .star-card-chevron {
    font-size: var(--fs-md); color: var(--text-muted);
    transition: transform 0.2s ease; flex-shrink: 0;
  }
  .star-card.open .star-card-chevron { transform: rotate(180deg); }

  .star-card-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: none;
  }
  .star-card.open .star-card-body { display: block; }
  .star-card-body h3 { display: none; }

  @keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

  .star-body h3 { display: none; }
  .star-body p { font-size: var(--fs-md); color: var(--text-secondary); line-height: 1.7; margin-bottom: 0.75rem; }
  .star-body ul { list-style: none; padding: 0; margin-bottom: 0.75rem; }
  .star-body li {
    font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.65;
    padding: 0.2rem 0 0.2rem 1rem; position: relative;
  }
  .star-body li::before {
    content: ''; position: absolute; left: 0; top: 0.55rem;
    width: 5px; height: 5px; background: var(--accent); border-radius: 50%;
  }
  .star-quote {
    font-family: 'Source Serif 4', serif; font-size: var(--fs-md);
    font-style: italic; border-left: 3px solid var(--accent);
    padding-left: 1rem; margin: 1rem 0 0.5rem; line-height: 1.5;
    background: var(--accent-light); padding: 0.85rem 1.15rem;
    border-radius: 0 6px 6px 0;
  }
  .results-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem; margin: 1rem 0;
  }
  .result-card {
    padding: 1rem 0.75rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-secondary); text-align: center;
  }
  .rc-num { font-family: 'Source Serif 4', serif; font-size: var(--fs-xl); font-weight: 700; color: var(--accent); }
  .rc-label { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 0.2rem; }

  /* ===== LIGHTBOX ===== */
  .lightbox-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.92); backdrop-filter: blur(8px);
    align-items: center; justify-content: center;
    animation: lbFadeIn 0.2s ease;
  }
  .lightbox-overlay.active { display: flex; }
  @keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }

  .lightbox-content {
    position: relative; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 1rem;
  }

  .lightbox-media {
    max-width: 90vw; max-height: 80vh;
    display: flex; align-items: center; justify-content: center;
  }
  .lightbox-media img {
    max-width: 90vw; max-height: 80vh;
    object-fit: contain; border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  }
  .lightbox-media video {
    max-width: 90vw; max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    background: #000;
  }

  .lightbox-close {
    position: absolute; top: 1.25rem; right: 1.5rem;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; font-size: var(--fs-lg); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease; z-index: 210;
  }
  .lightbox-close:hover { background: rgba(255,255,255,0.2); }

  .lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
    color: #fff; font-size: var(--fs-lg); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease; z-index: 210;
  }
  .lightbox-nav:hover { background: rgba(255,255,255,0.2); }
  .lightbox-nav.lb-prev { left: 1.25rem; }
  .lightbox-nav.lb-next { right: 1.25rem; }

  .lightbox-counter {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-sm);
    color: rgba(255,255,255,0.6); letter-spacing: 0.05em;
  }

  .lightbox-thumbstrip {
    display: flex; gap: 6px; overflow-x: auto;
    max-width: 90vw; padding: 0 1rem;
  }
  .lightbox-thumbstrip::-webkit-scrollbar { height: 4px; }
  .lightbox-thumbstrip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

  .lb-thumb {
    width: 56px; height: 42px; border-radius: 4px;
    overflow: hidden; cursor: pointer; opacity: 0.4;
    border: 2px solid transparent; flex-shrink: 0;
    transition: all 0.2s ease; position: relative;
  }
  .lb-thumb.active { opacity: 1; border-color: var(--accent); }
  .lb-thumb:hover { opacity: 0.7; }
  .lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .lb-thumb-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3);
  }
  .lb-thumb-play svg { width: 16px; height: 16px; color: #fff; }

  /* Video play overlay on carousel */
  .carousel-video-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 3;
  }
  .carousel-play-btn {
    width: 52px; height: 52px; border-radius: 50%;
    background: rgba(0,0,0,0.55); border: 2px solid rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
  }
  .carousel-play-btn:hover { background: rgba(0,0,0,0.7); transform: scale(1.08); }
  .carousel-play-btn svg { width: 22px; height: 22px; color: #fff; margin-left: 2px; }

  /* Expand icon on carousel images */
  .carousel-expand {
    position: absolute; bottom: 0.75rem; right: 0.75rem;
    width: 30px; height: 30px; border-radius: 6px;
    background: rgba(0,0,0,0.5); border: none;
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s ease; z-index: 4;
  }
  .carousel-expand svg { width: 16px; height: 16px; }
  .carousel-viewport:hover .carousel-expand { opacity: 1; }

  @media (max-width: 700px) {
    .lightbox-nav { width: 36px; height: 36px; font-size: var(--fs-md); }
    .lightbox-nav.lb-prev { left: 0.5rem; }
    .lightbox-nav.lb-next { right: 0.5rem; }
    .lb-thumb { width: 44px; height: 33px; }
    .lightbox-close { top: 0.75rem; right: 0.75rem; width: 36px; height: 36px; }
  }

  /* Hero + STAR mobile */
  @media (max-width: 700px) {
    .hero-split { flex-direction: column; min-height: auto; }
    .hero-split-media { padding: 1.25rem; min-height: 200px; }
    .carousel-viewport { min-height: 180px; }
    .carousel-viewport img { max-height: 200px; }
    .hero-split-info {
      border-left: none; border-top: 1px solid var(--border);
      padding: 1.25rem;
    }
    .hero-split-info .hi-title { font-size: var(--fs-lg); }
    .star-cards { padding: 1rem; }
    .star-toggle-row { padding: 1rem 1rem 0; }
    .star-card-body { padding-left: 1.5rem; }
    .star-card-header { padding: 0.85rem 1.25rem; }
  }
  @media (max-width: 440px) {
    .hero-split-media { padding: 1rem; }
    .carousel-viewport img { max-height: 160px; }
    .hero-split-info { padding: 1rem; }
    .hero-split-info .hi-title { font-size: var(--fs-lg); }
    .carousel-thumb { width: 36px; height: 27px; }
    .star-card-header { gap: 0.6rem; padding: 0.75rem 1rem; }
    .star-card-heading { font-size: var(--fs-md); }
    .star-card-body { padding: 0 1rem 1.25rem; }
  }

  /* ===== PAGE: POV ===== */
  .pov-page { overflow-y: auto; padding: 0; }
  .pov-canvas { max-width: 1100px; margin: 0 auto; padding: 4rem 2rem 8rem; }
  .pov-selector {
    position: sticky; top: 0; z-index: 5;
    display: flex; gap: 1.25rem; padding: 1rem 0 1.25rem;
    background: linear-gradient(to bottom, var(--bg-primary) 70%, transparent);
    backdrop-filter: blur(8px);
    font-family: 'Inter', sans-serif; font-size: var(--fs-sm);
    letter-spacing: 0.05em; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4rem;
  }
  .pov-selector a {
    color: var(--text-muted); text-decoration: none; cursor: pointer;
    padding-bottom: 0.4rem; transition: color 0.2s ease;
  }
  .pov-selector a:hover { color: var(--text-primary); }
  .pov-selector a.current { color: var(--accent); border-bottom: 1px solid var(--accent); }

  .pov-piece { margin-bottom: 8rem; }
  .pov-piece:last-child { margin-bottom: 2rem; }

  .pov-piece-title-card {
    min-height: 60vh; display: flex; flex-direction: column; justify-content: center;
    margin: 0 auto 4rem; max-width: 720px;
  }
  .pov-piece-eyebrow {
    font-family: 'JetBrains Mono', monospace; font-size: var(--fs-sm);
    color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase;
    margin-bottom: 1rem;
  }
  .pov-piece-title {
    font-family: 'Source Serif 4', serif; font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 600; line-height: 1.1; letter-spacing: -0.02em;
    margin-bottom: 1.25rem; color: var(--text-primary);
  }
  .pov-piece-dek {
    font-size: var(--fs-md); color: var(--text-secondary); line-height: 1.6;
    max-width: 540px;
  }
  .pov-scroll-cue {
    margin-top: 3rem; font-family: 'JetBrains Mono', monospace;
    font-size: var(--fs-xs); color: var(--text-muted); letter-spacing: 0.15em;
    text-transform: uppercase;
  }

  .pov-body {
    max-width: 680px; margin: 0 auto;
    font-family: 'Source Serif 4', serif; font-size: var(--fs-lg);
    line-height: 1.75; color: var(--text-primary);
  }
  .pov-body p { margin: 0 0 1.5rem; }
  .pov-body h3 {
    font-family: 'Inter', sans-serif; font-size: var(--fs-sm);
    font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-muted); margin: 3.5rem 0 1.25rem;
  }
  .pov-body blockquote {
    margin: 2.5rem 0; padding-left: 1.5rem;
    border-left: 2px solid var(--accent);
    font-style: italic; font-size: var(--fs-lg); line-height: 1.6;
    color: var(--text-primary);
  }
  .pov-body em.key { font-style: italic; color: var(--accent); }
  .pov-thesis {
    margin: 3rem 0 0; padding: 1.5rem 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    font-family: 'Source Serif 4', serif; font-size: var(--fs-lg);
    line-height: 1.6; font-style: italic;
  }

  /* Reveal animation: opacity-only with subtle translate */
  .pov-reveal { opacity: 0; transform: translateY(8px); transition: opacity 0.6s ease, transform 0.6s ease; }
  .pov-reveal.in { opacity: 1; transform: translateY(0); }

  /* Locked-project styling (.project-item.locked, .work-card.locked, lock
     SVGs) and the password-modal CSS (.pw-overlay, .pw-modal, .pw-icon, etc.)
     were removed 2026-06 along with the password-gating system. The /hi page
     handles "request a walkthrough" via Cal.com instead. History in git.

     fadeIn / slideUp keyframes are kept (still used by share.css). */
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

  /* ===== ANIMATIONS ===== */
  @keyframes revealUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes slideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes scaleIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
  @keyframes pageFadeIn { from { opacity: 0; } to { opacity: 1; } }

  .project-detail.active { animation: scaleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
  .hero-split { animation: revealUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
  .hero-split-media { animation: slideInLeft 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
  .hero-split-info { animation: slideInRight 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
  .star-card { animation: revealUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .star-card:nth-child(1) { animation-delay: 0.15s; }
  .star-card:nth-child(2) { animation-delay: 0.2s; }
  .star-card:nth-child(3) { animation-delay: 0.25s; }
  .star-card:nth-child(4) { animation-delay: 0.3s; }

  .page { animation: pageFadeIn 0.3s ease; }

  /* ===== MOBILE ===== */
  @media (max-width: 768px) {
    /* Mirror the desktop topnav padding-top so buttons sit lower on phones too */
    .topnav { padding: 16px 0.75rem 0 0.75rem; gap: 0.5rem; }
    .topnav-name { font-size: var(--fs-md); }
    .topnav-links { display: none; }
    .nav-item { padding: 0.35rem 0.6rem; font-size: var(--fs-sm); }
    /* 16px top padding so chips don't crash into the topnav border */
    .project-chips { padding: 1rem 1rem 0.5rem; }
  }

  /* Hamburger button — hidden by default, shown at <=479px */
  .hamburger-toggle {
    display: none;
    background: transparent; border: 1px solid var(--border);
    width: 36px; height: 36px; border-radius: 8px;
    align-items: center; justify-content: center; cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }
  .hamburger-toggle:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
  .hamburger-toggle svg { width: 18px; height: 18px; }

  /* Slide-down mobile menu */
  .mobile-menu {
    display: none;
    /* Anchored to the topnav's bottom edge via the topnav being position:relative.
       `top: 100%` puts the menu exactly at the topnav's bottom — flush, no gap,
       no env(safe-area) calculation. Eliminates the "detached menu" bug. */
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 0.5rem;
    z-index: 49;
    box-shadow: 0 8px 20px rgba(0,0,0,0.10);
  }
  .mobile-menu.open { display: flex; animation: mobileMenuSlide 0.18s ease-out; }
  @keyframes mobileMenuSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .mobile-menu .nav-item {
    width: 100%; justify-content: flex-start;
    padding: 0.75rem 0.85rem; font-size: var(--fs-md);
    border-radius: 8px;
  }
  .mobile-menu .mm-divider { height: 1px; background: var(--border); margin: 0.4rem 0.2rem; }
  .mobile-menu .mm-link,
  .mobile-menu .mm-action {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem 0.85rem; font-size: var(--fs-md);
    color: var(--text-secondary); text-decoration: none;
    background: none; border: none; border-radius: 8px;
    width: 100%; text-align: left; cursor: pointer;
    font-family: inherit;
  }
  .mobile-menu .mm-link:hover,
  .mobile-menu .mm-action:hover { background: var(--bg-hover); color: var(--text-primary); }
  .mobile-menu .mm-link svg,
  .mobile-menu .mm-action svg { width: 16px; height: 16px; flex-shrink: 0; }

  /* At <=479px: hide desktop nav clusters, show hamburger + keep panel toggle visible */
  @media (max-width: 479px) {
    .topnav { padding: 0 0.6rem; }
    .topnav-right { gap: 0.4rem; }
    .topnav-center { display: none; }
    .topnav-right > .theme-toggle { display: none; }
    .hamburger-toggle { display: inline-flex; order: -1; }
    /* Panel toggle stays visible, sits to the right of the hamburger */
    .panel-toggle { margin-left: 0; }

    /* Chat — widen bubbles by tightening side gutters, and lift input above iOS browser chrome */
    .chat-main { padding: 0 8px; }
    .chat-messages-area { padding: 1rem 0.5rem; }
    .msg-bubble { max-width: 92%; }
    .chat-input-bar {
      /* +20px lift over the iOS Safari bottom toolbar; safe-area-inset adds the home indicator gap on devices that report it */
      padding-bottom: max(calc(1.25rem + 20px), calc(1.25rem + env(safe-area-inset-bottom, 0px)));
    }
  }

  /* ============================================================================
     PG PROMOTION — Nov 2026
     Display-tier headers (chat-welcome, page titles, project chips, work card
     titles, POV piece titles, project detail hero) route through --font-display
     = JetBrains Mono. Mono runs ~30% wider per character, so the display sizes
     get pulled down a step and weights set to 500 (the only bold weight loaded
     for JetBrains Mono in the Google Fonts URL).

     Green secondary (`--accent-2`) flips on three structural labels — the
     scope eyebrow on work cards, the POV piece eyebrow, and the em.key
     italics in the POV essay — giving the system a supporting signal that
     doesn't compete with the brand purple.
     ============================================================================ */
  .cw-title,
  .work-grid-header,
  .project-item,
  .wc-title,
  .pov-piece-title,
  .pd-hero-template .hero-title {
    font-family: var(--font-display);
    font-weight: 500;
  }
  .pov-piece-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    letter-spacing: -0.01em;
    line-height: 1.15;
  }
  .work-grid-header,
  .cw-title {
    font-size: var(--fs-lg);
  }
  .wc-title {
    font-size: var(--fs-sm);
    letter-spacing: 0.01em;
  }
  .project-item {
    font-size: var(--fs-xs);
    letter-spacing: 0;
  }

  /* Green secondary deployments — supportive signal, not brand identity */
  .wc-scope { color: var(--accent-2); }
  .pov-piece-eyebrow { color: var(--accent-2); }
  .pov-body em.key { color: var(--accent-2); }

  /* ============================================================================
     PULL-TO-REFRESH INDICATOR
     Rendered by assets/js/pull-to-refresh.js. Sits fixed below the topnav, off
     screen at rest (translateY -50px relative to its anchor), animated in as
     the user pulls down. Mono label + purple ring; on armed state the border
     and ring tint to accent and pick up a soft glow.

     Hidden on desktop — the JS listeners are gated on viewport width, but the
     CSS @media gate is a belt-and-suspenders safety net.
     ============================================================================ */
  .ptr-indicator {
    position: fixed;
    top: 76px;                  /* matches topnav height — sits just below */
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    z-index: 40;                /* below topnav (50) + switcher panels */
    display: none;              /* shown only at ≤768px via @media below */
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition:
      transform 0.2s ease-out,
      opacity 0.15s ease-out,
      box-shadow 0.2s ease,
      border-color 0.15s ease;
    font-family: var(--font-display);   /* JetBrains Mono */
  }
  .ptr-indicator.ptr-armed {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-mid), 0 0 16px var(--accent-mid);
  }
  .ptr-ring { width: 22px; height: 22px; line-height: 0; }
  .ptr-ring svg {
    width: 100%; height: 100%;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1.5;
    stroke-dasharray: 24 28;          /* incomplete ring — reads as "spinner" */
    stroke-linecap: round;
    transition: stroke 0.15s ease;
  }
  .ptr-indicator.ptr-armed .ptr-ring svg { stroke: var(--accent); }
  .ptr-indicator.ptr-refreshing .ptr-ring svg { animation: ptr-spin 0.6s linear infinite; }
  .ptr-label {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color 0.15s ease;
  }
  .ptr-indicator.ptr-armed .ptr-label { color: var(--accent); }
  @keyframes ptr-spin {
    to { transform: rotate(360deg); }
  }
  @media (max-width: 768px) {
    .ptr-indicator { display: flex; }
  }
  @media (prefers-reduced-motion: reduce) {
    .ptr-indicator { transition: none; }
    .ptr-indicator.ptr-refreshing .ptr-ring svg { animation: none; }
  }
