:root {
  --color-primary: #161616;
  --color-on-primary: #ffffff;
  --color-secondary: #3a3a3a;
  --color-accent: #6b5400;
  --color-on-accent: #ffffff;
  --color-background: #ffffff;
  --color-foreground: #161616;
  --color-card: #ffffff;
  --color-muted: #f4f4f4;
  --color-muted-foreground: #4d4d4d;
  --color-border: #e2e2e2;
  --color-destructive: #dc2626;
  --color-ring: #161616;
  --yellow: #f5c400;
  --paper: var(--color-background);
  --paper-2: var(--color-muted);
  --ink: var(--color-foreground);
  --muted: var(--color-muted-foreground);
  --rule: var(--color-border);
  --green: var(--color-primary);
  --green-deep: #000000;
  --sap: #f4f4f4;
  --ochre: var(--color-accent);
  --ochre-soft: #fef3c7;
  --seal: var(--color-destructive);
  --white: var(--color-card);
  --on-primary: var(--color-on-primary);
  --pop-border: #1e3a5f;
  --pop-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  --link: var(--color-primary);
  --serif: "Crimson Pro", "Iowan Old Style", Palatino, Georgia, serif;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --sans: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Courier New", monospace;
  --wrap: 1120px;
  --header-offset: 0px;
  color-scheme: light;
}

html[data-theme="night"] {
  --color-primary: #f4f4f4;
  --color-on-primary: #111111;
  --color-secondary: #e4e4e4;
  --color-accent: #f5c400;
  --color-background: #0c0c0c;
  --color-foreground: #f4f4f4;
  --color-card: #161616;
  --color-muted: #1a1a1a;
  --color-muted-foreground: #cfcfcf;
  --color-border: #2c2c2c;
  --color-ring: #f5c400;
  --yellow: #f5c400;
  --paper: var(--color-background);
  --paper-2: #161616;
  --ink: var(--color-foreground);
  --muted: var(--color-muted-foreground);
  --rule: var(--color-border);
  --green: var(--color-primary);
  --green-deep: #ffffff;
  --sap: #1a1a1a;
  --ochre: var(--color-accent);
  --ochre-soft: #2a2412;
  --seal: #f0b4b0;
  --white: var(--color-card);
  --on-primary: #111111;
  --pop-border: #d0d0d0;
  --pop-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  --link: #f4f4f4;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="day"]):not([data-theme="night"]) {
    --color-primary: #f4f4f4;
    --color-on-primary: #111111;
    --color-accent: #f5c400;
    --color-background: #0c0c0c;
    --color-foreground: #f4f4f4;
    --color-card: #161616;
    --color-muted: #1a1a1a;
    --color-muted-foreground: #cfcfcf;
    --color-border: #2c2c2c;
    --color-ring: #f5c400;
    --yellow: #f5c400;
    --paper: var(--color-background);
    --paper-2: #161616;
    --ink: var(--color-foreground);
    --muted: var(--color-muted-foreground);
    --rule: var(--color-border);
    --green: var(--color-primary);
    --green-deep: #ffffff;
    --sap: #1a1a1a;
    --ochre: var(--color-accent);
    --ochre-soft: #2a2412;
    --seal: #f0b4b0;
    --white: var(--color-card);
    --on-primary: #111111;
    --pop-border: #d0d0d0;
    --pop-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    --link: #f4f4f4;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 8% -10%, rgba(30, 58, 95, 0.08), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(180, 83, 9, 0.09), transparent 28%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.65;
}

html[data-theme="night"] body {
  background-image:
    radial-gradient(circle at 8% -10%, rgba(232, 238, 246, 0.07), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(246, 197, 138, 0.08), transparent 26%);
}

::selection {
  background: var(--color-primary);
  color: var(--on-primary);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, .dek, .index-title, .brand-name {
  text-wrap: balance;
}

.kicker,
figcaption,
.index-dek,
.crumbs {
  text-wrap: pretty;
}

.kicker,
.index-kicker,
.quiz-progress,
time,
.score {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--link);
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 3px;
}

