
@layer page {
  /* T7: spacing, type, transition and layout tokens live in tokens.css. */

    /* Default: light mode */
    


    /* Manual override: light mode */
    

    /* Manual override: dark mode */
    

    /* ==========================================
       RESET & BASE
       ========================================== */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html {
      scroll-behavior: smooth;
      scroll-padding-top: calc(var(--nav-height) + 1rem);
      -webkit-text-size-adjust: 100%;
    }

    body {
      font-family: var(--font-body);
      font-size: var(--text-body);
      line-height: 1.6;
      color: var(--text);
      background: var(--bg);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: hidden;
    }

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

    /* Focus rings */
    :focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
      border-radius: 2px;
    }

    /* Skip to content */
    .skip-link {
      position: absolute;
      top: -100%;
      left: var(--space-4);
      background: var(--accent);
      color: var(--bg);
      padding: var(--space-2) var(--space-4);
      border-radius: 4px;
      font-weight: 500;
      z-index: 1000;
      font-size: 14px;
    }
    .skip-link:focus {
      top: var(--space-2);
      color: var(--bg);
    }

    .hidden { display: none !important; }

    /* ==========================================
       CONTAINER & SECTIONS
       ========================================== */
    .container {
      max-width: var(--max-width);
      margin: 0 auto;
      padding: 0 var(--space-6);
    }

    /* Rebased to match the homepage. The original clamp paid up to 128px top
       AND bottom, so two adjacent sections put 256px between a closing line and
       the next label — a gap that reads as a missing section. */
    section {
      padding-block: clamp(var(--space-10), 4.5vw, var(--space-16));
    }

    /* ==========================================
       TYPOGRAPHY
       ========================================== */
    h1, h2, h3 {
      font-family: var(--font-display);
      line-height: 1.15;
      letter-spacing: -0.02em;
    }

    h1 {
      font-size: clamp(2.5rem, 5vw, 4rem);
      font-weight: 500;
    }

    h2 {
      font-size: clamp(1.75rem, 3.5vw, 2.5rem);
      font-weight: 500;
      margin-bottom: var(--space-6);
    }

    h3 {
      font-size: clamp(1.25rem, 2vw, 1.5rem);
      font-weight: 500;
      margin-bottom: var(--space-3);
    }

    .prose {
      max-width: var(--measure);
      font-size: var(--text-body);
      line-height: 1.7;
      color: var(--text);   /* T8 */
    }

    .prose p + p { margin-top: var(--space-4); }

    /* ==========================================
       NAVIGATION
       ========================================== */
    .nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: transparent;
      transition: background var(--transition-normal), box-shadow var(--transition-normal);
      height: var(--nav-height);
    }

    .nav.scrolled {
      background: color-mix(in srgb, var(--bg) 85%, transparent);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      box-shadow: 0 1px 0 var(--border);
    }

    .nav-inner {
      max-width: var(--max-width);
      margin: 0 auto;
      padding: 0 var(--space-6);
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .nav-brand {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      color: var(--text);
      font-family: var(--font-display);
      font-size: 18px;
      font-weight: 500;
      letter-spacing: -0.01em;
    }
    .nav-brand:hover { color: var(--text); }

    .nav-brand svg {
      width: 28px;
      height: 28px;
      flex-shrink: 0;
    }

    .nav-links {
      display: flex;
      align-items: center;
      gap: var(--space-6);
      list-style: none;
    }

    .nav-links a {
      font-size: 14px;
      color: var(--text-muted);
      transition: color var(--transition-fast);
      font-weight: 400;
      padding: 10px 8px;
      min-height: 44px;
      display: inline-flex;
      align-items: center;
    }
    .nav-links a:hover { color: var(--text); }

    .nav-toggle-theme {
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 6px;
      cursor: pointer;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: color var(--transition-fast), border-color var(--transition-fast);
      width: 36px;
      height: 36px;
    }
    .nav-toggle-theme:hover {
      color: var(--text);
      border-color: var(--text-muted);
    }
    .nav-toggle-theme svg { width: 18px; height: 18px; }

    /* Sun / Moon — dark is the default, so the sun (switch to light) shows.
       Only an explicit light choice swaps it. */
    .icon-sun { display: block; }
    .icon-moon { display: none; }
    [data-theme="light"] .icon-sun { display: none; }
    [data-theme="light"] .icon-moon { display: block; }

    .nav-github {
      font-size: 14px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .nav-github:hover { color: var(--text); }
    .nav-github svg { width: 16px; height: 16px; }

    /* Hamburger */
    .hamburger {
      display: none;
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text);
      padding: var(--space-2);
    }
    .hamburger svg { width: 24px; height: 24px; }

    /* Mobile overlay */
    .mobile-menu {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--bg);
      z-index: 200;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: var(--space-8);
    }
    .mobile-menu.open { display: flex; }
    .mobile-menu a {
      font-family: var(--font-display);
      font-size: 1.5rem;
      color: var(--text);
    }
    .mobile-menu-close {
      position: absolute;
      top: var(--space-4);
      right: var(--space-6);
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text);
      padding: var(--space-2);
    }
    .mobile-menu-close svg { width: 28px; height: 28px; }

    /* N6: was 768px — seven links, a toggle and a GitHub label do not fit a
       1000px viewport, so the brand wrapped onto two lines. */
    /* superseded by the 900px rule in the nav block below */

    /* ==========================================
       FOOTER
       ========================================== */
    .footer {
      border-top: 1px solid var(--border);
      padding: var(--space-12) 0 var(--space-8);
    }

    .footer-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: var(--space-8);
      margin-bottom: var(--space-10);
    }

    .footer-col h2 {
      font-family: var(--font-mono);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--text-muted);
      margin-bottom: var(--space-4);
      font-weight: 500;
    }

    .footer-col ul {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: var(--space-2);
    }

    .footer-col a {
      font-size: 14px;
      color: var(--text-muted);
    }
    .footer-col a:hover { color: var(--text); }

    .footer-bottom {
      border-top: 1px solid var(--border);
      padding-top: var(--space-6);
      display: flex;
      flex-direction: column;
      gap: var(--space-2);
    }

    .footer-bottom p {
      font-size: 13px;
      color: var(--text-muted);
    }

    .footer-bottom .footer-tagline {
      font-family: var(--font-mono);
      font-size: var(--text-meta);
      color: var(--text-muted);
    }

    @media (max-width: 768px) {
      .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
      }
    }

    .btn-primary {
      padding: 12px 24px;
      background: var(--accent);
      color: #141311;
      border: none;
      border-radius: 8px;
      font-family: var(--font-body);
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      transition: background var(--transition-fast), transform var(--transition-fast);
      white-space: nowrap;
    }
    .btn-primary:hover {
      background: var(--accent-hover);
      transform: translateY(-1px);
    }

    /* ==========================================
       PREVIEW PAGE — intro
       ========================================== */
    .preview-intro { padding-bottom: var(--space-8); }
    .preview-lead {
      font-size: clamp(16px, 1.4vw, 19px);
      color: var(--text-muted);
      line-height: 1.7;
      max-width: var(--measure);
      margin-top: var(--space-4);
    }

    .preview-block { padding-top: var(--space-8); }
    .preview-caption {
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--text-muted);
      margin: var(--space-3) 0 var(--space-6);
      letter-spacing: 0.01em;
      max-width: var(--measure);
      line-height: 1.6;
    }
    .preview-h2 { margin-bottom: var(--space-2); }

    .report-grid {
      display: grid;
      /* min(420px, 100%) rather than a flat 420px floor: on a 390px phone a
         hard floor makes the track wider than the viewport and forces a
         horizontal scroll of the whole page. */
      grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
      gap: var(--space-6);
      align-items: start;
    }
    @media (max-width: 900px) {
      .report-grid { grid-template-columns: 1fr; }
    }

    /* ==========================================
       DEVICE / TUI — always-dark terminal chrome
       (F-10 warm palette, scoped so it never fights the site theme)
       ========================================== */
    .tui {
      --amber:#d4940a; --amber-bright:#e8a317; --gold:#b8860b; --warn:#d9663a;
      --green:#5a9a5a; --cream:#e8e2d8; --gray:#9e958a; --dim:rgba(158,149,138,0.5);
      --tbg:#0a0908; --panel:#141311; --bar:#1c1a17; --tborder:#3a3630; --chip:#2a2724;
    }

    .device {
      background: var(--tbg);
      padding: 15px;
      border-radius: 14px;
      position: relative;
      box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 60px rgba(184,134,11,.13), 0 20px 40px rgba(0,0,0,.16);
    }
    .device + .device { margin-top: 14px; }
    .notch {
      position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
      width: 42px; height: 3px; background: #1a1715; border-radius: 2px;
    }
    .screen {
      background: var(--panel); border-radius: 7px; overflow: hidden;
      border: 1px solid var(--tborder);
    }
    .statusbar, .footerbar {
      display: flex; align-items: center; justify-content: space-between;
      background: var(--bar); padding: 8px 13px;
      font-family: var(--font-mono); font-size: var(--text-meta); color: var(--gray);
      letter-spacing: .02em; gap: 10px; flex-wrap: wrap;
    }
    .statusbar { border-bottom: 1px solid var(--tborder); }
    .footerbar { border-top: 1px solid var(--tborder); }
    .tui .body {
      font-family: var(--font-mono);
      color: var(--gray);
      padding: 20px 26px;
      /* Rows are ~62 columns of plain text with no border to reach, so the
         type is sized for reading rather than to fit a frame. */
      font-size: clamp(13px, calc((100vw - 128px) / 46), 16px);
      line-height: 1.68;
      /* Never pre-wrap here: these shells are box-drawing frames, and a
         wrapped border character breaks the box. Long keys are elided in the
         source instead. */
      white-space: pre;
      overflow-x: auto;
      /* Screens run 12–26 lines, so the shell jumped ~220px on every
         selection and scrolled the page under the reader. A floor stops the
         jump; longer screens still grow past it. */
      min-height: 440px;
    }
    .chip {
      color: var(--cream); background: var(--chip);
      padding: 1px 6px; border-radius: 3px; margin: 0 2px; font-size: 10px;
    }

    .tui .a  { color: var(--amber); }
    .tui .ab { color: var(--amber-bright); font-weight: 600; }
    .tui .c  { color: var(--cream); }
    .tui .cb { color: var(--cream); font-weight: 600; }
    .tui .g  { color: var(--green); font-weight: 600; }
    .tui .m  { color: var(--gray); }
    .tui .d  { color: var(--dim); }
    .tui .warn { color: var(--warn); font-weight: 600; }
    .logo { width: 13px; height: 13px; color: var(--amber); vertical-align: -2px; margin-right: 6px; }

    /* Interactive menu rows */
    .body[data-interactive] .row {
      display: block;
      border-radius: 3px;
      transition: background var(--transition-fast);
    }
    /* The blank rows between GUIDED WORKFLOWS / TOOLS / SYSTEM are empty
       blocks now that the frame is gone, so they collapse to zero. One line
       each keeps the three groups apart. */
    .body[data-interactive] .row:empty { height: 1.68em; }
    .body[data-interactive] .row[data-wf] { cursor: pointer; }
    .body[data-interactive] .row[data-wf]:hover,
    .body[data-interactive] .row[data-wf]:focus-visible {
      background: rgba(212,148,10,0.13);
      outline: none;
    }
    .body[data-interactive] .row.static { cursor: default; }

    /* Back control */
    .tui-back {
      background: none;
      border: 1px solid var(--tborder);
      color: var(--amber);
      font-family: var(--font-mono);
      font-size: 11px;
      padding: 5px 11px;
      border-radius: 6px;
      cursor: pointer;
      transition: border-color var(--transition-fast), color var(--transition-fast);
    }
    .tui-back:hover { border-color: var(--amber); color: var(--amber-bright); }

    /* Full container width. The frame was widened to match (boxMenu innerW
       62 → 96) and the type raised to 18px, so the box fills the page rather
       than floating in a 620px column with 500px of empty page beside it. */
    /* A flex column with a gap, not a block with per-child margins. The tabs
       carried margin-top as their separation from the terminal while they sat
       AFTER it; moving them above put that margin on the wrong side and left
       them flush against the screen. The parent owns the spacing now, so
       reordering the children cannot reintroduce it. */
    .preview-stage {
      max-width: none;
      display: flex;
      flex-direction: column;
      gap: var(--space-4);
    }
    /* Belt and braces only. This is (0,1,0) and every child rule is too, so a
       margin declared LATER in this sheet beats it on source order — which is
       exactly what .tui-claim (16px) and .tui-hint (12px) did, adding themselves
       to the gap and giving the stack 16 / 32 / 28. Both declarations are gone;
       the gap is the only thing spacing this column. */
    .preview-stage > * { margin-block: 0; }

    /* The station's frame, in CSS. Matches 1_menu.png: amber hairline, ~10px
       radius, title as a legend over the top border. Because it is a border
       and not characters it fills the panel at any width, and the rows inside
       keep their own character alignment independently of it. */
    .tui-frame {
      position: relative;
      border: 1px solid var(--amber);
      border-radius: 10px;
      padding: var(--space-6) var(--space-4);
      margin-top: var(--space-3);
    }
    .tui-legend {
      position: absolute;
      top: 0;
      left: var(--space-6);
      transform: translateY(-50%);
      background: var(--panel);
      padding: 0 var(--space-2);
      font-family: var(--font-mono);
      font-weight: 500;
      color: var(--cream);
    }

    /* Replaces the second terminal shell: the plain-text export is described
       in words and handed off to /confidence-report, which shows the typeset
       document and all four verification types. */
    .report-handoff {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: var(--space-6);
    }
    .report-handoff p {
      font-size: var(--text-small);
      line-height: 1.7;
      color: var(--text-muted);
      max-width: var(--measure);
      margin: 0 0 var(--space-4);
      text-wrap: pretty;
    }
    .report-handoff p:last-child { margin-bottom: 0; }

    .tui-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-2);
    }
    .tui-tab {
      font-family: var(--font-mono);
      font-size: var(--text-meta);
      cursor: pointer;
      padding: 8px 14px;
      border-radius: var(--radius-md);
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-muted);
      transition: color var(--transition-fast), border-color var(--transition-fast);
    }
    .tui-tab:hover { color: var(--text); border-color: var(--accent); }
    .tui-tab[aria-selected="true"] {
      background: color-mix(in srgb, var(--accent) 14%, var(--bg));
      border-color: var(--accent);
      color: var(--accent-link);
      font-weight: 500;
    }

    /* What the screen above proves, not what it is. */
    .tui-claim {
      font-size: var(--text-small);
      line-height: 1.65;
      color: var(--text);
      max-width: var(--measure);
      text-wrap: pretty;
    }

    .tui-hint {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-muted);
      line-height: 1.6;
      max-width: var(--measure);
    }

    /* Preview CTA close */
    .preview-cta {
      border-top: 1px solid var(--border);
      text-align: center;
    }
    .preview-cta .section-label { margin-bottom: var(--space-2); }
    .preview-cta h2 { margin-bottom: var(--space-6); }
    .preview-cta-links {
      display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap;
      align-items: center;
    }
    .preview-cta-secondary { font-size: 15px; }

}

