:root {
  --ink: #081111;
  --ink-raised: #0d1b1a;
  --ink-panel: #102322;
  --line: #28413e;
  --line-bright: #55736f;
  --paper: #e6f0ed;
  --muted: #9cb5ae;
  --mint: #8ed6ac;
  --cyan: #75d9eb;
  --violet: #ba9ae7;
  --amber: #edbb68;
  --rose: #e17a96;
  --shadow: rgba(0, 0, 0, 0.42);
  --mono: "SF Mono", "Menlo", "Monaco", monospace;
  --display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Avenir Next", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--body);
  letter-spacing: 0;
}

button,
a,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.atlas-shell {
  min-height: 100vh;
  overflow: clip;
  background: var(--ink);
}

.et-home-link {
  position: fixed;
  z-index: 30;
  right: 16px;
  bottom: 16px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(8, 17, 17, 0.92);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.et-home-link:hover,
.et-home-link:focus-visible {
  border-color: var(--mint);
  color: var(--mint);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 17, 17, 0.95);
  backdrop-filter: blur(18px);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  width: fit-content;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
}

.wordmark-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--mint);
  color: var(--mint);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}

.wordmark small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.topnav {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  background: #0b1716;
}

.nav-link,
.source-toggle,
.frame-tab,
.reason-toggle {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-link {
  min-height: 34px;
  padding: 0 12px;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
  background: var(--mint);
}

.source-toggle {
  justify-self: end;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-bright);
  color: var(--cyan);
}

.source-toggle:hover,
.source-toggle[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--ink);
  background: var(--cyan);
}

main {
  display: grid;
  gap: 0;
}

.overview-band,
.evidence-band,
.truth-surface,
.source-map {
  padding-inline: clamp(18px, 4vw, 64px);
}

.overview-band {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) minmax(240px, 0.55fr);
  gap: clamp(20px, 4vw, 64px);
  align-items: end;
  padding-top: 58px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.section-kicker,
.label,
.object-kind {
  display: block;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.overview-copy h1 {
  max-width: 760px;
  margin: 7px 0 16px;
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 70px);
  font-weight: 500;
  line-height: 0.96;
}

.overview-copy p,
.section-header p,
.source-map-heading p {
  max-width: 730px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.truth-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  padding-bottom: 3px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.legend-item i,
.state-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
}

.legend-item.built {
  color: var(--mint);
}

.legend-item.evidenced {
  color: var(--cyan);
}

.legend-item.specified {
  color: var(--violet);
}

.legend-item.open {
  color: var(--amber);
}

.world-surface {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.75fr) minmax(260px, 0.8fr);
  min-height: 720px;
  border-bottom: 1px solid var(--line);
}

.status-rail,
.frame-control {
  padding: 28px clamp(18px, 2.5vw, 38px);
  background: #0b1716;
}

.status-rail {
  border-right: 1px solid var(--line);
}

.frame-control {
  border-left: 1px solid var(--line);
}

.rail-header,
.frame-control-header,
.aperture-topline,
.aperture-footer,
.section-header,
.truth-row,
.source-map-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.state-dot {
  color: var(--mint);
  box-shadow: 0 0 0 5px rgba(142, 214, 172, 0.12);
}

.object-sheet {
  padding: 31px 0 26px;
  border-bottom: 1px solid var(--line);
}

.object-sheet h2 {
  margin: 8px 0 21px;
  font-family: var(--display);
  font-size: 32px;
  font-weight: 500;
}

.object-sheet dl {
  display: grid;
  gap: 15px;
  margin: 0;
}

.object-sheet dl div {
  display: grid;
  gap: 3px;
}

.object-sheet dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.object-sheet dd {
  margin: 0;
  color: var(--paper);
  font-size: 13px;
  line-height: 1.35;
}

.reason-toggle {
  width: 100%;
  min-height: 44px;
  margin-top: 22px;
  border: 1px solid var(--line-bright);
  color: var(--cyan);
  text-align: left;
  padding: 0 13px;
}

.reason-toggle:hover {
  border-color: var(--cyan);
  background: #0f2828;
}

