:root {
  color-scheme: dark;
  --bg: #061015;
  --bg-deep: #03080b;
  --surface: #0b171d;
  --surface-2: #102129;
  --line: rgba(163, 216, 229, 0.15);
  --text: #f1f7f8;
  --muted: #91a8af;
  --cyan: #80e6ff;
  --cyan-strong: #1abfe9;
  --amber: #ffb13b;
  --max: 1180px;
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 70% 0%, rgba(18, 122, 151, 0.09), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 3rem), var(--max));
  margin: 0 auto;
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid var(--cyan);
  border-radius: 50% 44% 50% 48%;
  box-shadow: inset 0 0 0 4px rgba(128, 230, 255, 0.12);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: -2px;
  width: 12px;
  height: 2px;
  background: var(--amber);
  transform: rotate(42deg);
  transform-origin: left center;
}

nav { display: flex; align-items: center; gap: 1.6rem; }
nav a { color: #d8e6e9; font-size: 0.86rem; text-decoration: none; }
nav a:hover, nav a:focus-visible { color: var(--cyan); }
.nav-cta { padding: 0.55rem 0.9rem; border: 1px solid rgba(255,255,255,0.28); border-radius: 999px; }

.hero {
  position: relative;
  min-height: min(920px, 100svh);
  overflow: hidden;
  background: var(--bg-deep);
}

.hero-art, .hero-scrim { position: absolute; inset: 0; }

.hero-art {
  background: url("assets/rat-things-hero.jpg") center right / cover no-repeat;
  transform: scale(1.01);
}

.hero-scrim {
  background:
    linear-gradient(90deg, rgba(3,8,11,0.98) 0%, rgba(3,8,11,0.86) 30%, rgba(3,8,11,0.16) 70%, rgba(3,8,11,0.08) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 24%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 3rem), var(--max));
  margin: 0 auto;
  padding-top: clamp(10rem, 24vh, 15rem);
}

.eyebrow, .section-label, .card-kicker {
  margin: 0 0 1rem;
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 900px;
  margin-bottom: 1.5rem;
  font-size: clamp(4.2rem, 9vw, 8.6rem);
  line-height: 0.84;
  letter-spacing: -0.075em;
}

.hero-lede {
  max-width: 570px;
  color: #c0d1d5;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 720;
  text-decoration: none;
}

