/* MCP Detect: restrained technical-review design system.
   See design-system/MASTER.md for rationale. One accent, one grid, minimal motion.
   System fonts keep the public site independent of third-party font requests. */

@layer reset, base, theme, components, utilities;

@layer theme {
  :root {
    color-scheme: dark;

    /* Backgrounds */
    --bg-core: #0a0a0a;               /* page base (test-locked) */
    --bg-raise: #141416;              /* cards / raised sections */
    --bg-inset: #0e0e11;              /* code / telemetry */
    --bg-surface: rgba(17, 17, 17, 0.7); /* nav backdrop (test-locked) */

    /* Foreground */
    --fg-main: #f4f4f5;
    --fg-dim: #a1a1aa;
    --fg-mute: #8a8a93;

    /* Accent (single, restrained) */
    --accent: #ef4444;               /* markers, links, emphasis (test-locked) */
    --accent-strong: #dc2626;        /* primary button bg; white text passes AA */
    --accent-soft: rgba(239, 68, 68, 0.12);
    --accent-glow: rgba(239, 68, 68, 0.5); /* brand mark only (test-locked) */

    /* Status */
    --ok: #34d399;
    --warn: #fbbf24;

    /* Lines */
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    /* Type */
    --font-sans: 'Avenir Next', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Monaco, monospace;

    /* Spacing scale */
    --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
    --space-6: 1.5rem; --space-8: 2rem; --space-12: 3rem; --space-16: 4rem;
    --space-24: 6rem; --space-36: 9rem;

    /* Radius */
    --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;

    /* Elevation */
    --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 30px rgba(0,0,0,0.35);

    /* Motion */
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --transition-snappy: 0.15s cubic-bezier(0.2, 0, 0, 1);
  }
}

@layer reset {
  * { box-sizing: border-box; margin: 0; padding: 0; }

  *:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
  }
  ::selection { background: var(--accent); color: #fff; }

  ::-webkit-scrollbar { width: 10px; }
  ::-webkit-scrollbar-track { background: var(--bg-core); }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 6px; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); }

  img, svg { max-width: 100%; }

  /* Skip link: stays off-screen (inline style) until focused, then visible top-left. */
  .skip-to-content:focus {
    left: 1rem !important;
    top: 1rem !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    border-radius: var(--radius-sm);
    outline: 2px solid #fff;
    outline-offset: 2px;
  }
}

@layer base {
  html { scroll-behavior: smooth; }

  body {
    background: var(--bg-core);
    color: var(--fg-main);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    border-top: 2px solid var(--accent); /* single restrained chrome flourish */
  }

  h1 {
    font-size: clamp(2.25rem, 4.5vw + 1rem, 4rem);
    font-weight: 400; letter-spacing: -0.02em; line-height: 1.08;
    margin-bottom: 1.25rem; text-wrap: balance;
  }
  h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 500; letter-spacing: -0.015em; line-height: 1.2;
    margin-bottom: 0.75rem; text-wrap: balance;
  }
  h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.5rem; }
  h4 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.35rem; }

  p {
    color: var(--fg-dim);
    max-width: 68ch;
    margin-bottom: 1rem;
    text-wrap: pretty;
  }
  p:last-child { margin-bottom: 0; }

  strong { color: var(--fg-main); font-weight: 600; }

  a { color: var(--accent); text-decoration: none; }
  a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

  code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-inset);
    color: #fca5a5;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border);
  }

  ul, ol { color: var(--fg-dim); }
}