a,
button,
summary,
.codon-cell {
  cursor: pointer;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: 0.55rem 0.9rem;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(var(--wrap), calc(100% - 2.5rem));
  margin-inline: auto;
}

.theme-toggle,
.menu-toggle,
.sub-toggle,
.btn,
button,
summary {
  font-family: inherit;
}

.theme-toggle,
.menu-toggle {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 0.35rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition-property: background-color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.theme-toggle:hover,
.menu-toggle:hover,
.sub-toggle:hover {
  background: var(--ink);
  color: var(--paper);
}

.theme-toggle:active,
.menu-toggle:active,
.btn:active {
  transform: translateY(1px);
}

.brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand tools"
    "tag tools";
  justify-items: start;
  align-items: center;
  gap: 0.15rem 1rem;
  padding: 1.15rem 0 0.85rem;
  text-align: left;
}

.header-tools {
  grid-area: tools;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--green);
}

.mark {
  width: 46px;
  height: 46px;
  display: block;
  flex: none;
}

.brand .mark {
  transform-origin: 50% 85%;
  animation: mark-sway 7s ease-in-out infinite;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.02rem, 2.4vw, 2.05rem);
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.site-header {
  background-color: var(--paper);
  background-image: linear-gradient(to right, rgba(30, 58, 95, 0.06) 1px, transparent 1px);
  background-size: 4.75rem 100%;
  border-bottom: 1px solid var(--rule);
}

html[data-theme="night"] .site-header {
  background-image: linear-gradient(to right, rgba(232, 238, 246, 0.06) 1px, transparent 1px);
}

.frieze {
  padding: 0.15rem 0 0.45rem;
}

.frieze-svg {
  display: block;
  width: 100%;
  height: 52px;
}

.frieze-helix {
  stroke-dasharray: 7 5;
  animation: helix-drift 7s linear infinite;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-brand .mark {
  width: 32px;
  height: 32px;
}

.brand-tag {
  grid-area: tag;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.menu-toggle {
  display: none;
}

.primary {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.primary > ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary > ul > li {
  position: relative;
}

.nav-pair {
  display: flex;
  align-items: stretch;
}

.primary > ul > li > a,
.nav-pair > a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.4rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
}

.primary > ul > li > a:hover,
.nav-pair > a:hover,
.primary a[aria-current="page"] {
  background: var(--sap);
  text-decoration: none;
}

.sub-toggle {
  width: 44px;
  min-width: 44px;
  min-height: 48px;
  border: 0;
  border-left: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}

.sub-toggle::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.has-sub.is-open > .nav-pair {
  background: var(--sap);
}

.submenu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 17.5rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--pop-border);
  box-shadow: var(--pop-shadow);
}

.primary > ul > li:nth-last-child(-n+3) .submenu {
  left: auto;
  right: 0;
}

.submenu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  color: var(--ink);
  text-decoration: none;
}

.submenu a:hover,
.submenu a[aria-current="page"] {
  background: var(--sap);
}

.crumbs {
  padding: 1.25rem 0 0;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.crumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--rule);
}

.crumbs a {
  color: var(--muted);
}

.page-head {
  padding: 1.25rem 0 0.5rem;
}

.kicker {
  margin: 0 0 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  max-width: 16ch;
}

.page-head h1,
.cover h1 {
  max-width: 18ch;
  padding-bottom: 0.45rem;
  background-image:
    linear-gradient(var(--ochre), var(--ochre)),
    linear-gradient(var(--ink), var(--ink));
  background-size: 4.75rem 3px, 100% 1px;
  background-position: left bottom, left bottom;
  background-repeat: no-repeat;
}

h2 {
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  margin-top: 2.4rem;
}

h3 {
  font-size: 1.28rem;
  margin-top: 1.4rem;
}

