/* projects.css — the page CSS for projects.html and its /projects/*.html story pages.
 *
 * Lifted verbatim out of projects.html's inline <style> when the story pages were added,
 * so the two tiers and their narrative pages share one stylesheet instead of four copies.
 * Loads AFTER shell.css, so it may override the shared chrome; story-page-only rules live
 * at the bottom under "story pages".
 *
 * index.html / writing.html / radar.html still inline their own copies of the chrome rules
 * (footer, gate, .shell grid); those win over anything here because they load later.
 */
  :root {
    --paper: #080808;
    --panel: #101010;
    --panel-soft: #141414;
    --grid: rgba(255, 255, 255, 0.045);
    --ink: #f5f5f5;
    --muted: #a7a7a7;
    --dim: #808080;
    --line: rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.22);
    --headerFont: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Code", monospace;
    --bodyFont: system-ui, -apple-system, "Segoe UI", sans-serif;
    color-scheme: dark;
  }
  ::selection { background: rgba(127,127,127,0.25); }

  .scroll-progress {
    position: fixed; top: 0; left: 0;
    z-index: 10000;
    height: 3px; width: 0;
    background: var(--ink);
    transition: width 80ms linear;
    pointer-events: none;
  }

  /* ─── Shell + Sidebar ─── */
  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }

  .status {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.3rem 0.5rem;
    font-family: var(--headerFont); font-size: 0.62rem; color: var(--muted);
    border: 1px solid var(--line);
    background: #0a0a0a;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .search { position: relative; margin-top: 0.4rem; }
  .search-hint {
    margin-top: 0.35rem;
    font-family: var(--headerFont);
    font-size: 0.62rem;
    color: var(--dim);
    line-height: 1.45;
  }
  .search-hint code {
    color: var(--muted);
    background: #0a0a0a;
    border: 1px solid var(--line);
    padding: 0 0.25rem;
  }

  /* search overlay (obsidian-style) — hidden by default, .is-open on click */
  .search-overlay { display: none; }
  .search-overlay.is-open {
    display: flex; position: fixed; inset: 0;
    background: rgba(0,0,0,0.78); backdrop-filter: blur(6px);
    z-index: 200;
    padding: clamp(3rem, 8vh, 6rem) 1rem 1rem;
    align-items: flex-start; justify-content: center;
  }
  .search-overlay-inner {
    width: 100%; max-width: 620px;
    background: var(--paper); border: 1px solid var(--line-strong);
    padding: 1.2rem; display: flex; flex-direction: column; gap: 0.7rem;
  }
  .search-overlay input {
    width: 100%; padding: 0.7rem 0.85rem;
    background: #0a0a0a; border: 1px solid var(--line);
    color: var(--ink); font-family: var(--headerFont); font-size: 1rem; outline: none;
  }
  .search-overlay input:focus { border-color: var(--ink); }
  .search-overlay-hint { font-family: var(--headerFont); font-size: 0.7rem; color: var(--dim); line-height: 1.6; }
  .search-overlay-hint code {
    color: var(--muted); background: var(--panel);
    border: 1px solid var(--line); padding: 0.05rem 0.3rem; margin-right: 0.25rem;
  }
  .search-overlay-results {
    list-style: none; margin: 0; padding: 0;
    max-height: 50vh; overflow-y: auto;
    border-top: 1px solid var(--line);
  }
  .search-overlay-results li {
    padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--line); cursor: pointer;
    font-family: var(--headerFont); color: var(--ink);
    display: flex; flex-direction: column; gap: 0.25rem;
    transition: background 100ms ease;
  }
  .search-overlay-results li:hover,
  .search-overlay-results li.is-focused { background: var(--panel); }
  .search-overlay-results li:last-child { border-bottom: 0; }
  .search-overlay-results .kind { font-size: 0.62rem; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; }
  .search-overlay-results .title { font-size: 0.92rem; color: var(--ink); }
  .search-overlay-results .meta { font-size: 0.7rem; color: var(--muted); }
  .search-overlay-results .empty { padding: 1rem 0.5rem; color: var(--dim); font-size: 0.85rem; text-align: center; }
  .search-overlay-close {
    position: absolute; top: 1rem; right: 1rem;
    background: transparent; border: 1px solid var(--line);
    color: var(--ink); width: 36px; height: 36px;
    font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .search-overlay:not(.is-open) .search-overlay-close { display: none; }
  .nav a.active { background: #131313; border-left: 2px solid var(--ink); }
  .nav a.active .count { color: var(--ink); }
  .nav-back {
    background: transparent;
    border: 1px dashed var(--line);
    box-shadow: none;
    color: var(--muted);
    margin-bottom: 0.3rem;
  }
  .nav-back:hover { color: var(--ink); border-color: var(--line-strong); background: transparent; box-shadow: none; transform: none; }
  .tag-cloud span {
    font-family: var(--headerFont); font-size: 0.7rem; color: var(--muted);
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: color 100ms ease, border-color 100ms ease;
  }
  .tag-cloud span:hover { color: var(--ink); border-color: var(--line-strong); }
  .tag-cloud span.tag-active { color: var(--ink); border-color: var(--ink); }
  /* the console graph has no node for this tag, so hovering it can light nothing */
  .tag-cloud span.tag-nograph { opacity: 0.45; }

  .sidebar-foot {
    margin-top: auto;
    display: flex; align-items: center; justify-content: space-between;
    font-family: var(--headerFont); font-size: 0.68rem; color: var(--dim);
  }
  .theme-toggle {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
    background: #0c0c0c;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.85rem;
  }
  .theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
  .eyebrow.muted { color: var(--dim); font-weight: 600; }
  .hero-eyebrow { margin-top: 1.5rem; margin-bottom: 2.4rem; }

  /* ─── HERO ─── */
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
    padding-top: 1rem;
    perspective: 1200px;
  }
  .hero h1::after {
    content: "";
    display: block;
    width: 96px; height: 8px;
    margin-top: 1.2rem;
    background-image:
      linear-gradient(90deg, var(--ink) 8px, transparent 8px 16px, var(--ink) 16px 24px,
                      transparent 24px 32px, var(--ink) 32px 40px, transparent 40px 48px,
                      var(--ink) 48px 56px, transparent 56px 64px, var(--ink) 64px 72px,
                      transparent 72px 80px, var(--ink) 80px 88px, transparent 88px 96px);
    image-rendering: pixelated;
  }
  .hero .tag-line {
    max-width: 600px;
    margin: 1.4rem 0 0;
    color: var(--muted);
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.65;
  }
  .hero .tag-line em { color: var(--ink); font-style: italic; }

  /* console card */
  .console {
    padding: 1.3rem;
    background: #050505;
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: var(--headerFont);
    box-shadow: 8px 8px 0 #111111;
    transform-style: preserve-3d;
    transition: transform 200ms ease-out;
    will-change: transform;
  }
  .console-bar span { width: 12px; height: 12px; background: var(--ink); }

  .console p {
    margin: 0.45rem 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
  }

  /* ─── Projects grid (exact homepage card style) ─── */
  .section {
    margin-top: clamp(4rem, 7vw, 5.5rem);
    padding-top: 2rem;
    border-top: 1px solid var(--line);
  }
  .section-lede {
    margin: 0 0 2rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.65;
  }

  .projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--line);
  }
  .project {
    display: flex;
    flex-direction: column;
    padding: 1.6rem 1.4rem;
    min-height: 200px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    transition: background 160ms ease;
    cursor: pointer;
    position: relative;
  }
  .project:nth-child(3n) { border-right: none; }
  .project:hover { background: #141414; }

  .project .num {
    margin: 0 0 1rem;
    font-family: var(--headerFont);
    font-size: 0.74rem;
    color: var(--dim);
    letter-spacing: 0.08em;
  }
  .project .techs {
    margin: 0 0 0.5rem;
    color: var(--dim);
    font-family: var(--headerFont);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
  }
  .project h3 {
    margin: 0 0 0.7rem;
    font-family: var(--headerFont);
    font-size: 1.05rem;
    color: var(--ink);
  }
  .project .teaser {
    margin: 0 0 0.4rem;
    color: var(--muted);
    font-family: var(--headerFont);
    font-size: 0.78rem;
    line-height: 1.45;
    letter-spacing: 0.01em;
  }
  .project:hover .teaser { color: var(--dim); }

  .project-bullets {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
  .project-bullets li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--headerFont);
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.3;
  }
  .project-bullets svg {
    width: 13px; height: 13px;
    color: var(--dim);
    flex-shrink: 0;
  }
  .project:hover .project-bullets svg { color: var(--ink); }

  .project .detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
    transition: max-height 320ms ease, opacity 200ms ease, margin 220ms ease;
  }
  .project:hover .detail {
    max-height: 220px;
    opacity: 1;
    margin-top: 0.6rem;
  }
  .project .foot {
    margin-top: auto;
    padding-top: 0.8rem;
    display: flex; align-items: center; justify-content: space-between;
    font-family: var(--headerFont);
    font-size: 0.72rem;
    color: var(--dim);
  }
  .project .repo-tag {
    display: inline-flex; align-items: center; gap: 0.3rem;
    color: var(--dim);
  }
  .project .repo-tag svg { width: 12px; height: 12px; fill: currentColor; }
  .project .repo-tag.is-private { color: var(--dim); }
  .project .repo-tag.is-public { color: var(--muted); }
  .project .repo-tag.is-public:hover { color: var(--ink); }
  .project .repo-tag.is-story { color: var(--muted); border-color: var(--line-strong); }
  .project .repo-tag.is-story:hover { color: var(--ink); }

  /* ─── WIP strip — one line each, no drawers, no links (see SHARED_SHELL.md tiers) ─── */
  .wip-strip { margin-top: 2rem; padding-top: 1.1rem; border-top: 1px dashed var(--line); }
  .wip-strip .eyebrow { margin-bottom: 0.7rem; }
  .wip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
  .wip-list li {
    display: flex; gap: 0.6rem; align-items: baseline;
    font-family: var(--headerFont); font-size: 0.74rem;
    color: var(--dim); letter-spacing: 0.03em;
  }
  .wip-list .wip-name { color: var(--muted); }
  @media (max-width: 720px) {
    .wip-list li { flex-direction: column; gap: 0.1rem; font-size: 0.7rem; }
  }
  .project .read {
    color: var(--muted);
    transition: color 120ms ease, transform 120ms ease;
  }
  .project:hover .read { color: var(--ink); transform: translateX(3px); }

  .status-pill {
    position: absolute;
    top: 1.6rem; right: 1.4rem;
    display: inline-flex; align-items: center;
    padding: 0.12rem 0.45rem;
    font-family: var(--headerFont);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid var(--line);
    color: var(--muted);
  }
  .status-pill.s-active   { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .status-pill.s-wip      { color: var(--ink); border-color: var(--line-strong); }
  .status-pill.s-research { color: var(--muted); border-color: var(--line); }
  .status-pill.s-done     { color: var(--muted); border-color: var(--line-strong); }

  /* live data badge on project card */
  .live-badge {
    position: absolute;
    top: 3rem; right: 1.4rem;
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.1rem 0.5rem 0.1rem 0.35rem;
    font-family: var(--headerFont);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6ee7b7;
    border: 1px solid rgba(110, 231, 183, 0.45);
    background: rgba(110, 231, 183, 0.06);
  }
  .live-badge .dot {
    width: 6px; height: 6px;
    background: #6ee7b7;
    box-shadow: 0 0 6px #6ee7b7;
    animation: live-pulse 1.4s ease-in-out infinite;
  }
  .live-badge.is-offline {
    color: var(--dim);
    border-color: var(--line);
    background: transparent;
  }
  .live-badge.is-offline .dot { background: var(--dim); box-shadow: none; animation: none; }
  .live-badge .age { color: var(--muted); }
  @keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
  }
  .live-stats {
    margin: 0.4rem 0 0.8rem;
    padding: 0.5rem 0.7rem;
    font-family: var(--headerFont);
    font-size: 0.72rem;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    line-height: 1.4;
  }
  .live-stats strong { color: var(--ink); font-weight: 700; }

  /* ─── End status line ─── */
  .list-status {
    margin-top: 2.5rem;
    padding: 1.2rem 0;
    text-align: center;
    font-family: var(--headerFont);
    font-size: 0.82rem;
    color: var(--dim);
    letter-spacing: 0.04em;
    border-top: 1px dashed var(--line);
  }
  .list-status .count { color: var(--ink); font-weight: 700; }
  .list-status .dots {
    display: inline-block;
    margin-left: 0.4rem;
    color: var(--muted);
    animation: blink 2.4s ease-in-out infinite;
  }
  .list-status .lab-line {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--dim);
    letter-spacing: 0.06em;
  }

  /* ─── Drawer (mirrors index.html) ─── */
  .drawer-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 0s linear 220ms;
    z-index: 90;
  }
  .drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 220ms ease, visibility 0s linear 0s;
  }
  .drawer {
    position: fixed;
    top: 0; right: 0;
    width: min(640px, 92vw);
    height: 100vh;
    background: #050505;
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 0 #111111;
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(.2,.7,.2,1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .drawer.is-open { transform: translateX(0); }
  .drawer-head {
    padding: 0.85rem 1.2rem;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--line);
    font-family: var(--headerFont);
    font-size: 0.78rem;
    color: var(--muted);
  }
  .drawer-close, .drawer-back {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: var(--headerFont);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
  }
  .drawer-close { width: 30px; height: 30px; font-size: 1.1rem; line-height: 1; }
  .drawer-back { padding: 0.32rem 0.6rem; font-size: 0.78rem; }
  .drawer-close:hover, .drawer-back:hover { border-color: var(--ink); background: #111; }
  .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.8rem 1.8rem 4rem;
  }
  .drawer-body .kicker {
    font-family: var(--headerFont);
    font-size: 0.72rem;
    color: var(--dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .drawer-body h2 {
    margin: 0.6rem 0 0.4rem;
    font-family: var(--headerFont);
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 800;
    color: var(--ink);
    line-height: 1.15;
  }
  .drawer-body .meta {
    font-family: var(--headerFont);
    font-size: 0.75rem;
    color: var(--dim);
    margin-bottom: 1.6rem;
  }
  .drawer-body p {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.75;
    margin: 0 0 1.1rem;
  }
  .drawer-body p strong { color: var(--ink); }
  .drawer-body p em { color: var(--ink); font-style: italic; }
  .drawer-body code {
    font-family: var(--headerFont);
    font-size: 0.85rem;
    color: var(--ink);
    background: #0c0c0c;
    border: 1px solid var(--line);
    padding: 0.1rem 0.35rem;
  }
  .drawer-repo {
    display: inline-flex; align-items: center; gap: 0.5rem;
    margin-top: 1.4rem;
    padding: 0.5rem 0.9rem;
    font-family: var(--headerFont);
    font-size: 0.8rem;
    border: 1px solid var(--line-strong);
    color: var(--ink);
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease;
  }
  .drawer-repo:hover { background: #111; border-color: var(--ink); }
  .drawer-repo.is-private { color: var(--dim); border-color: var(--line); cursor: default; pointer-events: none; }
  .drawer-repo svg { width: 14px; height: 14px; fill: currentColor; }

  /* shrink the live-badge to fit alongside techs/h3 without stacking text */
  .project:has(.live-badge) h3,
  .project:has(.live-badge) .techs { padding-right: 4.5rem; }
  .project .live-badge {
    z-index: 2;
    white-space: nowrap;
    font-size: 0.52rem;
    padding: 0.08rem 0.4rem 0.08rem 0.3rem;
    gap: 0.3rem;
  }
  .project .live-badge .dot { width: 5px; height: 5px; }
  @media (max-width: 768px) {
    .project .live-badge .age { display: none; }
  }

  /* linked LinkedIn post inside drawer body (projects) */
  .drawer-body .linked-post {
    display: flex; align-items: center; gap: 0.7rem;
    margin-top: 1.4rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    text-decoration: none;
    color: var(--muted);
    font-family: var(--headerFont);
    font-size: 0.82rem;
    transition: background 120ms ease, border-color 120ms ease;
  }
  .drawer-body .linked-post:hover {
    background: rgba(10, 102, 194, 0.10);
    border-color: #0a66c2;
  }
  .drawer-body .linked-post svg { width: 16px; height: 16px; color: #0a66c2; flex-shrink: 0; }
  .drawer-body .linked-post .lp-kind {
    color: var(--dim);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-right: 1px solid var(--line);
    padding-right: 0.7rem;
  }
  .drawer-body .linked-post .lp-title { color: var(--ink); font-weight: 700; }
  .drawer-body .linked-post .lp-date  { color: var(--dim); font-size: 0.7rem; margin-left: auto; }
  .drawer-body .linked-post .lp-arrow { color: var(--muted); font-weight: 700; }

  /* ─── Drawer · live experiment block ─── */
  .drawer-live {
    margin-top: 1.8rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid rgba(110, 231, 183, 0.35);
    background: rgba(110, 231, 183, 0.04);
    font-family: var(--headerFont);
  }
  .drawer-live.is-offline {
    border-color: var(--line);
    background: transparent;
  }
  .drawer-live-head {
    display: flex; align-items: center; gap: 0.55rem;
    margin: 0 0 0.9rem 0;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .drawer-live-head .dot {
    width: 8px; height: 8px;
    background: #6ee7b7;
    box-shadow: 0 0 8px #6ee7b7;
    animation: drawer-live-pulse 1.4s ease-in-out infinite;
  }
  .drawer-live-head .lbl { color: #6ee7b7; font-weight: 800; }
  .drawer-live-head .age { color: var(--muted); margin-left: auto; font-weight: 600; }
  .drawer-live.is-offline .dot { background: var(--dim); box-shadow: none; animation: none; }
  .drawer-live.is-offline .lbl { color: var(--dim); }
  @keyframes drawer-live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
  }
  .drawer-live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem 1rem;
    margin-bottom: 0.8rem;
  }
  .drawer-live-grid > div {
    display: flex; flex-direction: column; gap: 0.18rem;
    padding: 0.5rem 0;
    border-top: 1px dashed var(--line);
  }
  .drawer-live-grid .k {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .drawer-live-grid .v {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.05;
  }
  .drawer-live-foot {
    margin: 0;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    font-size: 0.7rem;
    color: var(--muted);
  }

  /* ─── Footer ─── */
  footer.foot {
    margin-top: clamp(4rem, 7vw, 5.5rem);
    padding: 2.5rem 0 3rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--headerFont);
    font-size: 0.78rem;
  }
  .foot-row {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1.5rem;
  }
  .foot-socials { display: flex; gap: 1.1rem; align-items: center; }
  .foot-socials a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    color: var(--ink);
    transition: opacity 120ms ease, transform 120ms ease;
    opacity: 0.7;
  }
  .foot-socials a:hover { opacity: 1; transform: translateY(-1px); }
  .foot-socials svg { width: 20px; height: 20px; fill: currentColor; }
  .foot-socials img { width: 20px; height: 20px;
    filter: invert(1) brightness(0.96); }
  .foot-stack {
    display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center;
  }
  .foot-stack img {
    width: 18px; height: 18px;
    opacity: 0.92;
    filter: invert(1) brightness(0.96);
    transition: transform 120ms ease, opacity 120ms ease;
  }
  .foot-stack img:hover { opacity: 1; transform: translateY(-1px) scale(1.1); }
  .foot-meta { color: var(--dim); margin-top: 1.2rem; font-size: 0.7rem; }
  .foot-meta em { color: var(--muted); font-style: italic; letter-spacing: 0.02em; }

  /* responsive */
  @media (max-width: 980px) {
    /* minmax(0,1fr), NOT 1fr: bare `1fr` means minmax(AUTO,1fr), so a wide child
       (long title, code, the graph panel) forces the track past the viewport and
       main's overflow-x:hidden then CLIPS the text instead of wrapping it. */
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
      position: relative; height: auto;
      flex-direction: row; align-items: center; flex-wrap: wrap;
      padding: 0.9rem 1rem;
      border-right: 0;
      border-bottom: 1px solid var(--line);
      gap: 0.7rem;
    }
    .brand-wordmark { font-size: 1.2rem; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 0.35rem; margin: 0; }
    .nav a { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
    .nav-section, .tag-cloud, .sidebar-foot, .search, .search-hint { display: none; }
    .status { font-size: 0.65rem; padding: 0.25rem 0.45rem; }

    .hero { grid-template-columns: 1fr; min-height: auto; gap: 1.5rem; }
    .hero h1 { font-size: clamp(2.8rem, 13vw, 4.6rem); }
    .projects { grid-template-columns: 1fr; }
    .project { border-right: 0; }
  }

  /* ─── MOBILE-ONLY refinements (≤768px) — desktop untouched ─── */
  @media (max-width: 768px) {
    html, body { overflow-x: hidden; }
    body { max-width: 100%; }

    .sidebar {
      padding: 0.6rem 0.8rem; gap: 0.45rem;
      flex-direction: row; flex-wrap: wrap; align-items: center;
    }
    .brand-row { flex: 0 0 auto; flex-direction: row; gap: 0.4rem; align-items: baseline; }
    .brand-wordmark .wm-big { font-size: 1.05rem; }
    .brand-wordmark .wm-small { font-size: 0.9rem; }
    .brand-tick { font-size: 1.05rem; }
    .brand-label { display: none; }
    .status {
      flex: 1 1 auto; font-size: 0.62rem; padding: 0.28rem 0.5rem;
      gap: 0.35rem; min-width: 0; justify-content: center;
    }

    .nav {
      flex: 0 0 100%; order: 99;
      flex-direction: row; flex-wrap: nowrap;
      gap: 0.3rem; margin: 0; min-width: 0;
    }
    .nav a {
      flex: 1 1 0;
      padding: 0.4rem 0.4rem;
      font-size: 0.72rem;
      box-shadow: none; white-space: nowrap;
      text-align: center; justify-content: center; min-width: 0;
    }
    .nav a:hover { transform: none; box-shadow: none; }
    .nav a .count { display: none; }
    .nav-back { display: none; }

    .search {
      display: block; width: 40px; height: 40px; margin: 0;
      flex-shrink: 0; position: relative;
    }
    .search input {
      width: 40px; height: 40px; padding: 0; font-size: 0; cursor: pointer;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f5f5f5' stroke-width='1.6'><circle cx='7' cy='7' r='4.5'/><line x1='10.2' y1='10.2' x2='14' y2='14'/></svg>");
      background-repeat: no-repeat; background-position: center; background-size: 18px 18px;
    }
    .search kbd, .search-hint { display: none; }

    .search-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.85); backdrop-filter: blur(6px);
      display: none; z-index: 200;
      padding: 4rem 1.2rem 0; align-items: flex-start; justify-content: center;
    }
    .search-overlay.is-open { display: flex; }
    .search-overlay-inner {
      width: 100%; max-width: 540px;
      background: var(--paper); border: 1px solid var(--line-strong); padding: 1.2rem;
    }
    .search-overlay input {
      width: 100%; padding: 0.7rem 0.8rem;
      background: #0a0a0a; border: 1px solid var(--line);
      color: var(--ink); font-family: var(--headerFont); font-size: 1rem; outline: none;
    }
    .search-overlay input:focus { border-color: var(--ink); }
    .search-overlay-hint {
      margin-top: 0.7rem; font-family: var(--headerFont);
      font-size: 0.7rem; color: var(--dim); line-height: 1.6;
    }
    .search-overlay-hint code {
      color: var(--muted); background: var(--panel);
      border: 1px solid var(--line); padding: 0.05rem 0.3rem; margin-right: 0.2rem;
    }
    .search-overlay.is-open .search-overlay-close,
    .search-overlay-close {
      display: flex; align-items: center; justify-content: center;
      position: absolute; top: 1rem; right: 1rem;
      background: transparent; border: 1px solid var(--line);
      color: var(--ink); width: 36px; height: 36px; font-size: 1.2rem; cursor: pointer;
    }
    .search-overlay:not(.is-open) .search-overlay-close { display: none; }

    .nav-section, .tag-cloud, .sidebar-foot { display: none; }

    /* Hero — grid-areas: eyebrow row → 2-col (h1+graph) → tag-line row */
    main { padding: 1.2rem 0.9rem 2rem; max-width: 100%; overflow-x: hidden; }
    .hero {
      display: grid;
      grid-template-columns: 1.1fr 0.9fr;
      grid-template-areas:
        "eyebrow eyebrow"
        "title   graph"
        "tag     tag";
      min-height: auto;
      padding-top: 0.4rem;
      gap: 0.4rem 0.7rem;
      align-items: center;
    }
    .hero > div:first-child { display: contents; }
    .hero-eyebrow {
      grid-area: eyebrow;
      font-size: 0.58rem; letter-spacing: 0.04em; white-space: normal;
      margin: 0.2rem 0 0.6rem;
      display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2rem;
    }
    .hero-eyebrow .sep { margin: 0; color: var(--dim); }
    .hero h1 {
      grid-area: title;
      font-size: clamp(1.8rem, 11vw, 2.8rem);
      max-width: 100%;
      line-height: 0.95;
      align-self: stretch;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .hero h1::after { width: 48px; height: 4px; margin-top: 0.5rem;
      background-image: linear-gradient(90deg, var(--ink) 4px, transparent 4px 8px, var(--ink) 8px 12px,
                       transparent 12px 16px, var(--ink) 16px 20px, transparent 20px 24px,
                       var(--ink) 24px 28px, transparent 28px 32px, var(--ink) 32px 36px,
                       transparent 36px 40px, var(--ink) 40px 48px); }
    .hero .tag-line {
      grid-area: tag;
      font-size: 0.9rem;
      margin: 0.7rem 0 0;
      max-width: 100%;
      line-height: 1.5;
    }
    .console {
      grid-area: graph;
      width: 100%; min-height: 8.5rem;
      padding: 0.35rem; box-shadow: 2px 2px 0 #111;
      display: flex; flex-direction: column; justify-content: center;
      opacity: 1 !important; visibility: visible !important;
    }
    .console-bar { margin-bottom: 0.3rem; gap: 0.2rem; }
    .console-bar span { width: 5px; height: 5px; }
    .mini-graph { max-width: 70%; width: 70%; margin: 0 auto 0.2rem;
      opacity: 1 !important; visibility: visible !important; display: block !important; }
    .console p { font-size: 0.5rem; margin: 0.1rem 0; line-height: 1.2; }
    .console hr, .console .meta { display: none; }

    /* Cards — full width, detail always shown, bigger tap target */
    .projects { grid-template-columns: 1fr; }
    .project { border-right: 0; min-height: auto; padding: 1.2rem 1rem; }
    .project .detail { max-height: 200px; opacity: 1; margin-top: 0.5rem; }
    .project-bullets li { font-size: 0.78rem; }
    .status-pill { top: 1rem; right: 1rem; }

    /* Drawer — full viewport, no left border/shadow */
    .drawer {
      width: 100% !important;
      max-width: 100%;
      border-left: 0;
      box-shadow: none;
    }
    .drawer-head { position: sticky; top: 0; z-index: 5; background: #050505; padding: 0.7rem 0.9rem; }
    .drawer-close { width: 36px; height: 36px; font-size: 1.3rem; }
    .drawer-body { padding: 1.2rem 1rem 3rem; }

    /* Footer — SM + reduced stack on single row */
    footer.foot { padding: 1.4rem 0 1.8rem; }
    .foot-row {
      flex-direction: row; gap: 0.8rem;
      align-items: center; justify-content: space-between;
      flex-wrap: wrap;
    }
    .foot-socials { justify-content: flex-start; gap: 0.7rem; padding: 0; }
    .foot-socials a { width: 22px; height: 22px; opacity: 0.85; }
    .foot-socials svg, .foot-socials img { width: 16px; height: 16px; }
    .foot-stack {
      flex-wrap: nowrap; gap: 0.55rem; padding: 0;
      overflow-x: visible; justify-content: flex-end;
    }
    .foot-stack img { width: 16px; height: 16px; flex-shrink: 0; }
    .foot-stack img:not(.key-mobile) { display: none; }
    .foot-meta { text-align: center; font-size: 0.62rem; margin-top: 0.8rem; }

    .list-status { font-size: 0.74rem; }
    .list-status .lab-line { font-size: 0.66rem; }
  }

  /* ─── Contact gate (math captcha + reason picker) ─── */
  .gate-overlay { display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.82); backdrop-filter: blur(6px);
    z-index: 300; align-items: flex-start; justify-content: center;
    padding: clamp(3rem, 8vh, 6rem) 1rem 1rem;
  }
  .gate-overlay.is-open { display: flex; }
  .gate-card { position: relative; width: 100%; max-width: 480px;
    background: var(--paper); border: 1px solid var(--line-strong);
    padding: 1.6rem 1.3rem; font-family: var(--headerFont); color: var(--ink);
    display: flex; flex-direction: column; gap: 0.9rem;
  }
  .gate-close { position: absolute; top: 0.6rem; right: 0.6rem;
    background: transparent; border: 1px solid var(--line); color: var(--ink);
    width: 32px; height: 32px; font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .gate-close:hover { border-color: var(--ink); }
  .gate-kicker { margin: 0; font-size: 0.65rem; letter-spacing: 0.1em;
    text-transform: lowercase; color: var(--dim); }
  .gate-msg { margin: 0; font-family: var(--bodyFont); font-size: 0.92rem;
    line-height: 1.55; color: var(--muted); }
  .gate-msg em { color: var(--ink); font-style: italic; }
  .gate-step { display: flex; flex-direction: column; gap: 0.6rem; }
  .gate-step[hidden] { display: none; }
  .gate-label { margin: 0; font-size: 0.78rem; color: var(--ink); }
  .gate-step input[type=text] { width: 100%; padding: 0.6rem 0.8rem;
    background: #0a0a0a; border: 1px solid var(--line); color: var(--ink);
    font-family: var(--headerFont); font-size: 1rem; outline: none;
  }
  .gate-step input[type=text]:focus { border-color: var(--ink); }
  .gate-step input.shake { animation: gate-shake 220ms ease; border-color: #ff7a7a; }
  @keyframes gate-shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
  }
  .gate-btn { padding: 0.55rem 0.9rem; background: var(--ink); color: var(--paper);
    border: 1px solid var(--ink); font-family: var(--headerFont); font-size: 0.85rem;
    cursor: pointer; align-self: flex-start;
  }
  .gate-btn:hover { background: transparent; color: var(--ink); }
  .gate-btn-ghost { background: transparent; color: var(--ink);
    border: 1px solid var(--line-strong); }
  .gate-btn-ghost:hover { border-color: var(--ink); background: #111; }
  .gate-err { margin: 0; font-size: 0.74rem; color: #ff7a7a; }
  .gate-cards { display: flex; flex-direction: column; gap: 0.4rem; }
  .gate-pick { padding: 0.65rem 0.8rem; background: transparent; color: var(--ink);
    border: 1px solid var(--line-strong); font-family: var(--headerFont);
    font-size: 0.82rem; text-align: left; cursor: pointer;
    transition: background 100ms ease, border-color 100ms ease;
  }
  .gate-pick:hover { background: #131313; border-color: var(--ink); }
  .gate-reveal { display: flex; flex-direction: column; gap: 0.5rem; }
  .gate-foot { margin: 0; font-size: 0.62rem; color: var(--dim); line-height: 1.5; }
  .gate-form { display: flex; flex-direction: column; gap: 0.6rem;
    max-height: 55vh; overflow-y: auto; padding-right: 0.4rem;
  }
  .gate-field { display: flex; flex-direction: column; gap: 0.25rem; }
  .gate-field label { font-size: 0.74rem; color: var(--muted); }
  .gate-field label .req { color: #ff7a7a; margin-left: 0.2rem; }
  .gate-field input[type=text],
  .gate-field input[type=email],
  .gate-field input[type=url],
  .gate-field textarea {
    width: 100%; padding: 0.5rem 0.65rem;
    background: #0a0a0a; border: 1px solid var(--line); color: var(--ink);
    font-family: var(--headerFont); font-size: 0.84rem; outline: none;
    resize: vertical;
  }
  .gate-field textarea { min-height: 60px; max-height: 160px; }
  .gate-field input:focus, .gate-field textarea:focus { border-color: var(--ink); }
  .gate-field.is-invalid input,
  .gate-field.is-invalid textarea { border-color: #ff7a7a; }
  .gate-radio { display: flex; flex-wrap: wrap; gap: 0.3rem; }
  .gate-radio label {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.55rem; border: 1px solid var(--line);
    font-size: 0.72rem; color: var(--ink); cursor: pointer;
    transition: background 100ms ease, border-color 100ms ease;
  }
  .gate-radio label input { accent-color: var(--ink); }
  .gate-radio label:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .gate-form-foot { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
  .gate-form-err { margin: 0; font-size: 0.74rem; color: #ff7a7a; }
  .gate-spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid var(--line); border-top-color: var(--ink);
    border-radius: 50%; animation: gate-spin 700ms linear infinite;
  }
  @keyframes gate-spin { to { transform: rotate(360deg); } }
  @media (max-width: 768px) {
    .gate-card { padding: 1.2rem 1rem; gap: 0.8rem; }
    .gate-msg { font-size: 0.86rem; }
    .gate-form { max-height: 50vh; }
  }

/* ─── story pages (/projects/*.html) ─────────────────────────────────────────
   Static narrative pages: no hero graph, no drawers, no search overlay. They
   reuse the sidebar, the footer and the contact gate above; everything below is
   just the article column. */
.story { max-width: 760px; padding: 3rem 2.2rem 1rem; }
.story .back { display: inline-block; margin-bottom: 1.6rem; font-family: var(--headerFont);
  font-size: 0.72rem; color: var(--dim); text-decoration: none; letter-spacing: 0.06em; }
.story .back:hover { color: var(--ink); }
.story h1 { margin: 0 0 0.4rem; font-family: var(--headerFont); font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.05; letter-spacing: -0.02em; }
.story .story-techs { margin: 0 0 1.8rem; font-family: var(--headerFont); font-size: 0.72rem;
  color: var(--dim); letter-spacing: 0.06em; }
.story section { margin-bottom: 2.4rem; }
.story section > .eyebrow { margin-bottom: 0.7rem; }
.story p { margin: 0 0 0.9rem; font-size: 0.95rem; line-height: 1.65; color: var(--muted); }
.story p strong { color: var(--ink); font-weight: 600; }
.story p em { color: var(--ink); }
.story code { font-family: var(--headerFont); font-size: 0.85em; color: var(--ink);
  background: var(--panel-soft); padding: 0.1em 0.35em; border-radius: 3px; }
.story .story-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.story .story-links a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.8rem; border: 1px solid var(--line);
  font-family: var(--headerFont); font-size: 0.72rem; color: var(--muted);
  text-decoration: none; letter-spacing: 0.04em;
}
.story .story-links a:hover { color: var(--ink); border-color: var(--ink); background: #111; }
.story .story-links a svg { width: 14px; height: 14px; fill: currentColor; }
.story .story-next { border-left: 2px solid var(--line-strong); padding-left: 0.9rem; }

/* prose links inside story copy — quieter than .story-links buttons */
.story p a, .story li a {
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 120ms ease, opacity 120ms ease;
}
.story p a:hover, .story li a:hover { border-bottom-color: var(--ink); opacity: 0.8; }

/* sanitized rendering of the digest email (docs/email_template_digest.html in the
   inverse-jobs repo). The body keeps the template's own inline styles so the mock
   drifts only when the real template does — ponytail: no second stylesheet to sync. */
.email-mock { margin: 0 0 0.6rem; border: 1px solid var(--line); background: #f6f7fb; overflow-x: auto; }
.email-mock .em-head {
  font-family: var(--headerFont); font-size: 0.72rem; line-height: 1.9;
  color: #4b5563; background: #e9ebf2; border-bottom: 1px solid #d3d7e2; padding: 0.6rem 0.9rem;
}
.email-mock .em-head b { color: #1a1a2e; font-weight: 700; }
.email-mock .em-body { min-width: 420px; }
.story .email-cap { font-size: 0.78rem; color: var(--muted); font-style: italic; margin-bottom: 2rem; }

@media (max-width: 768px) {
  .story { padding: 2rem 1.1rem 1rem; }
  .story p { font-size: 0.9rem; }
}
