/* Ring 0 Research
   Visual idea: privilege descent. Pages read as a walk from ring 3 (user
   mode) down to ring 0 (kernel), marked in a left rail. Type: Instrument
   Serif (display), IBM Plex Sans (body), IBM Plex Mono (labels). One accent. */

@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  /* Palette: warm near-black, bone text, one vermilion accent.
     Contrast on --bg: text 15.9:1, muted 7.4:1, accent 6.9:1. */
  --bg: #0c0d0c;
  --bg-raised: #131513;
  --line: #2a2d2a;
  --line-strong: #3d413d;
  --text: #ece9e1;
  --muted: #a3a39a;
  --accent: #ff6b3d;
  --accent-ink: #0c0d0c;

  --f-display: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --gutter: clamp(20px, 4vw, 48px);
  --rail-col: 168px;
  --max: 1200px;
  --measure: 66ch;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh;
}
main { flex: 1 0 auto; }
img, svg { display: block; max-width: 100%; }

a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
main:focus { outline: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link { position: absolute; left: var(--gutter); top: -100px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: .5rem .9rem; font-family: var(--f-mono); font-size: .875rem; text-decoration: none; }
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Type ---------- */
h1, h2, h3 { margin: 0; font-weight: 400; }
h1, h2 { font-family: var(--f-display); letter-spacing: -.01em; line-height: 1.04; }
h1 { font-size: clamp(2.6rem, 1.4rem + 5.2vw, 5.4rem); }
h2 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem); }
h3 { font-family: var(--f-body); font-weight: 600; font-size: 1.125rem; line-height: 1.35; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }

.lead { font-size: clamp(1.125rem, 1rem + .45vw, 1.3rem); line-height: 1.55; color: var(--text); max-width: 58ch; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); }

.eyebrow {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin: 0 0 1.75rem;
  font-size: .9375rem; color: var(--muted);
}

/* Ring tag: the privilege-level marker used in the rail and eyebrows. */
.ring-tag {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .3rem .7rem .3rem .45rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--bg);
  font-family: var(--f-mono); font-size: .8125rem; font-weight: 500; letter-spacing: 0; color: var(--text);
  white-space: nowrap;
}
.ring-tag::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 1px solid var(--muted);
  box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 3px var(--muted);
}
.ring-tag[data-ring="0"] { border-color: var(--accent); color: var(--accent); }
.ring-tag[data-ring="0"]::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--bg); }

/* ---------- Header ---------- */
.site-header { position: relative; z-index: 20; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 72px; }

.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); font-weight: 600; font-size: 1rem; letter-spacing: .01em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark circle { fill: none; stroke: var(--text); stroke-width: 1.25; }
.brand-mark .core { fill: var(--accent); stroke: none; }
.brand:hover .brand-mark circle:not(.core) { stroke: var(--accent); }