.dek {
  margin: 1rem 0 0;
  max-width: 42rem;
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.35;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 70ch);
  gap: 2.5rem;
  align-items: start;
  padding-bottom: 3.5rem;
}

.layout-wide {
  grid-template-columns: 13.5rem minmax(0, 1fr);
}

.layout-wide .prose {
  max-width: none;
}

.toc {
  position: sticky;
  top: 1rem;
  padding-top: 0.4rem;
}

.toc p {
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  display: block;
  padding: 0.28rem 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.35;
}

.toc a:hover {
  color: var(--green);
}

.prose > :first-child {
  margin-top: 0;
}

.prose > p:first-of-type::first-letter {
  font-family: var(--serif);
  font-weight: 600;
  float: left;
  font-size: 3.35rem;
  line-height: 0.78;
  padding: 0.12em 0.1em 0 0;
  color: var(--green);
}

.prose p,
.prose li {
  overflow-wrap: break-word;
}

.prose ul,
.prose ol {
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose blockquote {
  margin: 1.6rem 0;
  padding: 0.85rem 1rem 0.95rem 1.15rem;
  border-left: 3px solid var(--ochre);
  background: var(--sap);
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1.35;
}

.prose blockquote::before {
  content: "\\201C";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ochre);
  font-size: 2.6rem;
  line-height: 0.7;
}

.callout {
  margin: 1.5rem 0;
  padding: 0.9rem 1rem 1rem;
  background: var(--ochre-soft);
  border-left: 3px solid var(--ochre);
}

.callout .label {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

figure.plate {
  margin: 1.4rem 0 1.6rem;
  padding: 0.85rem 0.85rem 0.7rem;
  background: var(--white);
  border: 1px solid var(--green);
  box-shadow: inset 0 0 0 7px var(--white), inset 0 0 0 8px var(--rule);
}

figure.plate .accent {
  stroke: var(--ochre);
}

figure.plate svg {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.index {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.index-row {
  border-top: 1px solid var(--rule);
}

.index-row:last-child {
  border-bottom: 1px solid var(--rule);
}

.index-row a {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.35rem 1.25rem;
  align-items: baseline;
  padding: 0.95rem 0.15rem;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}

.index-row a:hover .index-title,
.index-row a:focus-visible .index-title {
  color: var(--green);
}

.index-kicker {
  grid-row: 1 / span 2;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ochre);
}

.index-row a {
  padding-left: 0.75rem;
  box-shadow: inset 3px 0 0 transparent;
  transition-property: background-color, box-shadow, color, transform;
  transition-duration: 180ms;
  transition-timing-function: ease-out;
}

.index-row a:hover,
.index-row a:focus-visible {
  background: var(--sap);
  box-shadow: inset 3px 0 0 var(--ochre);
  transform: translateX(4px);
}

.index-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.index-dek {
  grid-column: 2;
  display: block;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

a.ext::after,
a.out .index-title::after {
  content: " ↗";
  font-size: 0.75em;
}

.cover {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 2.5rem;
  align-items: end;
  padding: 2.2rem 0 1rem;
}

.cover h1 {
  max-width: 11ch;
  font-size: clamp(3rem, 6.4vw, 5.4rem);
}

.cover-lead {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  padding-bottom: 0.2rem;
}

.cover-lead h1 {
  max-width: 14ch;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  background: var(--green);
  color: var(--on-primary);
  border: 1px solid var(--green-deep);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition-property: background-color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

html[data-theme="night"] .btn {
  color: var(--on-primary);
  border-color: var(--green);
}

html[data-theme="night"] .btn-ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--ink);
}

.btn:hover {
  background: var(--green-deep);
  color: var(--paper);
  text-decoration: none;
}

html[data-theme="night"] .btn:hover {
  background: var(--green-deep);
  color: var(--on-primary);
}

html[data-theme="night"] .btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.band {
  margin: 2rem 0;
  padding: 1.4rem 1.3rem 1.5rem;
  background: #1e3a5f;
  color: #f8fafc;
  border-left: 4px solid #b45309;
}

.band .kicker {
  color: #f6c58a;
}

html[data-theme="night"] .band {
  background: #152033;
  color: #f8fafc;
  border: 1px solid #334155;
  border-left: 4px solid #f6c58a;
}

.band h2 {
  margin-top: 0;
  max-width: 20ch;
}

.band p {
  max-width: 48rem;
}

.band a {
  color: inherit;
  font-weight: 700;
}

.section-block {
  padding: 0.5rem 0 1rem;
}

.plate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 0.25rem 0 1.5rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
  padding-bottom: 1rem;
}

.split-note {
  border-top: 1px solid var(--ink);
  padding-top: 1rem;
}

.site-footer {
  border-top: 1px solid var(--ink);
  padding: 2rem 0 2.5rem;
  margin-top: 1rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 1.5rem;
}

.site-footer h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  letter-spacing: 0;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li + li {
  margin-top: 0.3rem;
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--green);
  text-decoration: underline;
}

