/* Shared site shell: header, footer, forms and the emergency page. Loaded last on every page so all pages
   read as one site. Colors come from theme.css; the layout and type follow the monitor's design system. */
@font-face { font-family: "Inter"; src: url("/assets/inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/inter-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/assets/plexmono-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/assets/plexmono-500-latin.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --shell-wrap: min(1800px, 100% - 48px);
  --shell-font: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --shell-mono: "Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --shell-r: 5px;
}

/* ---------- skip link ---------- */
.skip { position: absolute; left: -9999px; top: 0; background: var(--site-action); color: var(--site-on-action); padding: 10px 14px; z-index: 90; font: 600 14px/1.2 var(--shell-font); }
.skip:focus { left: 8px; top: 8px; }

/* ---------- header ---------- */
.top { border-bottom: 1px solid var(--site-line); position: relative; z-index: 6; background: var(--site-paper); font-family: var(--shell-font); }
.top .wrap { width: var(--shell-wrap); max-width: none; margin-inline: auto; display: flex; align-items: center; gap: 10px 20px; flex-wrap: wrap; padding: 12px 0; height: auto; }
.top a { color: inherit; }
.top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 17px/1 var(--shell-font); letter-spacing: -.012em; white-space: nowrap; color: var(--site-ink); }
.top .brand b { font-weight: 700; color: var(--site-accent); }
.top .brand small { display: block; font: 500 12px/1 var(--shell-font); letter-spacing: 0; color: var(--site-muted); margin-top: 5px; text-transform: none; }
.top .eye { width: 12px; height: 12px; border-radius: 50%; background: var(--site-accent); flex: none; margin: 4px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-accent) 20%, transparent); }
.top .monitor-nav { margin-left: 8px; }
.top .monitor-nav ul { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; }
.top .monitor-nav li { margin: 0; }
.top .monitor-nav a { display: flex; align-items: center; min-height: 34px; padding: 6px 12px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--site-muted); border-radius: var(--shell-r); border: 0; }
.top .monitor-nav a:hover { color: var(--site-ink); background: var(--site-soft); }
.top .monitor-nav a:active { background: var(--site-hover); }
.top .monitor-nav a[aria-current="page"] { color: var(--site-paper); background: var(--site-ink); font-weight: 600; }
.top .desktop-nav { margin-left: auto; display: flex; gap: 4px 20px; flex-wrap: wrap; align-items: center; font-size: 13.5px; }
.top .desktop-nav a { position: relative; color: var(--site-muted); text-decoration: none; padding: 8px 0; font-size: 13.5px; border: 0; }
.top .desktop-nav a:hover { color: var(--site-ink); }
.top .desktop-nav a[aria-current="page"] { color: var(--site-ink); font-weight: 500; }
.top .desktop-nav a[aria-current="page"]::after, .top .desktop-nav a:hover::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px; border-radius: 1px; background: var(--site-accent); }
.top .desktop-nav a:hover:not([aria-current])::after { background: var(--site-line-strong); }

/* Theme: one round button; the icon names the current choice. */
.theme-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--site-line); border-radius: 50%; background: transparent; color: var(--site-muted); cursor: pointer; flex: none; transition: color .15s, border-color .15s, background-color .15s; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--site-ink); border-color: var(--site-line-strong); background: var(--site-soft); }
.theme-toggle svg { grid-area: 1 / 1; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: rotate(-60deg) scale(.6); transition: opacity .25s, transform .35s cubic-bezier(.2, .8, .2, 1); }
.theme-toggle .ti-system path { fill: currentColor; stroke: none; }
:root:not([data-theme-choice]) .ti-system, :root[data-theme-choice="system"] .ti-system,
:root[data-theme-choice="light"] .ti-light, :root[data-theme-choice="dark"] .ti-dark { opacity: 1; transform: none; }
.theme-standalone { display: flex; justify-content: flex-end; margin-block: 0 12px; }

/* Emergency entry: always visible, never folded into the menu. */
.attack-btn { display: inline-flex; align-items: center; gap: 9px; min-height: 36px; padding: 7px 14px 7px 12px; border-radius: 999px; background: var(--site-alarm); color: var(--site-on-alarm) !important; font: 600 14px/1.1 var(--shell-font); text-decoration: none; white-space: nowrap; flex: none; box-shadow: 0 1px 0 color-mix(in srgb, var(--site-alarm) 40%, transparent); transition: background-color .15s, transform .15s; }
.attack-btn:hover { background: var(--site-alarm-hover); }
.attack-btn:active { transform: translateY(1px); }
.attack-btn i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.attack-btn i::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: attack-pulse 2.2s ease-out infinite; }
.attack-btn[aria-current="page"] { box-shadow: 0 0 0 3px var(--site-paper), 0 0 0 5px var(--site-alarm); }
@keyframes attack-pulse { 0% { transform: scale(.5); opacity: .9; } 70%, 100% { transform: scale(1.5); opacity: 0; } }

