:root {
  --ink: #0a1626;
  --ink-deep: #06101d;
  --paper: #f0eadb;
  --paper-dim: #cfc6b3;
  --ice: #b9e4e2;
  --signal: #e65f4f;
  --brass: #e2b95f;
  --line: rgba(240, 234, 219, 0.2);
  --line-dark: rgba(10, 22, 38, 0.2);
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Baskerville", "Palatino Linotype", serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  padding: .6rem .8rem;
  background: var(--paper);
  color: var(--ink);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1200px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.5rem 0 1.1rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.wordmark { text-decoration: none; }

.wordmark span { color: var(--ice); }

.language-switch { display: flex; gap: .7rem; }

.language-switch a { text-decoration: none; }

.language-switch a[aria-current="page"] {
  color: var(--brass);
  text-decoration: underline;
  text-underline-offset: .25rem;
}

main { overflow: hidden; }

.hero,
.section-shell,
.site-footer {
  width: min(1200px, calc(100% - 3rem));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(400px, 1.14fr);
  gap: clamp(2.2rem, 7vw, 7rem);
  align-items: center;
  min-height: 720px;
  padding: clamp(4rem, 9vw, 8.5rem) 0 5rem;
}

.eyebrow,
.micro-label,
.section-kicker,
.source-label {
  margin: 0 0 1rem;
  color: var(--brass);
  font-family: var(--mono);
  font-size: .67rem;
  letter-spacing: .14em;
  line-height: 1.4;
  text-transform: uppercase;
}

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

h1 {
  max-width: 9ch;
  margin-bottom: 1.5rem;
  color: var(--paper);
  font-size: clamp(4rem, 9.5vw, 8.5rem);
  font-weight: 700;
  letter-spacing: -.08em;
  line-height: .82;
  text-transform: uppercase;
}

.hero-dek {
  max-width: 31rem;
  margin-bottom: 2.25rem;
  color: var(--paper-dim);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.3;
}

.hero-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1rem;
  align-items: end;
  width: min(100%, 25rem);
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.hero-stat strong {
  grid-row: 1 / span 2;
  color: var(--signal);
  font-family: var(--mono);
  font-size: clamp(3.5rem, 7vw, 6.2rem);
  font-weight: 500;
  letter-spacing: -.1em;
  line-height: .85;
}

.hero-stat span {
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hero-stat .stat-note { align-self: start; max-width: 14rem; }

.instrument {
  position: relative;
  padding: 1.4rem;
  border: 1px solid var(--line);
  background: var(--ink-deep);
  box-shadow: 1.2rem 1.2rem 0 rgba(0, 0, 0, .12);
}

.instrument::before,
.instrument::after {
  position: absolute;
  width: 1.2rem;
  height: 1.2rem;
  content: "";
  pointer-events: none;
}

.instrument::before {
  top: -.35rem;
  left: -.35rem;
  border-top: 1px solid var(--brass);
  border-left: 1px solid var(--brass);
}

.instrument::after {
  right: -.35rem;
  bottom: -.35rem;
  border-right: 1px solid var(--brass);
  border-bottom: 1px solid var(--brass);
}

.instrument-top,
.reading-grid,
.control-row,
.plot-topline,
.section-head,
.site-footer {
  font-family: var(--mono);
}

.instrument-top,
.plot-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--paper-dim);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.instrument-top strong,
.plot-topline strong { color: var(--ice); font-weight: 400; }

.compass-wrap {
  width: min(100%, 510px);
  margin: 1rem auto .4rem;
}

#compass {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.control-row label {
  display: grid;
  gap: .38rem;
  color: var(--paper-dim);
  font-size: .67rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

select,
input[type="range"] { width: 100%; }

select {
  min-height: 2.5rem;
  padding: .45rem .55rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
}

input[type="range"] {
  accent-color: var(--signal);
  cursor: ew-resize;
}

select:focus-visible,
input:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 3px;
}

.reading-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .4rem 1rem;
  align-items: baseline;
  padding: 1.2rem 0 .4rem;
  border-top: 1px solid var(--line);
}

.reading-label {
  color: var(--paper-dim);
  font-size: .67rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.reading-value {
  color: var(--signal);
  font-family: var(--serif);
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -.06em;
  line-height: .95;
}

.reading-note {
  grid-column: 1 / -1;
  max-width: 31rem;
  margin: .25rem 0 0;
  color: var(--paper-dim);
  font-size: .83rem;
}

.section-shell { padding: 6rem 0; }

.dark-rule {
  width: 100%;
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--line);
}

.claim-section {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: clamp(2rem, 9vw, 9rem);
  padding-top: 5.5rem;
  padding-bottom: 5.5rem;
}

.section-head h2,
.history-section h2,
.method-section h2 {
  max-width: 12ch;
  margin-bottom: 1.5rem;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  font-weight: 400;
  letter-spacing: -.07em;
  line-height: .9;
}