.button-primary { background: var(--cyan); color: #001017; }
.button-primary:hover, .button-primary:focus-visible { background: #b4f2ff; }
.button-secondary { border-color: rgba(255,255,255,0.28); background: rgba(0,0,0,0.18); }
.button-secondary:hover, .button-secondary:focus-visible { border-color: var(--cyan); color: var(--cyan); }

.hero-stats {
  position: absolute;
  z-index: 2;
  right: max(1.5rem, calc((100vw - var(--max)) / 2));
  bottom: 2.8rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(3,8,11,0.66);
  backdrop-filter: blur(14px);
}

.hero-stats div { padding: 1rem 1.1rem; border-left: 1px solid rgba(255,255,255,0.12); }
.hero-stats div:first-child { border-left: 0; }
.hero-stats dt { color: var(--amber); font: 700 1.1rem ui-monospace, monospace; }
.hero-stats dd { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.72rem; white-space: nowrap; }

.section {
  width: min(calc(100% - 3rem), var(--max));
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) 0;
}

.intro-grid, .section-heading, .validation-section, .start-section, .caution-section {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(2rem, 7vw, 7rem);
  align-items: start;
}

h2 {
  margin-bottom: 1.5rem;
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h3 { margin-bottom: 0.7rem; font-size: 1.35rem; line-height: 1.2; }
.intro-copy, .section-heading > p, .validation-copy > p, .start-copy > p, .caution-section p { color: var(--muted); font-size: 1.04rem; }
.intro-copy p { margin-bottom: 1rem; }

.flow-section { border-top: 1px solid var(--line); }
.flow-section > h2 { max-width: 780px; }
.flow { display: grid; grid-template-columns: repeat(5, 1fr); margin: 3.5rem 0 0; padding: 0; list-style: none; }
.flow li { min-height: 250px; padding: 1.4rem; border: 1px solid var(--line); border-left: 0; }
.flow li:first-child { border-left: 1px solid var(--line); border-radius: var(--radius) 0 0 var(--radius); }
.flow li:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.flow span { display: block; margin-bottom: 3.5rem; color: var(--amber); font: 700 0.76rem ui-monospace, monospace; }
.flow strong { display: block; margin-bottom: 0.5rem; font-size: 1.1rem; }
.flow p { color: var(--muted); font-size: 0.88rem; }

.isolation-section {
  width: 100%;
  padding: clamp(5rem, 10vw, 9rem) max(1.5rem, calc((100vw - var(--max)) / 2));
  background: #08151b;
}

.isolation-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(2rem, 7vw, 7rem);
  align-items: end;
  margin-bottom: 3.5rem;
}

.isolation-heading h2 { margin-bottom: 0; }
.isolation-heading > p { margin-bottom: 0.5rem; color: var(--muted); font-size: 1.04rem; }
.isolation-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.isolation-grid article { min-height: 270px; padding: 1.5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.isolation-grid span { display: block; margin-bottom: 3.5rem; color: var(--amber); font: 700 0.72rem ui-monospace, monospace; }
.isolation-grid p { color: var(--muted); font-size: 0.9rem; }
.boundary-note { max-width: 860px; margin: 1.5rem 0 0; color: var(--muted); font-size: 0.78rem; }

.continuity-section {
  width: 100%;
  padding: clamp(5rem, 10vw, 9rem) max(1.5rem, calc((100vw - var(--max)) / 2));
  border-top: 1px solid rgba(128, 230, 255, 0.12);
  border-bottom: 1px solid rgba(128, 230, 255, 0.12);
  background:
    radial-gradient(circle at 50% 52%, rgba(26, 191, 233, 0.1), transparent 30rem),
    #030a0e;
}

.continuity-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(2rem, 7vw, 7rem);
  align-items: end;
  margin-bottom: 4rem;
}

.continuity-heading h2 { margin-bottom: 0; }
.continuity-heading > p { margin-bottom: 0.5rem; color: var(--muted); font-size: 1.04rem; }

.handoff {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(230px, 1.15fr) auto minmax(180px, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.handoff article {
  min-height: 270px;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(16,33,41,0.9), rgba(8,21,27,0.7));
}

.handoff .handoff-core {
  border-color: rgba(128, 230, 255, 0.4);
  background: linear-gradient(145deg, rgba(16, 61, 73, 0.9), rgba(7, 27, 34, 0.9));
  box-shadow: 0 25px 80px rgba(0,0,0,0.24);
}

.handoff article p:not(.card-kicker) { color: var(--muted); font-size: 0.92rem; }
.handoff-arrow { display: grid; place-content: center; min-width: 66px; color: var(--cyan); text-align: center; }
.handoff-arrow span { color: var(--muted); font: 700 0.64rem ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.handoff-arrow b { font-size: 2rem; font-weight: 400; }

.node-state {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(255, 177, 59, 0.35);
  border-radius: 999px;
  color: var(--amber);
  font: 700 0.66rem ui-monospace, monospace;
  text-transform: uppercase;
}

.node-state-live { border-color: rgba(128,230,255,0.35); color: var(--cyan); }
.proof-note { max-width: 900px; margin: 2.3rem auto 0; color: var(--muted); text-align: center; }
.proof-note strong { color: var(--text); }

.capability-section > h2 { max-width: 800px; }
.capability-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 3.5rem; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.capability-grid article { min-height: 240px; padding: 1.8rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.capability-grid span { display: block; margin-bottom: 3rem; color: var(--amber); font: 700 0.72rem ui-monospace, monospace; }
.capability-grid p { max-width: 460px; color: var(--muted); }

.architecture-section { width: 100%; padding-left: max(1.5rem, calc((100vw - var(--max)) / 2)); padding-right: max(1.5rem, calc((100vw - var(--max)) / 2)); background: #08151b; }
.section-heading { margin-bottom: 3.5rem; }
.section-heading h2 { margin-bottom: 0; }
.section-heading > p { padding-top: 2rem; }
.diagram-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.diagram { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #f7fafb; }
.diagram-wide { grid-column: 1 / -1; }
.diagram a { display: block; padding: 1rem; }
.diagram img { width: 100%; max-height: 680px; object-fit: contain; }
.diagram figcaption { display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1.1rem; border-top: 1px solid #dbe5e8; background: #edf3f5; color: #122027; }
.diagram figcaption span { color: #087d9c; font: 700 0.75rem ui-monospace, monospace; }

.auth-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.auth-grid article { min-height: 285px; padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(16,33,41,0.9), rgba(8,21,27,0.65)); }
.auth-grid article p:not(.card-kicker) { color: var(--muted); }
.auth-grid article code { display: inline-block; margin-top: 2rem; color: var(--amber); font-size: 0.78rem; }

.validation-section { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.text-link { display: inline-block; margin-top: 1rem; color: var(--cyan); font-weight: 700; text-decoration: none; }
.check-list { margin: 0; padding: 0; list-style: none; }
.check-list li { display: flex; gap: 0.8rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); color: #c9d8dc; }
.check-list span { color: var(--cyan); }

.start-section { align-items: center; }
pre { margin: 0; padding: 1.5rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #020709; box-shadow: 0 28px 90px rgba(0,0,0,0.24); }
pre code { color: #bdcdd1; font: 0.86rem/1.85 ui-monospace, SFMono-Regular, Menlo, monospace; }
pre span { color: var(--cyan); }

.caution-section { width: 100%; grid-template-columns: auto minmax(0, 800px); justify-content: center; padding-left: 1.5rem; padding-right: 1.5rem; background: #11140f; }
.caution-mark { display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid rgba(255,177,59,0.45); border-radius: 50%; color: var(--amber); font: 800 1.7rem ui-monospace, monospace; }
.caution-section h2 { max-width: 780px; font-size: clamp(2.2rem, 4vw, 4rem); }

footer { display: flex; justify-content: space-between; gap: 3rem; width: min(calc(100% - 3rem), var(--max)); margin: 0 auto; padding: 4rem 0; }
footer p { max-width: 600px; margin: 1rem 0 0; color: var(--muted); font-size: 0.82rem; }
.footer-links { display: flex; align-items: flex-start; gap: 1.5rem; }
.footer-links a { color: var(--muted); font-size: 0.82rem; text-decoration: none; }
.footer-links a:hover, .footer-links a:focus-visible { color: var(--cyan); }

@media (max-width: 860px) {
  nav a:not(.nav-cta) { display: none; }
  .hero { min-height: 900px; }
  .hero-art { background-position: 63% center; opacity: 0.78; }
  .hero-scrim { background: linear-gradient(90deg, rgba(3,8,11,0.96), rgba(3,8,11,0.35)), linear-gradient(0deg, var(--bg) 0%, transparent 35%); }
  .hero-copy { padding-top: 11rem; }
  .hero-stats { right: 1.5rem; left: 1.5rem; grid-template-columns: 1fr 1fr; }
  .hero-stats div { min-width: 0; }
  .hero-stats dd { white-space: normal; overflow-wrap: anywhere; }
  .hero-stats div:nth-child(3) { border-left: 0; border-top: 1px solid rgba(255,255,255,0.12); }
  .hero-stats div:nth-child(4) { border-top: 1px solid rgba(255,255,255,0.12); }
  .intro-grid, .section-heading, .validation-section, .start-section, .continuity-heading, .isolation-heading { grid-template-columns: 1fr; gap: 1.5rem; }
  .flow { grid-template-columns: 1fr 1fr; }
  .isolation-grid { grid-template-columns: 1fr 1fr; }
  .flow li { min-height: 210px; border: 1px solid var(--line); border-radius: 0 !important; }
  .flow span { margin-bottom: 2rem; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-grid article { min-height: auto; }
  .handoff { grid-template-columns: 1fr; }
  .handoff-arrow { grid-template-columns: auto auto; gap: 0.6rem; min-height: 68px; transform: none; }
  .handoff-arrow b { display: inline-block; transform: rotate(90deg); }
  .handoff article { min-height: auto; }
  footer { flex-direction: column; }
}

@media (max-width: 560px) {
  .site-header, .hero-copy, .section, footer { width: min(calc(100% - 2rem), var(--max)); }
  h1 { font-size: clamp(3.4rem, 16vw, 4.1rem); line-height: 0.88; letter-spacing: -0.06em; }
  .hero-lede { max-width: 90%; }
  .hero-stats { right: 1rem; left: 1rem; }
  .hero-stats div { padding: 0.85rem 0.9rem; }
  .hero-stats dd { font-size: 0.68rem; line-height: 1.35; }
  .flow, .diagram-grid, .capability-grid, .isolation-grid { grid-template-columns: 1fr; }
  .diagram-wide { grid-column: auto; }
  .flow li { min-height: auto; }
  .isolation-grid article, .capability-grid article { min-height: auto; }
  .isolation-grid span, .capability-grid span { margin-bottom: 2rem; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  pre code { font-size: 0.76rem; white-space: inherit; overflow-wrap: inherit; }
  .caution-section { grid-template-columns: 1fr; }
  .footer-links { flex-direction: column; gap: 0.7rem; }
}

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