.top .menu-toggle { display: none; margin: 0; background: transparent; border: 1px solid var(--site-line-strong); border-radius: var(--shell-r); min-height: 36px; padding: 6px 12px; font: 500 14px/1 var(--shell-font); color: var(--site-ink); gap: 8px; align-items: center; cursor: pointer; }
.top .menu-toggle span { font-size: 18px; line-height: 1; }
.top .menu-toggle:hover, .top .menu-toggle[aria-expanded="true"] { border-color: var(--site-ink); background: var(--site-soft); }
.top #mobile-nav { position: static; width: 100%; order: 9; display: grid; margin: 4px 0 0; padding: 0; border: 0; border-top: 1px solid var(--site-line); background: none; box-shadow: none; }
.top #mobile-nav[hidden] { display: none; }
.top #mobile-nav a { display: block; padding: 13px 0; border: 0; border-bottom: 1px solid var(--site-line); text-decoration: none; font-weight: 500; color: var(--site-ink); }
.top #mobile-nav a[aria-current="page"] { color: var(--site-accent); }
.top #mobile-nav > :last-child { border-bottom: 0; }
.top .menu-theme { display: none; align-items: center; justify-content: space-between; padding: 10px 0; font-weight: 500; color: var(--site-ink); }
.nojs-nav { display: flex; gap: 8px 18px; flex-wrap: wrap; padding: 10px 0; font: 13.5px/1.4 var(--shell-font); width: var(--shell-wrap); margin-inline: auto; }
.nojs-nav a { color: var(--site-muted); }
@media (max-width: 1120px) {
  .top .desktop-nav { display: none; }
  .top .menu-toggle { display: inline-flex; }
  .top .theme-toggle { margin-left: auto; }
}
@media (min-width: 1121px) { .top #mobile-nav { display: none; } }
@media (max-width: 640px) {
  :root { --shell-wrap: calc(100% - 24px); }
  .top .wrap { gap: 8px 8px; padding: 10px 0 8px; }
  .top .monitor-nav { margin-left: 0; order: 8; width: 100%; }
  .top .monitor-nav a { min-height: 44px; padding-inline: 8px; }
  .top .brand small { display: none; }
  .attack-btn { padding-inline: 10px 12px; font-size: 13px; min-height: 40px; }
  .theme-toggle, .top .menu-toggle { min-height: 40px; height: 40px; }
  .theme-toggle { width: 40px; }
  /* Phones: the theme button moves into the menu so the header stays on one row. */
  .top .wrap > .theme-toggle { display: none; }
  .top .menu-theme { display: flex; }
  .attack-btn { margin-left: auto; }
  /* Phones: the menu button keeps its accessible name but shows only its mark, so one row holds everything. */
  .top .menu-toggle { width: 40px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .top .menu-toggle span { font-size: 20px; }
  .top .brand { font-size: 15px; gap: 6px; }
  .top .eye { margin: 2px; }
}
@media (max-width: 380px) {
  .top .brand { font-size: 14px; }
  .attack-btn { padding-inline: 9px 10px; gap: 7px; }
}
@media (max-width: 340px) { .top .eye { display: none; } }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--site-line); margin-top: 40px; font-family: var(--shell-font); }
.foot .wrap { width: var(--shell-wrap); max-width: none; margin-inline: auto; padding: 24px 0 40px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 14px 32px; font-size: 13px; line-height: 1.6; color: var(--site-muted); }
.foot nav { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; }
.foot a { color: var(--site-muted); text-decoration-color: var(--site-line-strong); text-underline-offset: 3px; }
.foot a:hover { color: var(--site-ink); }
.foot nav a { text-decoration: none; }
.foot nav a:hover { text-decoration: underline; }
.foot nav a[aria-current="page"] { color: var(--site-ink); }
.foot .credit { margin: 0; }
.foot .credit a { color: var(--site-ink); font-weight: 500; text-decoration: none; }
.foot .credit a:hover { color: var(--site-accent); }
@media (max-width: 640px) {
  .foot nav { gap: 0 18px; }
  .foot nav a, .foot .credit a { display: inline-block; padding-block: 7px; }
}