.render-reason {
  margin-top: 12px;
  padding: 12px;
  border-left: 2px solid var(--cyan);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.adapter-path {
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.adapter-path ol {
  display: grid;
  gap: 12px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: adapter;
}

.adapter-path li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.adapter-path li::before {
  counter-increment: adapter;
  content: "0" counter(adapter);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 10px;
}

.reference-aperture {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 52px);
  background: var(--ink-raised);
}

.aperture-topline {
  align-items: flex-end;
  padding-bottom: 20px;
}

.aperture-topline h2,
.section-header h2,
.source-map-heading h2 {
  margin: 7px 0 0;
  font-family: var(--display);
  font-size: clamp(25px, 2.2vw, 37px);
  font-weight: 500;
  line-height: 1.05;
}

.evidence-badge,
.truth-state {
  align-self: flex-start;
  padding: 7px 8px;
  border: 1px solid currentColor;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.aperture-media-wrap {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--line-bright);
  background: #061111;
  box-shadow: 0 22px 60px var(--shadow);
}

.aperture-media {
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
  opacity: 0.86;
  filter: saturate(0.9) contrast(1.06);
  transition: opacity 180ms ease, transform 400ms ease;
}

.aperture-media-wrap:hover .aperture-media {
  opacity: 0.98;
  transform: scale(1.015);
}

.aperture-scanline {
  position: absolute;
  inset: 15% 0 auto;
  height: 1px;
  background: rgba(142, 214, 172, 0.62);
  box-shadow: 0 0 18px rgba(142, 214, 172, 0.55);
}

.anchor-marker {
  position: absolute;
  display: grid;
  gap: 5px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.anchor-marker span {
  width: 22px;
  height: 22px;
  border: 2px solid var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(142, 214, 172, 0.13);
}

.anchor-marker b {
  font-weight: 600;
  text-shadow: 0 2px 8px #000;
}

.anchor-marker-primary {
  top: 42%;
  left: 37%;
}

.anchor-marker-secondary {
  right: 12%;
  bottom: 27%;
}

.anchor-marker-secondary span {
  border-color: var(--cyan);
  box-shadow: 0 0 0 7px rgba(117, 217, 235, 0.13);
}

.aperture-caption {
  position: absolute;
  right: 18px;
  bottom: 14px;
  max-width: 360px;
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid var(--mint);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.4;
  text-shadow: 0 2px 10px #000;
}

.aperture-footer {
  padding-top: 19px;
}

.aperture-footer div {
  display: grid;
  gap: 5px;
}

.aperture-footer .label {
  color: var(--muted);
  font-size: 8px;
}

.aperture-footer strong {
  max-width: 190px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.frame-control-header output {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
}

.frame-tabs {
  display: grid;
  gap: 7px;
  margin-top: 26px;
}

.frame-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--paper);
  text-align: left;
}

.frame-tab:hover,
.frame-tab.is-active {
  border-color: var(--mint);
  color: var(--ink);
  background: var(--mint);
}

.frame-number {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.frame-tab.is-active .frame-number {
  color: var(--ink);
}

.frame-scrubber {
  width: 100%;
  margin: 26px 0 21px;
  accent-color: var(--mint);
}

.frame-readout {
  display: grid;
  gap: 8px;
  padding: 17px 0 25px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.frame-readout p {
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: 26px;
}

.frame-readout span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.precedent-tile {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 13px;
  align-items: start;
  margin-top: 28px;
}

.precedent-tile img {
  width: 64px;
  height: 86px;
  object-fit: cover;
  border: 1px solid var(--line-bright);
}

.precedent-tile p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.evidence-band,
.truth-surface,
.source-map {
  padding-top: 64px;
  padding-bottom: 68px;
  border-bottom: 1px solid var(--line);
}

.evidence-band {
  background: #0b1716;
}

.section-header {
  align-items: flex-end;
  margin-bottom: 28px;
}

.section-header > p {
  max-width: 350px;
  font-size: 14px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.evidence-item {
  display: grid;
  grid-template-rows: 200px auto auto;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 180ms ease;
}

.evidence-item:hover {
  background: #112321;
}

.evidence-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border: 1px solid var(--line-bright);
}

.evidence-item span {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}

.evidence-item small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.evidence-item.current small {
  color: var(--mint);
}

.evidence-item.design small {
  color: var(--violet);
}

.evidence-item.precedent small {
  color: var(--cyan);
}

.truth-surface {
  background: var(--ink-raised);
}

.truth-header {
  align-items: flex-end;
}

.truth-grid {
  border-top: 1px solid var(--line);
}

.truth-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.34fr) minmax(0, 1fr) minmax(110px, 0.2fr);
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.truth-state {
  justify-self: start;
}

.truth-state.built {
  color: var(--mint);
}

.truth-state.evidenced {
  color: var(--cyan);
}

.truth-state.specified {
  color: var(--violet);
}

.truth-state.open {
  color: var(--amber);
}

.truth-row h3 {
  margin: 0 0 7px;
  font-size: 17px;
}

.truth-row p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.truth-row a,
.source-map-footer a {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.truth-row a:hover,
.source-map-footer a:hover {
  color: var(--paper);
}

.source-map {
  background: #071010;
}

.source-map-heading {
  max-width: 780px;
}

.source-lines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 40px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.source-node {
  display: grid;
  gap: 12px;
  min-height: 194px;
  padding: 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease;
}

.source-node:hover {
  background: #102220;
}

.node-mark {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.source-node strong {
  align-self: end;
  font-size: 16px;
  line-height: 1.2;
}

.source-node small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.source-node.canonical {
  border-top: 3px solid var(--mint);
}

.source-node.imported {
  border-top: 3px solid var(--violet);
}

.source-node.registered {
  border-top: 3px solid var(--amber);
}

.source-map-footer {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-top: 22px;
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 64px);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

[data-source]::after {
  content: attr(data-source);
  display: none;
  margin-top: 10px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

body.show-sources [data-source]::after {
  display: block;
}

body.show-sources [data-source] {
  outline: 1px solid var(--cyan);
  outline-offset: 4px;
}

@media (max-width: 1120px) {
  html {
    scroll-padding-top: 132px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topnav {
    order: 3;
    grid-column: 1 / -1;
    justify-self: stretch;
    margin-top: 10px;
  }

  .topnav .nav-link {
    flex: 1;
  }

  .overview-band {
    grid-template-columns: 1fr 1.8fr;
  }

  .truth-legend {
    grid-column: 1 / -1;
  }

  .world-surface {
    grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.55fr);
  }

  .frame-control {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 0.6fr 1fr 1fr;
    gap: 22px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .frame-control-header {
    grid-column: 1 / -1;
  }

  .frame-tabs,
  .frame-scrubber {
    margin-top: 0;
  }

  .precedent-tile {
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 0;
  }

  .wordmark small {
    display: none;
  }

  .source-toggle {
    min-height: 32px;
    padding: 0 9px;
    font-size: 10px;
  }

  .overview-band {
    grid-template-columns: 1fr;
    padding-top: 37px;
    padding-bottom: 34px;
  }

  .overview-copy h1 {
    font-size: 42px;
  }

  .world-surface {
    display: block;
    min-height: 0;
  }

  .status-rail,
  .frame-control {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-rail {
    padding-bottom: 28px;
  }

  .reference-aperture {
    min-height: 630px;
  }

  .aperture-media-wrap,
  .aperture-media {
    min-height: 400px;
  }

  .aperture-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aperture-footer div:last-child {
    grid-column: 1 / -1;
  }

  .frame-control {
    display: grid;
    grid-template-columns: 1fr;
  }

  .evidence-grid,
  .source-lines {
    grid-template-columns: 1fr 1fr;
  }

  .truth-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .truth-row a {
    justify-self: start;
  }

  .section-header,
  .truth-header {
    display: grid;
  }

  .footer-bar {
    display: grid;
  }
}

@media (max-width: 500px) {
  .topnav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    overflow: visible;
  }

  .topnav .nav-link {
    min-width: 0;
    min-height: 42px;
    padding: 0 4px;
    font-size: 9px;
    line-height: 1.2;
    white-space: normal;
  }

  .overview-copy h1 {
    font-size: 36px;
  }

  .truth-legend,
  .evidence-grid,
  .source-lines {
    grid-template-columns: 1fr;
  }

  .reference-aperture {
    padding-inline: 18px;
  }

  .aperture-topline {
    display: grid;
  }

  .aperture-caption {
    left: 14px;
    right: auto;
    max-width: calc(100% - 28px);
  }

  .anchor-marker-secondary {
    right: 7%;
  }
}