/* ==========================================================================
   T5 — mono legibility floor
   Uppercase mono strips the ascender/descender cues that make a word
   recognisable at a glance, and mono strips the width variation too. Anything
   a reader must actually read is now 12–13px, with tracking raised to match.
   ========================================================================== */
@layer page {
  .power-tools-label, .tech-card-label, .code-block-header,
  .fit-legend, .arch-node-label, .workflow-number,
  .blog-card-cat, .blog-card-meta, .post-meta, .post-cat, .chip-n,
  .terminal-title, .footer-col h2 { font-size: var(--text-meta); }
  thead th, th[scope="col"],
  .arch-node-desc, .shot-placeholder, .shipping-badge,
  .form-consent, .form-consent a, .fine-print, .fine-print a,
  .report-card figcaption, figcaption, .faq-answer h3, .disclosure h3,
  .footer-bottom p, .footer-tagline { font-size: var(--text-meta); }
  .post-cat { letter-spacing: 0.06em; }
  .footer-col h2 { letter-spacing: 0.08em; }
}

/* ==========================================================================
   Nav: Product dropdown + waitlist CTA (P3)
   Five text items instead of nine, and the site's one conversion now lives in
   the chrome of every page rather than only on the homepage.
   ========================================================================== */
@layer chrome {
  .nav-dropdown { position: relative; }
  .nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px;
    /* A <button> among <a>s: the UA "font:" shorthand resets line-height and drops the
       inherited text-rendering, so "Product" drew without kerning/ligatures. (2026-09-08) */
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    color: var(--text-muted);
    padding: 10px 8px;
    min-height: 44px;
    transition: color var(--transition-fast);
  }
  .nav-dropdown-trigger:hover,
  .nav-dropdown-trigger[aria-expanded="true"] { color: var(--text); }
  .nav-caret { width: 12px; height: 12px; transition: transform var(--transition-fast); }
  .nav-dropdown-trigger[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

  .nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 230px;
    list-style: none;
    margin: 0;
    padding: var(--space-2) 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    z-index: 120;
  }
  .nav-dropdown-menu[hidden] { display: none; }
  .nav-dropdown-menu a {
    display: block;
    padding: 9px 16px;
    font-size: 14px;
    color: var(--text);
    min-height: 0;
  }
  .nav-dropdown-menu a:hover { color: var(--accent-link); background: var(--surface-offset); }

  /* The theme toggle is the one nav control with no font declared, so it inherited the
     browser default (Arial 13.33px) instead of Satoshi. Icon-only today, wrong the moment
     it carries a label. (2026-09-08) */
  .nav-toggle-theme { font-family: var(--font-body); font-size: 14px; line-height: 1.6; text-rendering: optimizeLegibility; }

  .nav-cta {
    background: var(--accent);
    color: #141311;
    border-radius: var(--radius-md);
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    min-height: 0;
    transition: background var(--transition-fast), transform var(--transition-fast);
  }
  .nav-cta:hover { background: var(--accent-hover); color: #141311; transform: translateY(-1px); }
  .nav-github svg { width: 18px; height: 18px; }

  /* N6: five items + toggle + mark + button fit to about 900px. */
  @media (max-width: 1024px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
  }
  /* the pinned bar costs 64px of a 667px phone viewport; 52px is the same
     benefit at a lower rent. Not hide-on-scroll — that would hide the CTA
     exactly while someone is reading. */
  @media (max-width: 768px) {
    :root { --nav-height: 52px; }
  }
  /* The CTA lives inside .nav-links, and `.nav-links a` (0,1,1) outranks `.nav-cta` (0,1,0), so the
     amber button rendered with muted-grey link text. Raise the button above its own container's
     link rule. (user report, 2026-09-08) */
  .nav-links a.nav-cta,
  .nav-links a.nav-cta:hover {
    color: #141311;
    padding: var(--space-3) 16px;
    font-weight: 500;
    min-height: 0;
  }
  .mobile-menu .nav-cta { font-family: var(--font-body); font-size: 1.1rem; padding: 12px 24px; color: #141311; }
  .mobile-menu .nav-cta:hover { color: #141311; }
}

/* ==========================================================================
   T5 (completed) — the 13px legibility floor, applied everywhere
   The first T5 pass named 16 selectors. Sixty more were still setting mono
   labels at 10–12px, which is the type this site asks a reader to trust:
   consent lines, table headers, captions, chips, meta rows. Uppercase mono
   strips the ascender and descender cues that make a word recognisable, so it
   needs more size than lowercase body text, not less.

   Deliberately exempt, and why:
     .claim-ref            a superscript marker inside 17px prose
     .tui *, .statusbar    terminal emulation — resizing breaks ASCII alignment
     .post-toc li::before  a numeral, not a word
   ========================================================================== */
@layer page {
  .footer-col h2,
  .footer-tagline,
  .post-tier-badge,
  .blog-chip,
  .blog-more,
  .post-list-meta,
  .blog-post .post-table th,
  .tier-badge,
  .arch-node-desc,
  .arch-node-label,
  .hardware-table th,
  .fit-table th,
  .spec-table th,
  .shipping-badge,
  .check-howto .check-label,
  .check-howto .check-fail-desc code,
  .form-consent,
  .isnt-col h3,
  .report-card figcaption,
  .shot-placeholder,
  .section-rail a > span,
  .preview-caption,
  .chip,
  .tui-back,
  .tui-hint,
  .entry-meta,
  .glossary-search-label,
  .glossary-count,
  .ty-label,
  .ty-next h2, .ty-more h2,
  .ty-steps .n,
  .related-cat,
  .post-cat,
  .chip-n,
  .blog-card-meta,
  .blog-card-cat,
  .post-meta,
  .section-label,
  /* tracking has to come down as the size comes up, or 13px uppercase mono
     sets too loose and stops reading as one word */
  .section-label, .footer-col h2, .act-break .act-num { letter-spacing: 0.07em; }
  .blog-card-cat, .related-cat, .post-cat, .chip-n { letter-spacing: 0.05em; }
}

@layer page {
  /* A TUI shell has a fixed character width; two of them in a row means both
     render below their natural size. One per row, full width. */
  .report-grid { grid-template-columns: 1fr; }
}

/* T5 floor, in @layer utilities so container rules cannot beat it. tokens.css
   declares utilities after page; layer order beats specificity. Terminal type
   stays exempt by construction — nothing here targets .tui / .report-pre. */
@layer utilities {
  thead th, th[scope="col"], .arch-node-desc, .shot-placeholder, .shipping-badge,
  .form-consent, .form-consent a, .fine-print, .fine-print a,
  figcaption, .faq-answer h3, .disclosure h3, .report-card h3,
  .footer-bottom p, .footer-tagline { font-size: var(--text-meta); }
}
