@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Fragment Mono";
  src: url("/assets/fonts/fragment-mono-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --void: #080806;
  --surface: #0e0e0b;
  --ink: #f3eee3;
  --paper: #d9d2c5;
  --muted: #858177;
  --line: #33322d;
  --line-hot: #575448;
  --signal: #ceff19;
  --human: #ceff19;
  --bot: #c6ccc8;
  --ai: #ff554a;
  --verified: #80a5ff;
  --unknown: #ecb450;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", Arial, sans-serif;
  --mono: "Fragment Mono", ui-monospace, monospace;
  --pad: clamp(1rem, 3.2vw, 3.25rem);
  --max: 1600px;
}

* { box-sizing: border-box; }

html {
  background: var(--void);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 300px;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    radial-gradient(circle at 78% 10%, rgba(143, 101, 48, 0.08), transparent 31rem),
    var(--void);
  background-size: 100% 9rem, auto, auto;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

button,
a { color: inherit; }

button { font: inherit; }

a { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 4px;
}

.gate-skip {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  padding: 0.65rem 0.9rem;
  background: var(--signal);
  color: #111;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.gate-skip:focus { top: 1rem; }

.gate-bar {
  position: relative;
  z-index: 10;
  min-height: 3.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  padding: 0.75rem var(--pad);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 6, 0.92);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gate-brand { color: var(--paper); }
.gate-brand:hover { color: var(--signal); }
.gate-bar-title { justify-self: center; }
.gate-bar time { justify-self: end; }

.gate-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.gate-link i {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--muted);
}

.gate-link[data-connection="live"] i {
  background: var(--signal);
  box-shadow: 0 0 0.7rem rgba(206, 255, 25, 0.65);
  animation: signal 2s ease-out infinite;
}

.gate-link[data-connection="poll"] i { background: var(--unknown); }
.gate-link[data-connection="off"] i { background: var(--ai); }

.gate-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.gate-hero {
  min-height: calc(100svh - 3.25rem);
  display: grid;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(28rem, 1.2fr);
  grid-template-rows: 1fr auto;
  column-gap: clamp(2rem, 5vw, 6rem);
  padding: clamp(3.5rem, 8vh, 7.5rem) 0 2rem;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  position: relative;
  z-index: 3;
  align-self: center;
  padding-bottom: clamp(2rem, 6vh, 5rem);
}

.gate-kicker,
.reading-label,
.reading-result,
.section-marker,
.limits h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gate-kicker,
.reading-label { color: var(--signal); }

.hero-copy h1 {
  margin: 1rem 0 2rem;
  font-family: var(--sans);
  font-size: clamp(4.4rem, 9.4vw, 9.7rem);
  font-weight: 690;
  letter-spacing: -0.085em;
  line-height: 0.73;
}

.hero-copy h1 span,
.hero-copy h1 em { display: block; }

.hero-copy h1 span:nth-child(1) {
  margin-left: 0.04em;
  font-size: 0.4em;
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.hero-copy h1 em {
  margin-left: 0.2em;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 0.93em;
  font-weight: 400;
  letter-spacing: -0.065em;
}

.gate-deck {
  max-width: 35rem;
  margin: 0;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(1.65rem, 2.6vw, 2.75rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.hero-scope {
  max-width: 32rem;
  margin: 2rem 0 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.65;
  text-transform: uppercase;
}

.hero-scope strong {
  color: var(--paper);
  font-weight: 400;
}

.world {
  position: relative;
  z-index: 1;
  width: min(100%, 52rem);
  aspect-ratio: 1;
  margin: 0;
  align-self: center;
  justify-self: end;
}

#map,
.world-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#map {
  z-index: 1;
  overflow: hidden;
  background: #070806;
}

#map .mapboxgl-canvas { outline: none; }

.world.has-map .world-fallback { opacity: 0; }

.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
  color: rgba(217, 210, 197, 0.56);
  font-family: var(--mono);
  font-size: 0.5rem;
}

.mapboxgl-ctrl-attrib.mapboxgl-compact,
.mapboxgl-ctrl-attrib {
  background: rgba(8, 8, 6, 0.78);
  color: inherit;
}

.mapboxgl-ctrl-attrib a { color: rgba(217, 210, 197, 0.7); }

.world-fallback {
  z-index: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 17% 10% at 31% 26%, rgba(177, 152, 103, 0.28) 0 40%, transparent 44%),
    radial-gradient(ellipse 13% 18% at 38% 38%, rgba(92, 82, 58, 0.4) 0 44%, transparent 48%),
    radial-gradient(ellipse 8% 18% at 43% 53%, rgba(80, 73, 51, 0.34) 0 45%, transparent 50%),
    radial-gradient(ellipse 23% 12% at 65% 31%, rgba(98, 87, 59, 0.34) 0 45%, transparent 50%),
    radial-gradient(ellipse 11% 14% at 73% 47%, rgba(84, 75, 49, 0.3) 0 45%, transparent 50%),
    radial-gradient(circle at 38% 30%, #1b1914 0 45%, #0a0a08 70%, #050505 100%);
  box-shadow: 0 0 8rem rgba(183, 117, 46, 0.08);
  opacity: 0.55;
  overflow: hidden;
}

.world-fallback::before,
.world-fallback::after {
  content: "";
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  pointer-events: none;
}

.world-fallback::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 12.3%, rgba(227, 173, 84, 0.06) 12.5%, transparent 12.7%),
    repeating-linear-gradient(0deg, transparent 0 12.3%, rgba(227, 173, 84, 0.05) 12.5%, transparent 12.7%);
  mask-image: radial-gradient(circle, #000 0 69%, transparent 70%);
}

.world-fallback::after {
  border: 1px solid rgba(227, 173, 84, 0.14);
  box-shadow: inset -2.5rem -1rem 5rem rgba(0, 0, 0, 0.86);
}

.world figcaption {
  position: absolute;
  z-index: 4;
  left: 3%;
  bottom: 2%;
  max-width: 27rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.55;
}

.motion-toggle,
.inspect button {
  border: 1px solid var(--line-hot);
  background: rgba(8, 8, 6, 0.8);
  padding: 0.72rem 0.9rem;
  color: var(--paper);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.motion-toggle:hover,
.inspect button:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.motion-toggle {
  position: absolute;
  z-index: 5;
  right: 2%;
  bottom: 2%;
}

.reading {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(12rem, 0.65fr) minmax(22rem, 1.35fr) minmax(18rem, 0.8fr);
  align-items: center;
  gap: 2rem;
  min-height: 8.5rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

.reading header { align-self: start; }

.reading-result {
  margin-top: 0.7rem;
  color: var(--muted);
}

.reading-result strong {
  color: var(--unknown);
  font-weight: 400;
}

.reading-copy {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 2.6vw, 2.8rem);
  letter-spacing: -0.035em;
  line-height: 1;
}

.inspect {
  display: grid;
  justify-items: start;
  gap: 0.7rem;
}

.inspect p {
  min-height: 1.1rem;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  line-height: 1.5;
}

.section-marker {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
}

.section-marker span {
  color: var(--signal);
}

.section-marker::after {
  content: "";
  width: 3rem;
  border-top: 1px solid var(--line-hot);
}

.argument,
.evidence,
.protocol {
  padding: clamp(5rem, 10vw, 10rem) 0;
  border-bottom: 1px solid var(--line);
}

.argument {
  display: grid;
  grid-template-columns: 0.56fr 1fr 0.72fr;
  gap: clamp(2rem, 5vw, 6rem);
}

.argument > .section-marker { grid-column: 1 / -1; }

.argument h2,
.evidence h2,
.protocol h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 6.5vw, 7rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.88;
}

.argument-thesis {
  margin: 2rem 0 0;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.65;
  text-transform: uppercase;
}

.argument-copy {
  align-self: end;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1.9vw, 1.85rem);
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.argument-copy p:first-child { margin-top: 0; }
.argument-copy p:last-child { margin-bottom: 0; color: var(--muted); }

.limits {
  display: grid;
  align-self: end;
  border-top: 1px solid var(--line);
}

.limits article {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.limits h3 { color: var(--signal); }

.limits p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.evidence-head {
  display: grid;
  grid-template-columns: 0.42fr 1fr 0.42fr;
  align-items: end;
  gap: clamp(2rem, 5vw, 6rem);
}

.sample-note {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.6;
  text-transform: uppercase;
}

.gate-metrics {
  margin: clamp(3rem, 6vw, 6rem) 0 3rem;
  display: grid;
  grid-template-columns: 1.25fr repeat(5, 1fr);
  border-top: 1px solid var(--line-hot);
  border-bottom: 1px solid var(--line-hot);
}

.gate-metrics div {
  min-width: 0;
  padding: 1.1rem 1rem 1.35rem;
  border-right: 1px solid var(--line);
}

.gate-metrics div:first-child { padding-left: 0; }
.gate-metrics div:last-child { border-right: 0; }

.gate-metrics dt {
  min-height: 2.5em;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.3;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.gate-metrics dd {
  margin: 0.5rem 0 0;
  font-family: var(--sans);
  font-size: clamp(2.2rem, 4.5vw, 5rem);
  font-variant-numeric: tabular-nums;
  font-weight: 620;
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.gate-metrics [data-k="human"] dd { color: var(--human); }
.gate-metrics [data-k="bot"] dd { color: var(--bot); }
.gate-metrics [data-k="ai"] dd { color: var(--ai); }
.gate-metrics [data-k="verified"] dd { color: var(--verified); }
.gate-metrics [data-k="unknown"] dd { color: var(--unknown); }

.live-source {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: -1.6rem 0 2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.live-source i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0.55rem rgba(206, 255, 25, 0.6);
}

.log-wrap {
  min-height: 19rem;
  padding-left: calc(42% + 1rem);
}

.request-log {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--mono);
  font-size: 0.67rem;
}

.request-log th,
.request-log td {
  padding: 0.7rem 0.4rem;
  border-bottom: 1px solid rgba(51, 50, 45, 0.72);
  text-align: left;
  font-weight: 400;
}

.request-log th {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.request-log th:first-child,
.request-log td:first-child { width: 6.5rem; padding-left: 0; }
.request-log th:nth-child(2),
.request-log td:nth-child(2) { width: 12rem; }
.request-log th:nth-child(3),
.request-log td:nth-child(3) { width: 7rem; }
.request-log tr[data-k="human"] td:nth-child(2) { color: var(--human); }
.request-log tr[data-k="bot"] td:nth-child(2) { color: var(--bot); }
.request-log tr[data-k="ai"] td:nth-child(2) { color: var(--ai); }
.request-log tr[data-k="verified"] td:nth-child(2) { color: var(--verified); }
.request-log tr[data-k="unknown"] td:nth-child(2) { color: var(--unknown); }

.method {
  margin-top: 1.5rem;
  margin-left: calc(42% + 1rem);
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.method summary {
  width: fit-content;
  cursor: pointer;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.method-copy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.protocol {
  display: grid;
  grid-template-columns: 0.4fr 0.85fr 0.75fr;
  gap: clamp(2rem, 5vw, 6rem);
  background: linear-gradient(90deg, transparent, rgba(206, 255, 25, 0.018), transparent);
}

.protocol > .section-marker { grid-column: 1 / -1; }

.protocol-title {
  grid-column: 1 / 3;
  position: relative;
}

.protocol-mark {
  margin: 2.5rem 0 0;
  color: var(--line-hot);
  font-family: var(--sans);
  font-size: clamp(4rem, 11vw, 11rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: 0.7;
  white-space: nowrap;
}

.protocol-copy {
  align-self: end;
  color: var(--muted);
  font-size: 0.9rem;
}

.protocol-lede {
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.4vw, 2.3rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.protocol-list {
  margin: 2rem 0 0;
  border-top: 1px solid var(--line);
}

.protocol-list div {
  display: grid;
  grid-template-columns: 3rem 1fr;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.protocol-list dt {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.protocol-list dd {
  margin: 0;
  color: var(--paper);
}

.gate-footer {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.3rem var(--pad) 2.5rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

@keyframes signal {
  0% { box-shadow: 0 0 0 0 rgba(206, 255, 25, 0.4); }
  70% { box-shadow: 0 0 0 0.45rem rgba(206, 255, 25, 0); }
  100% { box-shadow: 0 0 0 0 rgba(206, 255, 25, 0); }
}

@media (max-width: 1050px) {
  .gate-bar { grid-template-columns: 1fr auto auto; }
  .gate-bar-title { display: none; }
  .gate-hero {
    grid-template-columns: 0.9fr 1.1fr;
    column-gap: 1.5rem;
  }
  .argument { grid-template-columns: 1fr 1fr; }
  .argument-lead { grid-column: 1 / -1; }
  .evidence-head { grid-template-columns: 1fr 1fr; }
  .evidence-head .section-marker { grid-column: 1 / -1; }
  .gate-metrics { grid-template-columns: repeat(3, 1fr); }
  .gate-metrics div:nth-child(3) { border-right: 0; }
  .gate-metrics div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .log-wrap,
  .method { margin-left: 0; padding-left: 0; }
}

@media (max-width: 760px) {
  body { background-size: 100% 7rem, auto, auto; }
  .gate-bar { grid-template-columns: 1fr auto; }
  .gate-bar time { display: none; }
  .gate-main { padding: 0; }
  .gate-hero {
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 4.5rem var(--pad) 0;
  }
  .hero-copy { padding: 0; }
  .hero-copy h1 {
    margin-top: 1.2rem;
    font-size: clamp(4.5rem, 20.5vw, 7.3rem);
  }
  .hero-copy h1 span:nth-child(1) { font-size: 0.43em; }
  .gate-deck { max-width: 28rem; }
  .world {
    order: 2;
    width: calc(100% + 1rem);
    margin: 2rem -0.5rem 0;
  }
  .reading {
    order: 3;
    display: block;
    padding: 1.4rem 0 2rem;
  }
  .reading-copy { margin: 1.4rem 0; }
  .argument,
  .evidence,
  .protocol {
    margin: 0 var(--pad);
    padding: 5rem 0;
  }
  .argument,
  .protocol { display: block; }
  .argument > *,
  .protocol > * { margin-top: 2.5rem; }
  .argument > .section-marker,
  .protocol > .section-marker { margin-top: 0; }
  .limits { margin-top: 3rem; }
  .evidence-head { display: block; }
  .evidence-head h2 { margin-top: 2.5rem; }
  .sample-note { margin-top: 1.5rem; }
  .protocol-title { margin-top: 2.5rem; }
  .protocol-mark { white-space: normal; }
  .gate-footer { display: grid; gap: 0.5rem; }
}

@media (max-width: 520px) {
  .gate-brand { font-size: 0.58rem; }
  .gate-link { font-size: 0.58rem; }
  .hero-copy h1 { line-height: 0.75; }
  .gate-deck { font-size: 1.75rem; }
  .world {
    aspect-ratio: 0.95;
    margin-top: 1rem;
  }
  .world figcaption {
    left: 0;
    max-width: calc(100% - 7rem);
  }
  .motion-toggle { right: 0; }
  .argument h2,
  .evidence h2,
  .protocol h2 { font-size: clamp(3.4rem, 17vw, 5rem); }
  .argument-copy { font-size: 1.35rem; }
  .limits article { grid-template-columns: 5.2rem 1fr; }
  .gate-metrics { grid-template-columns: 1fr 1fr; }
  .gate-metrics div,
  .gate-metrics div:nth-child(3) {
    padding-left: 0.7rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .gate-metrics div:nth-child(even) { border-right: 0; }
  .gate-metrics div:nth-last-child(-n+2) { border-bottom: 0; }
  .gate-metrics div:first-child { padding-left: 0.7rem; }
  .gate-metrics dt { min-height: auto; }
  .log-wrap { min-height: 17rem; }
  .request-log th:first-child,
  .request-log td:first-child { width: 5.3rem; }
  .request-log th:nth-child(2),
  .request-log td:nth-child(2) { width: auto; }
  .request-log th:nth-child(3),
  .request-log td:nth-child(3) { width: 3.4rem; }
  .request-log th:nth-child(4),
  .request-log td:nth-child(4) { display: none; }
  .method-copy { grid-template-columns: 1fr; gap: 0; }
  .protocol-mark { font-size: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gate-link i { animation: none !important; }
  .motion-toggle { display: none; }
}