.legal {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 70ch;
}

.contents-tree,
.contents-tree ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.contents-tree > li {
  border-top: 1px solid var(--rule);
  padding: 0.85rem 0;
}

.contents-tree > li:last-child {
  border-bottom: 1px solid var(--rule);
}

.contents-tree a {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.contents-tree a:hover {
  color: var(--green);
}

.contents-tree ol {
  margin: 0.45rem 0 0.2rem 1rem;
}

.contents-tree ol a {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
}

.contents-tree .index-dek {
  margin: 0.15rem 0 0.45rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 1.2rem 0 0.4rem;
}

label.field {
  display: grid;
  gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1 1 16rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
}

textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
  max-width: 40rem;
  margin-top: 1rem;
}

.tool-panel {
  margin: 1.2rem 0 1.6rem;
  padding: 1rem;
  border: 1px solid var(--ink);
  background: var(--white);
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.7rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  margin: 0.8rem 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.3rem;
  border: 1px solid var(--ink);
  vertical-align: -1px;
}

.kind-nonpolar { background: #fef3c7; }
.kind-polar { background: #e8eef6; }
.kind-acidic { background: #fee2e2; }
.kind-basic { background: #e0e7ff; }
.kind-stop { background: var(--ink); color: var(--paper); }
.kind-start { box-shadow: inset 0 0 0 2px var(--ochre); }

html[data-theme="night"] .kind-nonpolar { background: #4a3a1c; }
html[data-theme="night"] .kind-polar { background: #1a2740; }
html[data-theme="night"] .kind-acidic { background: #4a2424; }
html[data-theme="night"] .kind-basic { background: #1e2a4a; }
html[data-theme="night"] .kind-stop { background: var(--ink); color: var(--paper); }
.kind-invalid { background: transparent; border-style: dashed; }

.code-scroll {
  overflow-x: auto;
  margin-top: 0.6rem;
}

.code-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.code-table th,
.code-table td {
  border: 1px solid var(--rule);
  padding: 0.35rem 0.4rem;
  text-align: center;
  vertical-align: top;
}

.code-table th {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  background: var(--paper-2);
}

.codon-cell {
  cursor: pointer;
  min-width: 5.5rem;
}

.codon-cell strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
}

.codon-cell.is-hit {
  outline: 2px solid var(--ochre);
  outline-offset: -2px;
}

.translate-out {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.8rem;
}

.aa-chip {
  min-width: 4.2rem;
  padding: 0.35rem 0.4rem 0.3rem;
  border: 1px solid var(--rule);
  text-align: center;
}

.aa-chip b {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.aa-chip span {
  font-family: var(--serif);
  font-size: 1rem;
}

.quiz-option {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  margin-top: 0.55rem;
  padding: 0.75rem 0.8rem;
  min-height: 44px;
  border: 1px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.4;
  cursor: pointer;
  transition-property: background-color, border-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.quiz-option:hover {
  background: var(--sap);
}

.quiz-option.is-right {
  background: var(--sap);
  border-color: var(--green);
}

.quiz-option.is-wrong {
  background: var(--ochre-soft);
  border-color: var(--ochre);
}

.quiz-progress {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.score {
  font-family: var(--serif);
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  margin: 0.2rem 0;
}

.review-item {
  padding: 0.9rem 0;
  border-top: 1px solid var(--rule);
}

.review-item p {
  margin: 0.3rem 0;
}

details {
  margin: 0.7rem 0 1rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.6rem;
}

summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--green);
}

.frame {
  margin: 1rem 0 1.4rem;
  border: 1px solid var(--ink);
  background: #111;
  aspect-ratio: 16 / 9;
}

.frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.empty-filter {
  padding: 1rem 0;
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

hr.rule {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 1.5rem 0;
}

@keyframes mark-sway {
  50% { transform: rotate(-3deg); }
}

@keyframes helix-drift {
  to { stroke-dashoffset: -48; }
}

@keyframes drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes bead {
  50% { transform: scale(1.28); }
}

@keyframes packet {
  from { left: -10px; }
  to { left: 100%; }
}

.lab-stage {
  position: relative;
  margin: 0.2rem 0 1.8rem;
  padding: 0.85rem 0.85rem 1rem;
  background-color: var(--white);
  background-image: radial-gradient(var(--rule) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid var(--ink);
  box-shadow: inset 0 0 0 7px var(--white), inset 0 0 0 8px var(--rule);
  overflow: hidden;
}

.orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orbit span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ochre);
  opacity: 0.7;
  animation: drift 8s ease-in-out infinite;
}

.orbit span:nth-child(1) { top: 14%; left: 6%; }
.orbit span:nth-child(2) { top: 22%; left: 46%; animation-delay: -1.4s; width: 5px; height: 5px; }
.orbit span:nth-child(3) { top: 8%; left: 72%; animation-delay: -3s; }
.orbit span:nth-child(4) { top: 70%; left: 18%; animation-delay: -2s; width: 5px; height: 5px; background: var(--ink); }
.orbit span:nth-child(5) { top: 62%; left: 78%; animation-delay: -4.2s; }
.orbit span:nth-child(6) { top: 40%; left: 90%; animation-delay: -5s; width: 4px; height: 4px; }

#cell-stage,
.part-controls,
.viz-readout,
.dogma {
  position: relative;
  z-index: 1;
}

#cell-stage {
  display: block;
  width: 100%;
  height: auto;
}

#cell-stage .part {
  cursor: pointer;
}

#cell-stage .part ellipse,
#cell-stage .part path,
#cell-stage .part circle {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 180ms ease, stroke-width 180ms ease, fill 180ms ease;
}

#cell-stage .hit {
  fill: transparent;
  stroke: none;
}

#cell-stage .part[data-part="membrane"] > ellipse:first-of-type {
  fill: color-mix(in srgb, var(--sap) 78%, var(--white));
  stroke-width: 2.6;
}

#cell-stage .membrane-inner {
  fill: color-mix(in srgb, var(--white) 82%, var(--sap));
  stroke: color-mix(in srgb, var(--ink) 28%, transparent);
}

#cell-stage .er-body {
  fill: color-mix(in srgb, var(--ochre-soft) 70%, var(--white));
}

#cell-stage .part[data-part="er"] circle {
  fill: var(--ink);
  stroke: none;
}