/* ---------- forms: case tips and emergency requests ---------- */
.intake-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; font-family: var(--shell-font); }
.intake-form fieldset { grid-column: 1 / -1; display: grid; grid-template-columns: inherit; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 0; padding: 0; border: 0; min-width: 0; }
.intake-form fieldset + fieldset { margin-top: 14px; }
.intake-form legend { grid-column: 1 / -1; padding: 0; margin-bottom: 4px; font: 700 18px/1.25 var(--shell-font); letter-spacing: -.008em; color: var(--site-ink); }
.intake-form .field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.intake-form .wide { grid-column: 1 / -1; }
.intake-form label, .intake-form .label { font-size: 13.5px; font-weight: 600; color: var(--site-ink); }
.intake-form label b, .intake-form .label b { font: 500 10.5px/1 var(--shell-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--site-accent); margin-left: 6px; vertical-align: 1px; }
.intake-form input:not([type="radio"]), .intake-form select, .intake-form textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--site-line-strong); border-radius: var(--shell-r); background: var(--site-surface); color: var(--site-ink); font: 15px/1.4 var(--shell-font); transition: border-color .15s, box-shadow .15s; }
.intake-form textarea { resize: vertical; min-height: 84px; }
.intake-form input:focus, .intake-form select:focus, .intake-form textarea:focus { outline: none; border-color: var(--site-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-focus) 22%, transparent); }
.intake-form [aria-invalid="true"] { border-color: var(--site-danger) !important; }
.intake-form .hint { margin: 0; font-size: 12.5px; color: var(--site-muted); }
.intake-form .choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.intake-form .choice { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--site-line); border-radius: var(--shell-r); background: var(--site-surface); font-weight: 500; cursor: pointer; transition: border-color .15s, background-color .15s; }
.intake-form .choice:hover { border-color: var(--site-line-strong); }
.intake-form .choice:has(input:checked) { border-color: var(--site-ink); background: var(--site-soft); }
.intake-form .choice input { accent-color: var(--site-action); width: 16px; height: 16px; margin: 0; flex: none; }
.intake-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.intake-form .challenge:empty { display: none; }
.intake-form .challenge { grid-column: 1 / -1; }
.intake-form .form-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.intake-form .form-status { margin: 0; font-size: 14px; max-width: 70ch; overflow-wrap: anywhere; }
.intake-form .form-status:empty { display: none; }
.intake-form .form-status.error { color: var(--site-danger); }
.intake-form .form-status.success { color: var(--site-ink); border-left: 3px solid var(--site-success); padding: 10px 12px; background: var(--site-success-soft); border-radius: 0 var(--shell-r) var(--shell-r) 0; }
.intake-form .form-status a { color: inherit; }
.intake-form button[type="submit"]:disabled { opacity: .6; cursor: progress; }
.intake-form.sent .field, .intake-form.sent fieldset, .intake-form.sent .challenge, .intake-form.sent button[type="submit"] { display: none; }
@media (max-width: 640px) {
  .intake-form, .intake-form fieldset { grid-template-columns: minmax(0, 1fr); }
  .intake-form .choices { grid-template-columns: minmax(0, 1fr); }
  .intake-form input:not([type="radio"]), .intake-form select, .intake-form textarea { min-height: 44px; font-size: 16px; }
}

/* "Know a case we missed?" */
.review { margin-top: 48px; border-top: 1px solid var(--site-line); font-family: var(--shell-font); }
.review .wrap { width: var(--shell-wrap); max-width: none; margin-inline: auto; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.2fr); gap: 18px 48px; padding: 32px 0 0; align-items: start; }
.review h2 { margin: 0; font: 700 clamp(20px, 1.9vw, 26px)/1.15 var(--shell-font); letter-spacing: -.012em; color: var(--site-ink); }
.review-intro p { margin: 8px 0 0; color: var(--site-muted); font-size: 14px; line-height: 1.55; max-width: 42ch; }
.review noscript p { color: var(--site-muted); font-size: 14px; }
@media (max-width: 900px) { .review .wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- emergency page ---------- */
.attack-page { max-width: 1220px; margin-inline: auto; }
.attack-head .lede { max-width: 62ch; margin-top: 12px; font-size: 17px; line-height: 1.55; color: var(--site-ink); }
.attack-lbl { display: inline-flex; align-items: center; gap: 8px; color: var(--site-alarm) !important; }
.attack-lbl i { width: 8px; height: 8px; border-radius: 50%; background: var(--site-alarm); position: relative; }
.attack-lbl i::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--site-alarm); animation: attack-pulse 2.2s ease-out infinite; }
.attack-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-top: 8px; }
.attack-form { padding: 24px; }
.attack-submit { background: var(--site-alarm); color: var(--site-on-alarm); min-height: 44px; padding-inline: 20px; font-size: 15px; }
.attack-submit:hover { background: var(--site-alarm-hover); }
.attack-side { display: grid; gap: 16px; }
.attack-side .tile { padding: 20px 22px; }
.attack-side h2 { font-size: 18px; margin-bottom: 12px; }
.attack-side p + p { margin-top: 10px; }
.attack-side .steps { counter-reset: s; display: grid; gap: 12px; }
.attack-side .steps li { counter-increment: s; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 14px; line-height: 1.5; }
.attack-side .steps li::before { content: counter(s); font: 700 16px/1.3 var(--shell-font); color: var(--site-accent); }
.small-print { font-size: 13px; line-height: 1.5; }
.form-fallback { grid-column: 1 / -1; }
@media (max-width: 960px) { .attack-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .attack-form { padding: 16px; } }