.site-nav ul { display: flex; gap: clamp(1rem, 2.4vw, 2.25rem); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: inline-block; padding: .5rem 0;
  font-size: .9375rem;
  color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: .6rem;
    min-height: 44px; padding: 0 .9rem; margin-right: -.4rem;
    background: transparent; color: var(--text); border: 1px solid var(--line-strong); border-radius: 999px;
    font: 600 .9375rem/1 var(--f-body); cursor: pointer;
  }
  .nav-toggle-icon { position: relative; width: 14px; height: 8px; }
  .nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; transition: transform .25s var(--ease), top .25s var(--ease); }
  .nav-toggle-icon::before { top: 0; }
  .nav-toggle-icon::after { top: 6.5px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { top: 3.25px; transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { top: 3.25px; transform: rotate(-45deg); }

  /* Without JS the links simply wrap under the brand. */
  .header-inner { flex-wrap: wrap; }
  .site-nav { width: 100%; }
  .site-nav ul { flex-wrap: wrap; gap: .25rem 1.25rem; padding-bottom: .75rem; }

  .js .header-inner { flex-wrap: nowrap; }
  .js .site-nav {
    box-shadow: 0 24px 40px -12px rgb(0 0 0 / .7);
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: .5rem var(--gutter) 1.5rem;
  }
  .js .site-nav:not(.is-open) { display: none; }
  .js .site-nav ul { flex-direction: column; gap: 0; padding: 0; }
  .js .site-nav li + li { border-top: 1px solid var(--line); }
  .js .site-nav a { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; font-size: 1.0625rem; border-bottom: 0; }
  .js .site-nav a[aria-current="page"] { color: var(--accent); }
  .js .site-nav a[aria-current="page"]::after { content: "Current page"; color: var(--muted); font-size: .875rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: clamp(2rem, 4vw, 4rem);
  padding-block: clamp(3.5rem, 8vw, 7.5rem) clamp(3.5rem, 7vw, 6.5rem);
}
.hero h1 { max-width: 14ch; margin-bottom: 2rem; }
.hero-404 h1 { max-width: none; }
.hero .lead { margin-bottom: 2.5rem; }
.hero-rings { margin: 0 calc(-1 * clamp(0px, 2vw, 32px)) 0 0; justify-self: end; width: 100%; max-width: 560px; }

.actions { display: flex; flex-wrap: wrap; gap: .75rem 1rem; margin: 0; }
.button {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 48px; padding: 0 1.35rem;
  border: 1px solid var(--accent); border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: .9375rem; text-decoration: none;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.button:hover { background: transparent; color: var(--accent); }
.button-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.button-ghost:hover { border-color: var(--text); color: var(--text); }

/* Rings diagram */
.rings { overflow: visible; }
.rings .ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.rings .ring-0 { stroke: var(--accent); }
.rings .ticks { fill: none; stroke: var(--muted); stroke-width: 6; stroke-dasharray: 1 11; opacity: .5; transform-origin: 300px 300px; }
.rings .label { fill: var(--muted); font-family: var(--f-mono); font-size: 14px; }
.rings .label-0 { fill: var(--accent); }
.rings .path { fill: none; stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 3 5; }
.rings .cross { fill: var(--bg); stroke: var(--accent); stroke-width: 1.25; }
.rings .core { fill: var(--accent); }
.rings .core-halo { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; transform-origin: 300px 300px; }

@media (prefers-reduced-motion: no-preference) {
  .rings .ring { stroke-dasharray: 1900; stroke-dashoffset: 1900; animation: draw 1.6s var(--ease) forwards; }
  .rings .ring-2 { animation-delay: .12s; }
  .rings .ring-1 { animation-delay: .24s; }
  .rings .ring-0 { animation-delay: .36s; }
  .rings .cross, .rings .core, .rings .label { animation: rise-in .6s .9s var(--ease) both; }
  /* Looping motion kept at Raul's request: the tick ring turns, the path dashes march, the ring 0 core pulses. */
  .rings .ticks { animation: spin 140s linear infinite; }
  .rings .path { animation: rise-in .6s .9s var(--ease) both, march 1.4s linear infinite; }
  .rings .core-halo { animation: pulse 3.2s 1.5s var(--ease) infinite; }
  .reveal { animation: rise .8s var(--ease) both; }
  .reveal-2 { animation-delay: .08s; }
  .reveal-3 { animation-delay: .16s; }
  .reveal-4 { animation-delay: .24s; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise-in { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes march { to { stroke-dashoffset: -16; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .45; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Bands with the privilege rail ---------- */
.band { border-top: 1px solid var(--line); }
.band-grid { display: grid; grid-template-columns: var(--rail-col) minmax(0, 1fr); column-gap: clamp(1.5rem, 4vw, 4rem); }
.band-rail { position: relative; padding-block: clamp(3rem, 6vw, 5.5rem); }
.band-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 14px; width: 1px; background: var(--line-strong); }
.band-rail:not(:has(.ring-tag))::before { display: none; }
.band:last-child .band-rail::before { bottom: auto; height: calc(clamp(3rem, 6vw, 5.5rem) + 14px); }
.band-rail .ring-tag { position: relative; }
.band-body { padding-block: clamp(3rem, 6vw, 5.5rem); min-width: 0; }
.band-body > h2 { margin-bottom: clamp(1.75rem, 3vw, 2.75rem); max-width: 22ch; }
.band-body .prose { max-width: var(--measure); }

/* Ruled rows (what we do) */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows > li {
  display: grid; grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); gap: .5rem 2.5rem;
  padding-block: 1.75rem; border-bottom: 1px solid var(--line);
}
.rows h3 { font-size: 1.1875rem; }
.rows p { color: var(--muted); max-width: 60ch; }

/* Statement (why drivers) */
.statement { font-family: var(--f-display); font-size: clamp(2.1rem, 1.2rem + 3vw, 3.75rem); line-height: 1.1; letter-spacing: -.01em; max-width: 20ch; margin: 0 0 1.75rem; }
.statement em { color: var(--accent); }

/* Ring 0 band: the destination */
.band-zero .band-body { position: relative; }
.contact-line { font-family: var(--f-display); font-size: clamp(1.75rem, 1rem + 3.4vw, 3.6rem); line-height: 1.1; letter-spacing: -.01em; margin: 0 0 1.5rem; overflow-wrap: anywhere; }
.contact-line a { text-decoration-thickness: 2px; text-underline-offset: .14em; }

/* ---------- Inner pages ---------- */
.page-head { padding-block: clamp(3rem, 7vw, 6rem) clamp(2.5rem, 5vw, 4rem); }
.page-head h1 { max-width: 16ch; margin-bottom: 1.5rem; }

.prose h2 { margin-bottom: 1.5rem; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.25rem; }
.prose li { margin-bottom: .6rem; }
.prose li::marker { color: var(--accent); }

/* Process steps with a rail */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; max-width: var(--measure); }
.steps > li { position: relative; padding: 0 0 1.9rem 3.25rem; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem;
  width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; font-family: var(--f-mono); font-size: .75rem; color: var(--text);
}
.steps > li::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 1px; background: var(--line-strong); }
.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps > li:last-child::before { border-color: var(--accent); color: var(--accent); }
.steps strong { display: block; margin-bottom: .15rem; }

/* Timeline scale */
.scale { position: relative; margin: 0 0 2.75rem; padding-top: 4rem; max-width: var(--measure); }
.scale-track { position: relative; height: 1px; background: var(--line-strong); }
.scale-track::after { content: ""; position: absolute; left: 0; top: -1px; height: 3px; width: 100%; background: linear-gradient(90deg, var(--accent), var(--accent)) no-repeat 0 0 / 100% 100%; opacity: .9; }
.scale-points { list-style: none; margin: 0; padding: 0; position: relative; height: 4.5rem; }
.scale-points li { position: absolute; top: 0; transform: translateX(-50%); padding-top: 1.1rem; font-size: .8125rem; color: var(--muted); text-align: center; white-space: nowrap; line-height: 1.4; }
.scale-points li::before { content: ""; position: absolute; left: 50%; top: -6px; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: var(--bg); border: 1px solid var(--accent); }
.scale-points li b { display: block; color: var(--text); font-weight: 600; font-size: .875rem; }
.scale-points li:first-child { left: 0; transform: none; text-align: left; }
.scale-points li:first-child::before { left: 0; margin-left: 0; }
.scale-points li:last-child { left: auto; right: 0; transform: none; text-align: right; }
.scale-points li:last-child::before { left: auto; right: 0; margin-left: 0; background: var(--accent); }
.scale-points .p7 { left: 7.78%; top: -3.4rem; padding-top: 0; transform: none; text-align: left; }
.scale-points .p7::before { top: calc(3.4rem - 6px); left: 0; margin-left: -5.5px; }
@media (prefers-reduced-motion: no-preference) {
  .scale-track::after { animation: fill 1.6s .3s var(--ease) both; }
}
@keyframes fill { from { background-size: 0 100%; } }

/* On-page index for the policy */
.toc { position: relative; margin: 0; padding: .25rem 0 .25rem 30px; list-style: none; font-size: .875rem; background: var(--bg); }
.toc li { margin-bottom: .35rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* Advisory index */
.ledger { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.ledger caption { text-align: left; caption-side: top; padding-bottom: 1rem; font-size: .9375rem; color: var(--muted); }
.ledger th { text-align: left; font-weight: 600; font-size: .875rem; color: var(--muted); padding: .75rem 1rem .75rem 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ledger td { padding: 1.1rem 1rem 1.1rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger td.id { font-family: var(--f-mono); font-size: .875rem; white-space: nowrap; }
.ledger .empty td { padding-block: 3rem; }
.empty-title { font-family: var(--f-display); font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); line-height: 1.15; margin: 0 0 .75rem; }
.empty-text { color: var(--muted); max-width: 52ch; margin: 0; }
.ledger-wrap { overflow-x: auto; }

.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.facts > div { padding: 1.25rem 1.5rem 1.25rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: .875rem; color: var(--muted); margin-bottom: .35rem; }
.facts dd { margin: 0; }

/* 404 */
.status-code { font-family: var(--f-mono); font-size: .875rem; color: var(--accent); letter-spacing: .04em; margin: 0 0 1.5rem; overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 3rem 3.5rem; margin-top: 0; }
.footer-inner { display: grid; grid-template-columns: var(--rail-col) minmax(0, 1fr) auto; column-gap: clamp(1.5rem, 4vw, 4rem); row-gap: 1.25rem; align-items: start; }
.footer-brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .9375rem; }
.footer-brand .brand-mark { width: 22px; height: 22px; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; list-style: none; margin: 0; padding: 0; font-size: .9375rem; }
.footer-meta { font-size: .875rem; color: var(--muted); text-align: right; line-height: 1.7; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root { --rail-col: 132px; }
  .rows > li { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .footer-meta { text-align: left; }
}

/* Hero: text left, rings right from 900px up; stacked below. */
@media (min-width: 900px) and (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2.5rem; }
  .hero h1 { font-size: clamp(2.9rem, 1rem + 4.4vw, 4.4rem); }
}
@media (max-width: 899px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-rings { order: -1; justify-self: start; max-width: 340px; margin: 0 0 .5rem; }
}

@media (max-width: 680px) {
  body { font-size: 1rem; }
  .hero { padding-top: 2.5rem; }
  .hero-rings { max-width: 260px; margin-left: -6px; }
  .band-grid { grid-template-columns: minmax(0, 1fr); }
  .band-rail { display: flex; align-items: center; gap: .9rem; padding-block: 2.25rem 0; }
  .band-rail::before { display: none; }
  .rings .label { font-size: 19px; }
  .rings .label-0 { font-size: 21px; }
  .band-body { padding-block: 1.5rem 3rem; }
  .toc { display: none; }
  .band-rail:not(:has(.ring-tag)) { display: none; }
  .band-rail:not(:has(.ring-tag)) + .band-body { padding-top: 3rem; }
  .rows > li { padding-block: 1.4rem; }
  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ledger, .ledger caption, .ledger tbody, .ledger tr, .ledger td { display: block; }
  .ledger .empty td { padding-block: 2rem; }
  .scale-points li { font-size: .6875rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  :root { --bg: #fff; --text: #000; --muted: #444; --line: #ccc; --line-strong: #999; --accent: #b3341a; }
  .site-header nav, .nav-toggle, .hero-rings, .skip-link { display: none !important; }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