#cell-stage .part[data-part="mitochondrion"] > ellipse {
  fill: color-mix(in srgb, var(--sap) 50%, var(--white));
}

#cell-stage .part[data-part="nucleus"] > ellipse {
  fill: color-mix(in srgb, var(--ochre-soft) 55%, var(--white));
}

#cell-stage .nucleolus {
  fill: var(--ochre);
  stroke: none;
}

#cell-stage .part[data-part="ribosomes"] circle:not(.hit) {
  fill: var(--ink);
  stroke: none;
}

#cell-stage .part.is-lit {
  filter: drop-shadow(0 0 6px var(--ochre));
}

#cell-stage .part.is-lit ellipse,
#cell-stage .part.is-lit path,
#cell-stage .part.is-lit circle:not(.hit) {
  stroke: #b45309;
  stroke-width: 2.6;
}

html[data-theme="night"] #cell-stage .part.is-lit ellipse,
html[data-theme="night"] #cell-stage .part.is-lit path,
html[data-theme="night"] #cell-stage .part.is-lit circle:not(.hit) {
  stroke: #f6c58a;
}

#cell-stage .part[data-part="ribosomes"].is-lit circle:not(.hit),
#cell-stage .part[data-part="er"].is-lit circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: bead 1.5s ease-in-out infinite;
}