.section-copy {
  max-width: 34rem;
  color: var(--paper-dim);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.45;
}

.section-copy strong { color: var(--paper); font-weight: 400; }

.metric-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  padding: 1.1rem 1rem 1.1rem 0;
}

.metric + .metric {
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.metric strong {
  display: block;
  color: var(--ice);
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 400;
}

.metric span {
  display: block;
  margin-top: .35rem;
  color: var(--paper-dim);
  font-size: .76rem;
}

.legend-board {
  align-self: center;
  padding: 2rem;
  border: 1px solid var(--line);
  background: rgba(185, 228, 226, .05);
}

.legend-board h3 {
  margin-bottom: 1.5rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.legend-line {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  align-items: center;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: .75rem;
}

.legend-line::before {
  display: block;
  height: 2px;
  background: var(--paper);
  content: "";
}

.legend-line.mag::before { background: var(--signal); }

.history-section {
  width: 100%;
  padding: 6rem max(1.5rem, calc((100vw - 1200px) / 2)) 7rem;
  background: var(--paper);
  color: var(--ink);
}

.history-inner { width: min(1200px, 100%); margin: 0 auto; }

.history-section .section-kicker { color: #8f3b30; }

.history-section h2 { color: var(--ink); max-width: 9ch; }

.history-intro {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: clamp(2rem, 8vw, 8rem);
  align-items: end;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--line-dark);
}

.history-intro p {
  max-width: 34rem;
  margin-bottom: .5rem;
  color: #394352;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.4;
}

.plot-frame {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(250px, .7fr);
  gap: 2rem;
  align-items: center;
  padding: 3rem 0;
  border-bottom: 1px solid var(--line-dark);
}

#historyPlot {
  display: block;
  width: 100%;
  min-height: 390px;
  aspect-ratio: 1.18;
}

.plot-controls { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }

.plot-controls label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
  color: #394352;
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.plot-controls input { width: 100%; }

.plot-reading {
  display: grid;
  gap: .5rem;
  margin-top: 2rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line-dark);
}

.plot-reading strong {
  color: #9e3f34;
  font-family: var(--serif);
  font-size: 2.8rem;
  font-weight: 400;
  letter-spacing: -.06em;
  line-height: .95;
}

.plot-reading span { color: #394352; font-family: var(--mono); font-size: .72rem; }

.history-table {
  width: 100%;
  margin-top: 2.5rem;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: .76rem;
}

.history-table th,
.history-table td {
  padding: .8rem .4rem .8rem 0;
  border-bottom: 1px solid var(--line-dark);
  text-align: left;
  vertical-align: top;
}

.history-table th { color: #394352; font-weight: 400; text-transform: uppercase; }

.history-table td { color: var(--ink); }

.history-table .year { color: #9e3f34; }

.method-section {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: clamp(2rem, 9vw, 9rem);
  padding-top: 7rem;
  padding-bottom: 7rem;
}

.method-section h2 { max-width: 10ch; }

.method-body { max-width: 38rem; color: var(--paper-dim); font-family: var(--serif); font-size: 1.08rem; }

.method-body p { margin-bottom: 1.25rem; }

.method-body strong { color: var(--paper); font-weight: 400; }

.source-list {
  display: grid;
  gap: .9rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: .76rem;
}

.source-list li {
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}

.source-list a { color: var(--ice); text-underline-offset: .2em; }

.caveat {
  margin-top: 2rem;
  padding: 1rem 1rem 1rem 1.1rem;
  border-left: 2px solid var(--signal);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: .74rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--paper-dim);
  font-size: .67rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.site-footer a { color: var(--ice); }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 4rem; }
  .hero-copy { max-width: 44rem; }
  .claim-section,
  .method-section,
  .history-intro { grid-template-columns: 1fr; gap: 2.5rem; }
  .plot-frame { grid-template-columns: 1fr; }
  #historyPlot { max-width: 650px; margin: 0 auto; }
}

@media (max-width: 560px) {
  .site-header,
  .hero,
  .section-shell,
  .site-footer { width: min(100% - 2rem, 1200px); }
  .site-header { font-size: .6rem; }
  h1 { font-size: clamp(3.9rem, 20vw, 6.3rem); }
  .hero { padding: 3.2rem 0 4.5rem; }
  .instrument { padding: .9rem; box-shadow: .6rem .6rem 0 rgba(0, 0, 0, .12); }
  .control-row { grid-template-columns: 1fr; }
  .section-shell { padding: 4.5rem 0; }
  .claim-section { padding-top: 4rem; padding-bottom: 4.5rem; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric + .metric { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .history-section { padding: 4.5rem 1rem 5rem; }
  #historyPlot { min-height: 280px; }
  .history-table { font-size: .65rem; }
  .history-table th:nth-child(3), .history-table td:nth-child(3) { display: none; }
  .legend-board { padding: 1.2rem; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