@layer components {

  /* ---------- Eyebrow label ---------- */
  .data-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-dim);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
  }
  .data-label::before {
    content: "";
    width: 1.5rem; height: 2px;
    background: var(--accent);
    flex-shrink: 0;
  }
  .data-label.accent { color: var(--accent); }
  .tabular { font-variant-numeric: tabular-nums; }

  /* ---------- Grid ---------- */
  .grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    /* minmax(0, 1fr), not 1fr, so tracks can shrink below content min-width
       and long words / wide SVGs wrap instead of overflowing the viewport. */
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 2rem;
  }

  .section-py { padding-top: var(--space-24); padding-bottom: var(--space-24); }
  .header-py { padding-top: var(--space-36); padding-bottom: var(--space-16); }

  .col-12 { grid-column: span 12; }
  .col-9 { grid-column: span 9; }
  .col-8 { grid-column: span 8; }
  .col-7 { grid-column: span 7; }
  .col-6 { grid-column: span 6; }
  .col-5 { grid-column: span 5; }
  .col-4 { grid-column: span 4; }
  .col-3 { grid-column: span 3; }

  /* ---------- Divider ---------- */
  .divider {
    width: 100%; height: 1px;
    background: var(--border);
    margin: 0;
  }

  /* ---------- Navigation ---------- */
  .nav-row {
    position: fixed; top: 0; left: 0; width: 100%;
    padding: 0.85rem 0;
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
  }
  .nav-flex {
    grid-column: span 12;
    display: flex; justify-content: space-between; align-items: center;
  }
  .nav-brand {
    display: flex; align-items: center; gap: 0.7rem;
    font-family: var(--font-mono);
    font-weight: 600; font-size: 1rem; letter-spacing: 0.04em;
    color: var(--fg-main);
    text-transform: uppercase;
  }
  .nav-brand:hover { text-decoration: none; }
  .nav-brand:hover .brand-text { color: var(--accent); }

  .brand-icon {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    flex-shrink: 0;
  }

  .nav-links { display: flex; gap: 2rem; align-items: center; }
  .nav-link {
    font-size: 0.95rem; font-weight: 500; color: var(--fg-dim);
    transition: color var(--transition-snappy);
  }
  .nav-link:hover, .nav-link:focus-visible { color: var(--fg-main); text-decoration: none; }
  .nav-link.active { color: var(--fg-main); }
  .nav-link.active::after {
    content: ""; display: block; height: 2px; margin-top: 3px;
    background: var(--accent);
  }

  .mobile-menu-btn { min-width: 44px; min-height: 44px; }

  @media (max-width: 768px) {
    .mobile-menu-btn { display: flex !important; align-items: center; justify-content: center; }
    .nav-links {
      display: none;
      position: absolute; top: 100%; left: 0; width: 100%;
      background: #0c0c0e;
      border-bottom: 1px solid var(--border);
      flex-direction: column; align-items: flex-start;
      gap: 0.25rem; padding: 1rem 2rem 1.5rem;
    }
    .nav-links.open { display: flex; }
    .nav-links .nav-link { padding: 0.6rem 0; width: 100%; }
    .nav-links .btn { margin-left: 0 !important; margin-top: 0.5rem; width: 100%; }
    .nav-link.active::after { display: none; }
  }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem; font-weight: 600;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    min-height: 48px;
    transition: transform var(--transition-snappy), background var(--transition-snappy),
                border-color var(--transition-snappy), box-shadow var(--transition-snappy);
  }
  .btn:hover { text-decoration: none; }
  .btn:active { transform: scale(0.98); }

  .btn-accent {
    background: var(--accent-strong);
    color: #fff;
  }
  .btn-accent:hover { background: #b91c1c; box-shadow: var(--shadow); transform: translateY(-1px); }
  .btn-accent .arrow { transition: transform var(--transition-snappy); }
  .btn-accent:hover .arrow { transform: translateX(4px); }

  .btn-outline {
    background: transparent;
    color: var(--fg-main);
    border: 1px solid var(--border-strong);
  }
  .btn-outline:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.28); }

  /* ---------- Cards ---------- */
  .card, .glass-card {
    background: var(--bg-raise);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
  }
  .card h3, .glass-card h3 { color: var(--fg-main); }
  a.card:hover, a.glass-card:hover { border-color: var(--border-strong); }

  /* Callout / finding: accent left rule */
  .callout {
    background: var(--bg-raise);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow);
  }

  /* ---------- Feature / capability grid ---------- */
  .feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
  }
  .feature-grid .card { padding: 1.5rem; }
  .feature-icon {
    color: var(--accent);
    display: inline-flex;
    margin-bottom: 0.9rem;
  }

  .enterprise-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 2rem;
  }
  .enterprise-grid .glass-card.span-2 { grid-column: span 2; }
  @media (max-width: 768px) {
    .enterprise-grid { grid-template-columns: 1fr; }
    .enterprise-grid .glass-card.span-2 { grid-column: span 1; }
  }

  /* ---------- Stats strip ---------- */
  .stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
  }
  .stat {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-raise);
    padding: 1.5rem;
  }
  .stat .stat-num {
    font-size: 2.4rem; font-weight: 400; line-height: 1;
    color: var(--fg-main); font-variant-numeric: tabular-nums;
    margin-bottom: 0.6rem;
  }
  .stat .stat-label { color: var(--fg-dim); font-size: 0.95rem; }

  /* ---------- Numbered steps ---------- */
  .steps { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 2rem; }
  .step { display: flex; gap: 1.25rem; align-items: flex-start; }
  .step-num {
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--accent); color: var(--accent);
    border-radius: 50%;
    font-family: var(--font-mono); font-size: 0.9rem; font-weight: 500;
  }
  .step-body h3 { font-size: 1.05rem; color: var(--fg-main); margin-bottom: 0.25rem; }
  .step-body p { margin-bottom: 0; }

  /* ---------- Matrix / tables ---------- */
  .table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 2rem;
  }
  .matrix-table {
    width: 100%; border-collapse: collapse;
    text-align: left; font-size: 0.92rem; color: var(--fg-dim);
    min-width: 640px;
  }
  .matrix-table thead th {
    padding: 0.9rem 1rem;
    font-family: var(--font-mono); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--fg-main);
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border-strong);
  }
  .matrix-table tbody td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
  .matrix-table tbody tr:last-child td { border-bottom: none; }
  .matrix-table tbody tr { transition: background-color var(--transition-snappy); }
  .matrix-table tbody tr:hover { background-color: rgba(255,255,255,0.02); }
  .matrix-table .tech-id { color: var(--accent); font-family: var(--font-mono); white-space: nowrap; }
  .matrix-table .vector { color: var(--fg-main); font-weight: 500; }

  /* ---------- Assurance trace ---------- */
  .assurance-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    margin-top: 2rem;
    overflow: hidden;
    background: var(--bg-inset);
  }
  .assurance-stage {
    position: relative;
    min-height: 168px;
    padding: 1.25rem;
    border-right: 1px solid var(--border);
  }
  .assurance-stage:last-child { border-right: 0; }
  .assurance-stage:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.55rem;
    right: -5px;
    width: 9px;
    height: 9px;
    border-top: 1px solid var(--accent);
    border-right: 1px solid var(--accent);
    background: var(--bg-inset);
    transform: rotate(45deg);
    z-index: 1;
  }
  .assurance-stage-label {
    display: block;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.75rem;
  }
  .assurance-stage strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.98rem;
  }
  .assurance-stage p { font-size: 0.88rem; line-height: 1.5; }

  .status {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.78rem; font-weight: 600;
    padding: 0.2rem 0.55rem; border-radius: 999px;
    border: 1px solid var(--border-strong);
    white-space: nowrap;
  }
  .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
  .status-partial { color: var(--warn); }
  .status-partial::before { background: var(--warn); }
  .status-none { color: var(--fg-dim); }
  .status-none::before { background: var(--fg-dim); }
  .status-yes { color: var(--ok); }
  .status-yes::before { background: var(--ok); }

  /* ---------- Reveal (subtle entry) ---------- */
  .reveal-clean {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  }
  .reveal-clean.in-view-fallback { opacity: 1; transform: translateY(0); }

  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes reveal-in {
      from { opacity: 0; transform: translateY(16px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .reveal-clean {
      opacity: 1; transform: none; transition: none;
      animation: reveal-in auto var(--ease) both;
      animation-timeline: view(block);
      animation-range: entry 5% cover 22%;
    }
  }

  /* Reduced motion: first rule must carry animation-duration + transition-duration */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      scroll-behavior: auto !important;
    }
    .reveal-clean { opacity: 1 !important; transform: none !important; }
  }

  /* ---------- Dialog ---------- */
  dialog {
    margin: auto;
    background: var(--bg-raise);
    border: 1px solid var(--border-strong);
    padding: 2.5rem;
    width: 90%; max-width: 480px;
    color: var(--fg-main);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    transition: display 0.3s allow-discrete, overlay 0.3s allow-discrete;
  }
  dialog h3 { color: var(--fg-main); }
  @starting-style {
    dialog[open] { opacity: 0; transform: scale(0.97) translateY(8px); }
    dialog[open]::backdrop { opacity: 0; }
  }
  dialog[open] {
    opacity: 1; transform: scale(1) translateY(0);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease),
                display 0.3s allow-discrete, overlay 0.3s allow-discrete;
  }
  dialog::backdrop {
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
  }
  .dialog-close {
    position: absolute; top: 0.85rem; right: 0.85rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid transparent;
    color: var(--fg-dim);
    cursor: pointer; font-size: 1.4rem;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background var(--transition-snappy), color var(--transition-snappy);
  }
  .dialog-close:hover { background: rgba(255,255,255,0.1); color: var(--fg-main); }

  /* ---------- Scoping intake (wizard) ---------- */
  .wizard-container {
    background: var(--bg-raise);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    min-height: 340px;
    box-shadow: var(--shadow);
  }
  .wizard-step { display: none; animation: fadeSlideUp 0.35s var(--ease) forwards; }
  .wizard-step.active { display: block; }
  @keyframes fadeSlideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  .estimator-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.85rem;
  }
  .estimator-btn {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
    text-align: left; cursor: pointer; user-select: none;
    color: var(--fg-main);
    display: flex; flex-direction: column; gap: 0.3rem;
    min-height: 64px;
    transition: background var(--transition-snappy), border-color var(--transition-snappy);
  }
  .estimator-btn:hover { background: rgba(255,255,255,0.04); border-color: var(--border-strong); }
  .estimator-btn:active { transform: scale(0.98); }
  .estimator-btn.active { background: var(--accent-soft); border-color: var(--accent); }
  .est-title { font-weight: 600; font-size: 1rem; }
  .est-desc { font-size: 0.85rem; color: var(--fg-dim); }

  input[type="email"] {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--fg-main);
    font-family: var(--font-sans); font-size: 1rem;
    transition: border-color var(--transition-snappy), box-shadow var(--transition-snappy);
  }
  input[type="email"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .form-status { flex-basis: 100%; min-height: 1.5rem; margin-top: 0.75rem; color: var(--fg-dim); }
  .form-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
  button:disabled { cursor: wait; opacity: 0.65; }

  /* ---------- Telemetry / indicator sample ---------- */
  .telemetry-filters { margin-bottom: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
  .telemetry-feed { display: flex; flex-direction: column; gap: 0.75rem; min-height: 220px; }
  .log-card {
    padding: 1rem 1.25rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-left: 3px solid var(--fg-mute);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem; line-height: 1.5;
    color: var(--fg-dim);
    view-transition-class: log-item;
  }
  .log-card.malicious {
    border-left-color: var(--accent);
    color: #fca5a5;
  }
  ::view-transition-group(.log-item) { animation-duration: 0.4s; animation-timing-function: var(--ease); }
  ::view-transition-new(.log-item):only-child { animation: log-in 0.4s var(--ease); }
  ::view-transition-old(.log-item):only-child { animation: log-out 0.4s var(--ease); }
  @keyframes log-in { from { opacity: 0; transform: translateY(10px); } }
  @keyframes log-out { to { opacity: 0; } }

  .filter-btn { min-height: 40px; padding: 0.5rem 1rem; font-size: 0.85rem; }
  .filter-btn.active { background: rgba(255,255,255,0.06); border-color: var(--border-strong); color: var(--fg-main); }
  .filter-btn[data-filter="malicious"].active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

  /* ---------- Diagram ---------- */
  .diagram {
    margin-top: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-raise);
    padding: 1.75rem;
    box-shadow: var(--shadow);
  }
  .diagram figcaption { color: var(--fg-mute); font-size: 0.82rem; margin-top: 1rem; }

  .boundary-diagram figcaption {
    margin: 0;
    color: var(--fg-main);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  .boundary-intro {
    margin: 0.35rem 0 0;
    color: var(--fg-mute);
    font-size: 0.82rem;
    line-height: 1.5;
  }
  .boundary-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1.5rem;
  }
  .boundary-node {
    position: relative;
    z-index: 1;
    width: min(230px, 100%);
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-inset);
    text-align: center;
  }
  .boundary-node strong {
    display: block;
    color: var(--fg-main);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
  }
  .boundary-role {
    display: block;
    margin-bottom: 0.22rem;
    color: var(--fg-mute);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .boundary-node small {
    display: block;
    margin-top: 0.3rem;
    color: var(--fg-mute);
    font-size: 0.68rem;
    line-height: 1.35;
  }
  .boundary-link {
    position: relative;
    width: 100%;
    height: 48px;
    display: grid;
    place-items: center;
  }
  .boundary-link::before {
    content: "";
    position: absolute;
    inset-block: 0;
    left: 50%;
    border-left: 1px solid var(--fg-mute);
  }
  .boundary-link::after {
    content: "";
    position: absolute;
    bottom: 1px;
    left: calc(50% - 4px);
    width: 7px;
    height: 7px;
    border-right: 1px solid var(--fg-mute);
    border-bottom: 1px solid var(--fg-mute);
    transform: rotate(45deg);
  }
  .boundary-link span {
    position: relative;
    z-index: 1;
    padding: 0.15rem 0.45rem;
    background: var(--bg-raise);
    color: var(--fg-mute);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .boundary-scope {
    position: relative;
    width: 100%;
    padding: 2rem 1rem 1rem;
    border: 1px solid rgba(239, 68, 68, 0.68);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.025);
  }
  .boundary-scope-label {
    position: absolute;
    top: 0.62rem;
    left: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .boundary-scope-label::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
  }
  .boundary-server { margin-inline: auto; }
  .boundary-link-inner span { background: #111113; }
  .boundary-targets {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    padding-top: 14px;
  }
  .boundary-targets::before {
    content: "";
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    border-top: 1px solid var(--fg-mute);
  }
  .boundary-target::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 50%;
    height: 14px;
    border-left: 1px solid var(--fg-mute);
  }
  .boundary-target {
    width: 100%;
    min-height: 88px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-inline: 0.55rem;
  }
  .boundary-summary {
    margin: 1.15rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--fg-dim);
    font-size: 0.78rem;
    line-height: 1.55;
  }
  .boundary-summary strong { color: var(--fg-main); font-weight: 600; }

  /* Inline text trigger styled as a link (real <button> for accessibility) */
  .text-link {
    background: none; border: none; padding: 0;
    font: inherit; color: var(--accent); cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px;
  }
  .text-link:hover, .text-link:focus-visible { color: #f87171; }

  /* ---------- Footer ---------- */
  .site-footer { padding-top: 3rem; padding-bottom: 3rem; }
  .site-footer .foot-row {
    grid-column: span 12;
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    padding-top: 2rem; border-top: 1px solid var(--border);
  }

  /* ---------- Misc helpers ---------- */
  .lede { font-size: clamp(1.15rem, 1.4vw, 1.35rem); color: var(--fg-main); line-height: 1.5; max-width: 60ch; }
  .prose-list { list-style: none; display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1.5rem; }
  .prose-list li { display: flex; gap: 0.7rem; color: var(--fg-dim); }
  .prose-list li::before { content: ""; width: 6px; height: 6px; margin-top: 0.55rem; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
  .label-tag {
    display: inline-block;
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--fg-mute);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 0.2rem 0.6rem;
  }

  /* ---------- Synthetic authorization case study ---------- */
  .case-hero { align-items: center; }
  .reference-label {
    display: inline-flex;
    padding: 0.38rem 0.65rem;
    margin-bottom: 1.15rem;
    border: 1px solid var(--accent);
    border-radius: 3px;
    color: #fca5a5;
    background: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .case-kicker {
    color: var(--fg-mute);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .decision-trace {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-inset);
    padding: 1.5rem;
    box-shadow: var(--shadow);
  }
  .decision-trace figcaption, .source-title {
    color: var(--fg-mute);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .trace-request {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    background: #111113;
  }
  .trace-request span { color: var(--fg-mute); font: 0.68rem var(--font-mono); text-transform: uppercase; }
  .trace-request strong { font: 0.82rem var(--font-mono); }
  .trace-branches { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 1.75rem; background: var(--border-strong); }
  .trace-branch { position: relative; padding: 1.15rem; background: #111113; min-height: 176px; }
  .trace-branch::before { content: ""; position: absolute; top: -1.75rem; left: 50%; height: 1.75rem; border-left: 1px solid var(--border-strong); }
  .trace-branch code, .trace-branch strong, .trace-branch small { display: block; }
  .trace-branch code { margin: 1.2rem 0 0.9rem; border: 0; padding: 0; background: transparent; }
  .trace-branch small { margin-top: 0.55rem; color: var(--fg-mute); line-height: 1.45; }
  .trace-fail { box-shadow: inset 0 -3px 0 var(--accent); }
  .trace-pass { box-shadow: inset 0 -3px 0 var(--ok); }
  .trace-pass strong { color: var(--ok); }
  .trace-state { color: var(--fg-mute); font: 0.68rem var(--font-mono); text-transform: uppercase; }
  .case-status-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--border); }
  .case-status-strip div { padding: 1.25rem; border-right: 1px solid var(--border); }
  .case-status-strip div:last-child { border: 0; }
  .case-status-strip span, .case-status-strip strong { display: block; }
  .case-status-strip span { color: var(--fg-mute); font: 0.67rem var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }
  .case-status-strip strong { margin-top: .25rem; font-size: .88rem; }
  .case-ok { color: var(--ok) !important; }
  .trust-map { display: grid; grid-template-columns: 1fr 80px 1.25fr 80px 1fr; align-items: center; margin: 2rem 0; }
  .trust-node { padding: 1rem; border: 1px solid var(--border-strong); background: var(--bg-inset); text-align: center; }
  .trust-node span, .trust-node strong { display: block; }
  .trust-node span { color: var(--fg-mute); font: .65rem var(--font-mono); text-transform: uppercase; }
  .trust-node strong { margin-top: .35rem; font-size: .9rem; }
  .trust-arrow { position: relative; height: 1px; background: var(--fg-mute); }
  .trust-arrow::after { content: ""; position: absolute; right: 0; top: -4px; width: 8px; height: 8px; border-top: 1px solid var(--fg-mute); border-right: 1px solid var(--fg-mute); transform: rotate(45deg); }
  .trust-arrow span { position: absolute; left: 50%; bottom: .55rem; width: 120px; transform: translateX(-50%); color: var(--fg-mute); text-align: center; font: .6rem var(--font-mono); }
  .trust-arrow-risk { background: var(--accent); }
  .trust-arrow-risk::after { border-color: var(--accent); }
  .trust-arrow-risk span { color: #fca5a5; }
  .trust-boundary { position: relative; padding: 2rem .65rem .65rem; border: 1px dashed var(--accent); background: rgba(239,68,68,.025); }
  .trust-boundary-label { position: absolute; top: .5rem; left: .65rem; color: var(--accent); font: .62rem var(--font-mono); text-transform: uppercase; }
  .case-note { padding: 1rem 0 1rem 1.25rem; border-left: 2px solid var(--border-strong); font-size: .93rem; }
  .source-panel { overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-inset); }
  .source-title { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
  .source-panel pre { overflow-x: auto; padding: 1.35rem; color: var(--fg-dim); font: .82rem/1.65 var(--font-mono); }
  .source-panel pre code { padding: 0; border: 0; background: transparent; color: inherit; }
  .diff-del, .diff-add { display: block; margin-inline: -1.35rem; padding-inline: 1.35rem; }
  .diff-del { color: #fca5a5; background: rgba(239,68,68,.09); }
  .diff-add { color: #a7f3d0; background: rgba(52,211,153,.07); }
  .telemetry-line { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; margin-bottom: 1.5rem; border: 1px solid var(--border); border-left: 3px solid var(--ok); background: var(--bg-inset); font-family: var(--font-mono); }
  .telemetry-line > span:first-child { color: var(--fg-mute); font-size: .72rem; }
  .telemetry-line code { flex: 1; overflow-wrap: anywhere; }
  .repro-steps { list-style: none; display: grid; gap: 1px; background: var(--border); }
  .repro-steps li { display: grid; grid-template-columns: 42px 1fr; gap: 1rem; padding: 1rem; background: var(--bg-inset); }
  .repro-steps li > span { color: var(--accent); font: .76rem var(--font-mono); }
  .repro-steps p { margin: 0; }
  .impact-box { margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--accent); background: var(--accent-soft); }
  .impact-box > span, .impact-box > strong { display: block; }
  .impact-box > span { color: #fca5a5; font: .7rem var(--font-mono); text-transform: uppercase; }
  .impact-box > strong { margin: .6rem 0; font-size: 1.08rem; }
  .case-cta { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: linear-gradient(90deg, transparent, rgba(239,68,68,.035), transparent); }
  .case-cta .btn { margin-top: 1rem; }

  @media (max-width: 900px) {
    .case-hero .col-5, .case-hero .col-7 { grid-column: span 12; }
    .decision-trace { margin-top: 1rem; }
    .trust-map { grid-template-columns: 1fr; gap: 44px; }
    .trust-arrow { height: 44px; width: 1px; margin-inline: auto; }
    .trust-arrow::after { right: -4px; top: auto; bottom: 0; transform: rotate(135deg); }
    .trust-arrow span { bottom: auto; top: 50%; left: 1rem; width: 160px; transform: translateY(-50%); text-align: left; }
  }
  @media (max-width: 640px) {
    .case-status-strip { grid-template-columns: 1fr 1fr; }
    .case-status-strip div:nth-child(2) { border-right: 0; }
    .case-status-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
    .trace-branches { grid-template-columns: 1fr; }
    .trace-branch::before { display: none; }
    .telemetry-line { align-items: flex-start; flex-wrap: wrap; }
    .telemetry-line code { flex-basis: 100%; }
  }
}

@layer utilities {
  .sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
  }
  .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
  .mt-4 { margin-top: 2rem; } .mt-6 { margin-top: 3rem; }
  .accent { color: var(--accent); }
  .muted { color: var(--fg-mute); }

  /* Responsive: collapse editorial split on tablet/phone */
  @media (max-width: 768px) {
    .grid-container { padding: 0 1.25rem; gap: 1.25rem; }
    .col-9, .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 { grid-column: span 12; }
    .section-py { padding-top: var(--space-16); padding-bottom: var(--space-16); }
    .header-py { padding-top: 7rem; padding-bottom: var(--space-12); }
    .assurance-flow { grid-template-columns: 1fr; }
    .assurance-stage { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
    .assurance-stage:last-child { border-bottom: 0; }
    .assurance-stage:not(:last-child)::after {
      top: auto;
      right: 1.55rem;
      bottom: -5px;
      transform: rotate(135deg);
    }
  }
}