#helix-model path {
  fill: none;
  stroke: #1e3a5f;
  stroke-width: 2.6;
  stroke-linecap: round;
  transform-box: view-box;
  transform-origin: 0 0;
  transition: transform 700ms ease, opacity 700ms ease;
}

html[data-theme="night"] #helix-model .strand-a,
html[data-theme="night"] #helix-model .new-strand {
  stroke: #e8eef6;
}

#helix-model .strand-b {
  stroke: #b45309;
}

html[data-theme="night"] #helix-model .strand-b {
  stroke: #f6c58a;
}

#helix-model .new-strand {
  opacity: 0;
  stroke-dasharray: 7 6;
}

#helix-model .rungs path {
  stroke: #64748b;
  stroke-width: 1.35;
}

#helix-model .bases circle {
  fill: var(--ochre);
  stroke: none;
  transition: opacity 700ms ease, transform 700ms ease;
}

#helix-model.is-copying .strand-a {
  transform: translate(-4.5%, 0);
}

#helix-model.is-copying .strand-b {
  transform: translate(4.5%, 0);
}

#helix-model.is-copying .new-strand {
  opacity: 0.95;
}

#helix-model.is-copying .new-strand:nth-of-type(3) {
  transform: translate(-8%, 0);
}

#helix-model.is-copying .new-strand:nth-of-type(4) {
  transform: translate(8%, 0);
}

#helix-model.is-copying .rungs {
  opacity: 0.15;
}

#helix-model.is-copying .bases {
  opacity: 0.2;
}

.part-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0.75rem;
}

.part-controls button {
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border: 1px solid #1e3a5f;
  background: var(--white);
  color: #0f172a;
  font-family: var(--sans);
  font-size: 0.98rem;
  cursor: pointer;
}

html[data-theme="night"] .part-controls button {
  background: transparent;
  border-color: #e8eef6;
  color: #f8fafc;
}

.part-controls button[aria-pressed="true"],
html[data-theme="night"] .part-controls button[aria-pressed="true"] {
  background: #1e3a5f;
  border-color: #1e3a5f;
  color: #fff;
}

.viz-readout {
  margin: 0;
  min-height: 6.6rem;
  padding: 0.85rem 1rem;
  background: var(--sap);
  border-left: 4px solid var(--ochre);
}

.dogma {
  display: grid;
  grid-template-columns: auto minmax(2.5rem, 1fr) auto minmax(2.5rem, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  margin: 0.95rem 0.2rem 0.15rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dogma-track {
  position: relative;
  height: 2px;
  background: var(--rule);
  overflow: hidden;
}

.dogma-track b {
  position: absolute;
  top: -3px;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ochre);
  animation: packet 2.6s linear infinite;
}

.dogma-track:nth-of-type(4) b {
  animation-delay: -1.3s;
}

@media (max-width: 900px) {
  .cover,
  .plate-row,
  .home-grid,
  .footer-grid,
  .layout,
  .layout-wide {
    grid-template-columns: 1fr;
  }

  .cover h1,
  h1,
  .page-head h1 {
    max-width: none;
  }

  .toc {
    position: static;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 0.8rem 0;
  }

  .toc ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
  }

  .footer-grid {
    gap: 1.2rem;
  }
}

