:root {
  color-scheme: light;
  --paper: #f2f3ee;
  --paper-deep: #e8ebe4;
  --ink: #17201e;
  --muted: #66706c;
  --line: rgba(23, 32, 30, 0.17);
  --green: #1d6b62;
  --blue: #4471a8;
  --coral: #d56f56;
  --yellow: #dfb75e;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-underline-offset: 4px; }

button { font: inherit; }

.hero {
  width: min(1680px, calc(100% - 40px));
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0 24px;
}

.hero-copy {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(230px, 300px);
  gap: clamp(18px, 3vw, 54px);
  align-items: end;
  width: 100%;
  min-width: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.collection-mark {
  display: grid;
  gap: 7px;
  align-self: end;
  margin-bottom: 8px;
}

.collection-mark .back-link { margin: 0; }

.collection-mark > span {
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.tile-nav {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-self: end;
  margin-bottom: 5px;
  border: 1px solid var(--line);
}

.tile-nav a {
  min-width: 0;
  padding: 11px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, .46);
  font: 400 15px/1.2 Georgia, "Times New Roman", serif;
  text-align: center;
  text-decoration: none;
}

.tile-nav a + a { border-left: 1px solid var(--line); }
.tile-nav a:hover { background: var(--paper-deep); }
.tile-nav a[aria-current="page"] { background: var(--green); color: white; }
.tile-nav a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.kicker {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 4.8vw, 76px);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: .9;
}

.lede {
  max-width: 420px;
  margin: 10px 0 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(14px, 1.25vw, 19px);
  font-style: italic;
}

.scene-shell,
.viewport,
.scene-vignette {
  position: absolute;
  inset: 0;
}

.scene-shell {
  --scene-rail: 230px;
  position: relative;
  inset: auto;
  width: 100%;
  flex: 1;
  height: auto;
  min-height: min(720px, calc(100svh - 152px));
  contain: layout paint size;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 30, .16);
  border-radius: 8px;
  background: #edf1ef;
  box-shadow: 0 18px 46px rgba(28, 43, 38, .11);
}

.scene-shell::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  right: var(--scene-rail);
  bottom: 0;
  width: 1px;
  background: var(--line);
  pointer-events: none;
}

.viewport {
  right: var(--scene-rail);
  cursor: grab;
}
.viewport:active { cursor: grabbing; }
.viewport canvas { display: block; width: 100%; height: 100%; }

.scene-vignette {
  z-index: 1;
  right: var(--scene-rail);
  pointer-events: none;
  background: linear-gradient(0deg, rgba(237, 241, 239, .78) 0%, transparent 18%);
}

.scene-readout {
  position: absolute;
  z-index: 3;
  top: 38px;
  right: 22px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.scene-readout strong {
  color: var(--ink);
  font: 400 28px/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}

.orientation-panel {
  position: absolute;
  z-index: 3;
  top: 145px;
  right: 20px;
  width: 190px;
  color: var(--muted);
}

.orientation-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.orientation-heading > div:first-child,
.orientation-count {
  display: grid;
}

.orientation-heading span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.orientation-heading strong {
  color: var(--ink);
  font: 400 23px/1.15 Georgia, "Times New Roman", serif;
}

.orientation-heading strong sub,
.matrix-heading strong sub {
  font-size: .58em;
  vertical-align: -.22em;
}

.orientation-heading strong .number-field,
.matrix-heading strong .number-field {
  font-family: inherit;
  font-style: normal;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
}

.orientation-count { justify-items: end; }
.orientation-count b { color: var(--ink); font: 400 17px/1.1 Georgia, "Times New Roman", serif; }

#orientation-plot {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  margin: 10px 0 3px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  outline: none;
}

#orientation-plot:active { cursor: grabbing; }
#orientation-plot:focus-visible { box-shadow: 0 0 0 2px rgba(29, 107, 98, .35); }
#orientation-plot canvas { display: block; width: 100%; height: 100%; }

.orientation-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.orientation-graph-key {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .045em;
  line-height: 1.25;
  text-transform: uppercase;
}