@media (prefers-reduced-motion: reduce) {
  .attack-btn i::after, .attack-lbl i::after { animation: none; }
  .theme-toggle svg { transition: none; }
}

/* ---------- older pages: same type, controls and accents as the monitor ---------- */
.site-legacy { font-family: var(--shell-font); }
.site-legacy main :is(h1, h2, h3, h4) { font-family: var(--shell-font); color: var(--site-ink); }
.site-legacy main h1 { font-weight: 700; letter-spacing: -.022em; line-height: 1.05; font-size: clamp(32px, 4vw, 56px); }
.site-legacy main h2 { font-weight: 700; letter-spacing: -.014em; line-height: 1.15; font-size: clamp(24px, 2.4vw, 34px); }
.site-legacy main h3 { font-weight: 600; letter-spacing: -.008em; line-height: 1.25; font-size: clamp(18px, 1.5vw, 21px); }
.site-legacy main :is(p, li, dd, dt, td, th, figcaption, blockquote, label, summary) { font-family: var(--shell-font); }
.site-legacy main .lede { font-size: clamp(17px, 1.4vw, 20px); letter-spacing: -.01em; line-height: 1.55; }
.site-legacy main :is(.eyebrow, .index) { font: 500 11.5px/1.5 var(--shell-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--site-accent); }
.site-legacy main .button { min-height: 40px; padding: 9px 16px; gap: 10px; border-radius: var(--shell-r); font: 600 14px/1.2 var(--shell-font); transform: none; }
.site-legacy main .button:hover { transform: none; }
.site-legacy main .button.outline { border-color: var(--site-line-strong); }
.site-legacy main .button.outline:hover { border-color: var(--site-ink); background: var(--site-soft); }
.site-legacy main a:hover { color: var(--site-accent); }
.site-legacy main code, .site-legacy main pre, .site-legacy main kbd { font-family: var(--shell-mono); }
/* The worked-example field guides used a serif face; they now share the site's type. */
.site-legacy.field-guide :is(h1, h2, h3, p, li, a, span, figcaption, dd, dt, td, th, div, label, button, blockquote) { font-family: var(--shell-font) !important; }
.site-legacy.field-guide :is(h1, h2, h3) { font-weight: 700; }
.site-legacy.field-guide :is(.fg-cover, .lesson-cover) h1 { font-size: clamp(36px, 4.6vw, 64px); letter-spacing: -.024em; line-height: 1.04; }
.site-legacy.field-guide .fg-deck { font-size: clamp(19px, 1.9vw, 25px); line-height: 1.35; letter-spacing: -.012em; }
.site-legacy.field-guide :is(.cover-context, .lesson-context) { font-size: 16px; line-height: 1.5; }
.site-legacy.field-guide .lesson-body { font-size: 17px; line-height: 1.65; }
.site-legacy.field-guide :is(.story-copy p, .reading-link, .atlas-stage p, .fg-contact a > span) { font-size: 16px; line-height: 1.45; }
.site-legacy.field-guide .story-number { font-weight: 700; font-size: 28px; }
.site-legacy.field-guide .fg-label { font: 500 11.5px/1.5 var(--shell-mono) !important; letter-spacing: .06em; }
.site-legacy.field-guide .fg-cta { font: 600 15px/1.3 var(--shell-font) !important; min-height: 44px; padding: 10px 18px; border-radius: var(--shell-r); }