@media (max-width: 800px) {
  .wrap {
    width: min(var(--wrap), calc(100% - 1.4rem));
  }

  .menu-toggle {
    display: inline-flex;
    margin: 0;
  }

  .brand-row {
    padding-bottom: 0.55rem;
  }

  .brand-name {
    font-size: clamp(0.92rem, 4.4vw, 1.35rem);
  }

  .mark {
    width: 36px;
    height: 36px;
  }

  .primary {
    display: none;
    border-top: 0;
  }

  .primary.is-open {
    display: block;
  }

  .primary > ul {
    flex-direction: column;
    align-items: stretch;
  }

  .primary > ul > li {
    border-top: 1px solid var(--rule);
  }

  .nav-pair,
  .primary > ul > li > a {
    width: 100%;
  }

  .nav-pair > a {
    flex: 1;
  }

  .submenu {
    position: static;
    min-width: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 0.4rem 0.9rem;
  }

  .index-row a {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .index-kicker,
  .index-dek {
    grid-row: auto;
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .theme-toggle,
  .menu-toggle,
  .btn,
  .quiz-option,
  .index-row a,
  #cell-stage .part ellipse,
  #cell-stage .part path,
  #cell-stage .part circle,
  #helix-model path,
  #helix-model .bases circle {
    transition: none;
  }

  .theme-toggle:active,
  .menu-toggle:active,
  .btn:active,
  .index-row a:hover,
  .index-row a:focus-visible {
    transform: none;
  }

  .brand .mark,
  .frieze-helix,
  .orbit span,
  .dogma-track b,
  #cell-stage .part.is-lit circle,
  .hero img,
  .card img {
    animation: none;
  }

  .card:hover img,
  .card:focus-visible img {
    transform: none;
  }
}

@media print {
  .primary,
  .menu-toggle,
  .theme-toggle,
  .toc,
  .skip,
  .site-footer,
  .cover-actions,
  .filter-bar,
  .tool-row,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }

  .band {
    background: #fff;
    color: #000;
    border: 1px solid #000;
  }
}

html {
  overflow-x: clip;
}

body {
  background-image: none;
}

h1,
h2,
h3,
.brand-name,
.index-title,
.card-title {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  background-image: none;
  border-top: 4px solid var(--yellow);
  border-bottom: 1px solid #e4e4e4;
}

html[data-theme="night"] .site-header {
  background: #0c0c0c;
  background-image: none;
  border-bottom-color: #2a2a2a;
}

.brand-row {
  padding: 0.7rem 0 0.35rem;
}