.orientation-graph-key span {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.orientation-graph-key i {
  display: inline-block;
  flex: 0 0 12px;
  width: 12px;
  height: 2px;
  background: var(--ink);
}

.orientation-matrix {
  margin-top: 11px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 0 7px;
}

.matrix-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.matrix-heading span {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.matrix-heading strong {
  color: var(--ink);
  font: 400 12px/1.2 Georgia, "Times New Roman", serif;
}

.matrix-expression {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 7px;
  color: var(--ink);
}

.matrix-factor {
  display: inline-grid;
  min-width: 21px;
  align-items: center;
  text-align: center;
  font: 400 14px/1 Georgia, "Times New Roman", serif;
}

.matrix-factor:empty { display: none; }

.dyadic-numerator {
  padding: 0 4px 2px;
  border-bottom: 1px solid currentColor;
}

.dyadic-denominator { padding: 2px 4px 0; }

.matrix-values {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(18px, auto));
  gap: 2px 7px;
  padding: 2px 8px;
  text-align: right;
  font: 400 13px/1.15 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.matrix-values::before,
.matrix-values::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.matrix-values::before { left: 0; border-left: 1px solid var(--ink); }
.matrix-values::after { right: 0; border-right: 1px solid var(--ink); }

.orientation-matrix p {
  margin: 6px 0 0;
  color: var(--muted);
  font: 400 8px/1.35 Georgia, "Times New Roman", serif;
  text-align: center;
}

.orientation-panel.has-selection > p { display: none; }
.orientation-panel.has-selection ~ .scene-instruction { display: none; }

.effect-control {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.effect-control > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.effect-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, .5);
  padding: 6px 7px;
  color: var(--ink);
  font: 600 10px/1.2 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.orientation-panel > p {
  margin: 13px 0 0;
  color: var(--muted);
  font: italic 400 11px/1.45 Georgia, "Times New Roman", serif;
}

.readout-divider {
  grid-column: 1 / -1;
  height: 1px;
  margin: 6px 0;
  background: var(--line);
}

.scene-instruction {
  position: absolute;
  z-index: 3;
  right: 20px;
  width: 190px;
  bottom: 78px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.scene-actions {
  position: absolute;
  z-index: 5;
  left: calc((100% - var(--scene-rail)) / 2);
  bottom: 34px;
  display: grid;
  grid-template-columns: minmax(120px, .72fr) minmax(250px, 1.45fr);
  width: min(570px, calc(100% - var(--scene-rail) - 44px));
  transform: translateX(-50%);
}

.scene-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: rgba(255, 255, 255, .9);
  padding: 12px 17px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(9px);
  transition: background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.scene-button + .scene-button { border-left: 0; }
.scene-button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.scene-button:disabled { cursor: default; opacity: .42; }
.scene-button b { font-size: 20px; font-weight: 400; }
.back-button { background: rgba(237, 241, 239, .88); }

.essay-section,
.catalog-section,
footer {
  width: min(1200px, calc(100% - 44px));
  margin: 0 auto;
}

.essay-section {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) minmax(0, 850px) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  padding: clamp(70px, 10vw, 140px) 0;
}

.section-number {
  color: var(--muted);
  font: 400 14px/1 Georgia, "Times New Roman", serif;
}

.essay-copy { grid-column: 2; }

h2 {
  margin-bottom: 30px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(39px, 5.5vw, 72px);
  font-weight: 400;
  letter-spacing: -.05em;
  line-height: .98;
}

.body-large {
  max-width: 780px;
  margin-bottom: 52px;
  color: #38423f;
  font: 400 clamp(19px, 2.2vw, 28px)/1.5 Georgia, "Times New Roman", serif;
}

.math { font-style: italic; white-space: nowrap; }

.turn-diagram {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(210px, 1.1fr);
  gap: 22px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 27px 0;
}

.turn-card { display: grid; grid-template-columns: 48px 1fr; column-gap: 12px; align-items: center; }
.turn-card strong { font: 400 25px/1 Georgia, "Times New Roman", serif; }
.turn-card small { grid-column: 2; color: var(--muted); font-size: 11px; }
.turn-glyph { grid-row: 1 / 3; width: 40px; height: 40px; border: 2px solid var(--blue); border-left-color: transparent; border-radius: 50%; }
.third-turn { border-color: var(--coral); border-bottom-color: transparent; transform: rotate(-28deg); }
.turn-join { color: var(--muted); font: 400 24px/1 Georgia, "Times New Roman", serif; }
.turn-result { border-left: 1px solid var(--line); padding-left: 24px; }
.turn-result span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.turn-result strong { display: block; margin-top: 4px; font: 400 24px/1.2 Georgia, "Times New Roman", serif; }

.matching-section { padding-bottom: clamp(85px, 12vw, 160px); }

.search-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}

.search-flow > div { min-height: 156px; border-top: 2px solid var(--ink); padding-top: 14px; }
.search-flow span { display: block; margin-bottom: 25px; color: var(--green); font: 400 14px/1 Georgia, "Times New Roman", serif; }
.search-flow strong { display: block; margin-bottom: 7px; font-size: 14px; }
.search-flow small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.search-flow > i { color: var(--muted); font-style: normal; }

.key-idea {
  max-width: 680px;
  margin: 64px 0 0 auto;
  border-left: 3px solid var(--green);
  padding: 4px 0 4px 24px;
}

.key-idea p:last-child { margin: 0; font: 400 22px/1.5 Georgia, "Times New Roman", serif; }

.catalog-section { padding: clamp(70px, 10vw, 130px) 0; }

.catalog-heading {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
  gap: 40px;
  align-items: end;
  margin-bottom: 48px;
}

.catalog-heading h2 { margin: 0; }
.catalog-heading > p { margin: 0 0 7px; color: var(--muted); }

.specimen-list { border-top: 1px solid var(--ink); }

.specimen-list article {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 25px 0 28px;
}

.specimen-index { color: var(--green); font: 400 18px/1 Georgia, "Times New Roman", serif; }
.specimen-list h3 { margin: 0 0 7px; font: 400 28px/1.1 Georgia, "Times New Roman", serif; }
.specimen-list p { max-width: 700px; margin: 0; color: var(--muted); }
.specimen-tag { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 36px;
  border-top: 1px solid var(--ink);
  padding: 26px 0 54px;
  color: var(--muted);
  font-size: 11px;
}

footer p { margin: 0; }

@media (max-width: 980px) {
  .hero {
    width: min(100% - 24px, 900px);
    min-height: 100svh;
    gap: 15px;
    padding: 15px 0 22px;
  }
  .hero-copy {
    grid-template-columns: 120px minmax(0, 1fr) minmax(205px, 240px);
    gap: 7px 18px;
    align-items: end;
    padding: 0 5px;
  }
  .collection-mark { margin: 0 0 7px; }
  .title-block { min-width: 0; }
  .title-block .kicker { margin-bottom: 5px; }
  h1 { font-size: clamp(38px, 8.5vw, 64px); }
  .lede { margin-top: 7px; font-size: 14px; }
  .scene-shell { min-height: min(760px, calc(100svh - 142px)); }
  .scene-shell { --scene-rail: 0px; }
  .scene-shell::after {
    display: block;
    top: auto;
    right: 0;
    bottom: 250px;
    left: 0;
    width: auto;
    height: 1px;
  }
  .viewport,
  .scene-vignette { bottom: 250px; }
  .scene-readout { top: auto; right: 18px; bottom: 155px; }
  .orientation-panel {
    top: auto;
    right: auto;
    bottom: 14px;
    left: 18px;
    width: 145px;
  }
  .orientation-heading strong { font-size: 18px; }
  .orientation-count b { font-size: 14px; }
  .orientation-panel > p { display: none; }
  .orientation-panel.has-selection #orientation-plot {
    width: 92px;
    margin: 2px auto;
  }
  .orientation-panel.has-selection .orientation-graph-key { display: none; }
  .orientation-panel.has-selection .effect-control { display: none; }
  .orientation-panel.has-selection .orientation-matrix { margin-top: 5px; padding-block: 5px; }
  .orientation-panel.has-selection .matrix-heading span { display: none; }
  .orientation-panel.has-selection .matrix-values { gap: 1px 4px; font-size: 11px; }
  .scene-instruction { right: 18px; bottom: 24px; left: auto; width: 150px; }
  .scene-actions {
    bottom: 270px;
    left: 50%;
    grid-template-columns: minmax(105px, .65fr) minmax(210px, 1.35fr);
    width: min(540px, calc(100% - 32px));
  }
}

@media (max-width: 760px) {
  .scene-actions { grid-template-columns: 112px minmax(0, 1fr); }
  .scene-button { gap: 10px; padding-inline: 12px; font-size: 11px; }
  .hero-copy { grid-template-columns: 1fr; }
  .collection-mark { display: flex; margin: 0; justify-content: space-between; align-items: center; }
  .collection-mark .back-link { display: inline-block; }
  .tile-nav { margin: 4px 0 0; }
  h1 { font-size: clamp(37px, 11vw, 55px); }
  .essay-section { grid-template-columns: 42px minmax(0, 1fr); }
  .essay-copy { grid-column: 2; }
  .turn-diagram { grid-template-columns: 1fr 1fr; }
  .turn-join { display: none; }
  .turn-result { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; padding: 18px 0 0; }
  .search-flow { grid-template-columns: 1fr; }
  .search-flow > i { transform: rotate(90deg); justify-self: center; }
  .search-flow > div { min-height: 0; }
  .catalog-heading { grid-template-columns: 1fr; }
  .specimen-list article { grid-template-columns: 34px minmax(0, 1fr); gap: 15px; }
  .specimen-tag { grid-column: 2; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