.brand-name {
  font-size: clamp(1.02rem, 2.4vw, 2.05rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: none;
  white-space: nowrap;
}

.brand-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mark {
  width: 34px;
  height: 34px;
}

.primary > ul > li > a,
.nav-pair > a {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  padding-inline: 0.5rem;
}

h2[id],
h3[id] {
  scroll-margin-top: 9rem;
}

.toc {
  top: 8.75rem;
}

.page-head h1,
.cover h1 {
  background-image:
    linear-gradient(var(--yellow), var(--yellow)),
    linear-gradient(currentColor, currentColor);
}

.hero {
  position: relative;
  width: 100%;
  min-height: min(84vh, 780px);
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #111;
  color: #fff;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  animation: hero-drift 32s ease-in-out infinite alternate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.28) 46%, rgba(0, 0, 0, 0.18) 100%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(var(--wrap), calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 4.5rem 0 2.6rem;
}

.hero h1 {
  max-width: 12ch;
  color: #fff;
  background: none;
  font-size: clamp(3.4rem, 8vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero .dek {
  max-width: 36rem;
  color: #f4f4f4;
}

.hero .kicker {
  color: #fff;
}

.kicker::before,
.card-kicker::before {
  content: "";
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  margin-right: 0.45rem;
  background: var(--yellow);
  vertical-align: 0.08em;
}

.hero .btn,
html[data-theme="night"] .hero .btn {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.hero .btn:hover,
html[data-theme="night"] .hero .btn:hover {
  background: var(--yellow);
  color: #111;
  border-color: var(--yellow);
}

.hero .btn-ghost,
html[data-theme="night"] .hero .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

.hero .btn-ghost:hover,
html[data-theme="night"] .hero .btn-ghost:hover {
  background: #fff;
  color: #111;
}

.latest,
.feature-lab {
  padding-top: 2.2rem;
}

.section-label h2 {
  margin-top: 0;
}

.cards {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 1.75rem 1.15rem;
  margin-top: 1.2rem;
}

.card-lead {
  grid-row: auto;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
}

.card:hover,
.card:focus-visible {
  text-decoration: none;
}

.card-media {
  display: block;
  overflow: hidden;
  background: #111;
  aspect-ratio: 3 / 2;
}

.card-lead .card-media {
  aspect-ratio: 3 / 2;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms ease;
}

.card:hover img,
.card:focus-visible img {
  transform: scale(1.045);
}

.card-kicker {
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.card-title {
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  line-height: 1.02;
}

.card-lead .card-title {
  font-size: clamp(1.7rem, 2.4vw, 2.35rem);
}

.card-dek {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.band {
  background: #111;
  color: #f5f5f5;
  border: 0;
  border-left: 6px solid var(--yellow);
}

.band .kicker {
  color: var(--yellow);
}

html[data-theme="night"] .band {
  background: #161616;
  color: #f5f5f5;
  border: 1px solid #2c2c2c;
  border-left: 6px solid var(--yellow);
}

.site-footer {
  background: #111;
  color: #f3f3f3;
  border-top: 4px solid var(--yellow);
}

.site-footer a {
  color: #fff;
}

html[data-theme="night"] .site-footer {
  background: #080808;
}

@keyframes hero-drift {
  to { transform: scale(1.06); }
}

@media (max-width: 1160px) {
  .menu-toggle {
    display: inline-flex;
  }

  .primary {
    display: none;
    border-top: 0;
  }

  .primary.is-open {
    display: block;
  }

  .primary > ul {
    flex-direction: column;
    align-items: stretch;
  }

  .primary > ul > li {
    border-top: 1px solid var(--rule);
  }

  .nav-pair,
  .primary > ul > li > a {
    width: 100%;
  }

  .nav-pair > a {
    flex: 1;
  }

  .submenu {
    position: static;
    min-width: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 0.4rem 0.9rem;
  }
}

@media (max-width: 900px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }

  .card-lead {
    grid-column: auto;
    grid-row: auto;
  }

  .card-lead .card-media {
    aspect-ratio: 3 / 2;
  }
}

.hero-page {
  min-height: min(70vh, 640px);
}

.hero-page h1 {
  max-width: 16ch;
  font-size: clamp(2.8rem, 6.2vw, 5.2rem);
}

.prose .cards {
  grid-template-columns: 1fr 1fr;
}

.layout-wide .prose .cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.index-kicker::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  background: var(--yellow);
  vertical-align: 0.05em;
}

.index-title {
  font-size: clamp(1.55rem, 2vw, 2.05rem);
}

@media (max-width: 800px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 78vh;
  }

  .hero-page {
    min-height: 72vh;
  }

  .hero-copy {
    width: min(var(--wrap), calc(100% - 1.4rem));
  }

  .prose .cards,
  .layout-wide .prose .cards {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero img,
  .card img {
    animation: none;
  }

  .card:hover img,
  .card:focus-visible img {
    transform: none;
  }
}

@media (max-width: 520px) {
  .brand-name {
    font-size: clamp(0.88rem, 4.5vw, 1.15rem);
  }
}
