/* Stillwork: lab-ledger look. Six colors in total, all in the hue 263 family plus one warm error tone. */
:root {
  --paper: #F4F1F8;
  --ink: #1D1131;
  --accent: #582BA1;
  --muted: #584D6A;
  --line: #C4BBD3;
  --error: #9F2F23;

  --font-display: "Arial Black", Impact, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --wrap: 1160px;
  --measure: 68ch;
  color-scheme: light;
}

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

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  overflow-wrap: break-word;
}

[hidden] {
  display: none !important;
}

main {
  flex: 1 0 auto;
}

main:focus {
  outline: none;
}

svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.3rem, 1.2rem + 5vw, 5.4rem);
  line-height: 0.96;
  margin: 0 0 0.45em;
}

h2 {
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.6rem);
  line-height: 1.02;
  margin: 0 0 0.6em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 1.6em 0 0.5em;
}

p {
  margin: 0 0 1em;
  max-width: var(--measure);
}

ul,
ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink);
}

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

strong {
  font-weight: 800;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -200px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:hover,
.skip-link:focus {
  color: var(--paper);
}

.skip-link:focus {
  top: 16px;
  outline-color: var(--ink);
}

/* Header and navigation */
.site-header {
  border-bottom: 3px solid var(--ink);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--accent);
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
}

.nav-list a {
  display: inline-block;
  padding: 6px 0;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 3px solid var(--paper);
}

.nav-list a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-list a[aria-current="page"] {
  border-bottom-color: var(--ink);
}

/* Hero */
.hero {
  display: grid;
  gap: 36px;
  align-items: center;
  padding-top: clamp(36px, 7vw, 84px);
  padding-bottom: clamp(32px, 5vw, 60px);
}

@media (min-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  }
}

.eyebrow {
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  max-width: 42ch;
  margin-bottom: 0;
}

.hero-art {
  margin: 0;
}

.hero-art figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.still-art {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.still-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.still-rule {
  stroke: var(--ink);
  stroke-width: 2;
}

.drop {
  fill: var(--accent);
}

/* Page heads for secondary pages */
.page-head {
  padding-top: clamp(40px, 7vw, 84px);
  padding-bottom: clamp(24px, 4vw, 48px);
}

.page-head .lede {
  max-width: 48ch;
}

.body-section {
  padding-bottom: clamp(40px, 6vw, 72px);
}

.body-section > section {
  padding-top: 28px;
  border-top: 3px solid var(--ink);
  margin-bottom: 40px;
}

.note {
  padding: 14px 16px;
  max-width: var(--measure);
  background: var(--paper);
  border-left: 5px solid var(--accent);
}

/* Tabbed workspace */
.workspace {
  padding-bottom: clamp(56px, 8vw, 110px);
}

.tablist {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

html.js .tablist {
  display: flex;
}

.tab {
  position: relative;
  z-index: 1;
  min-height: 44px;
  margin-bottom: -2px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-bottom: 0;
  cursor: pointer;
}

.tab:hover:not([aria-selected="true"]) {
  background: var(--line);
}

.tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
}

.panel {
  margin: 0;
}

html.js .panel {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: clamp(22px, 3.5vw, 40px) clamp(16px, 3.5vw, 40px);
}

html:not(.js) .panel + .panel {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 3px solid var(--ink);
}

.kicker {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.notice {
  padding: 14px 16px;
  max-width: var(--measure);
  background: var(--paper);
  border-left: 5px solid var(--accent);
}

html:not(.js) .js-only {
  display: none;
}

/* Practice controls */
.test-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 28px;
  margin: 0 0 22px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.options label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  border: 2px solid var(--ink);
  cursor: pointer;
}

.options label:has(input:checked) {
  background: var(--line);
  font-weight: 800;
}

.options input[type="radio"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  color: var(--paper);
  background: var(--accent);
  border: 2px solid var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.btn:visited {
  color: var(--paper);
}

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

.btn-quiet {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--ink);
}

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

.time-progress {
  display: block;
  width: 100%;
  height: 14px;
  margin: 0 0 22px;
  -webkit-appearance: none;
  appearance: none;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.time-progress::-webkit-progress-bar {
  background: var(--paper);
}

.time-progress::-webkit-progress-value {
  background: var(--accent);
}

.time-progress::-moz-progress-bar {
  background: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  margin: 0 0 22px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

@media (min-width: 720px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

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

.stat dd {
  margin: 4px 0 0;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Passage and typing area */
.passage {
  margin: 0 0 22px;
  max-width: none;
  padding: 18px 20px;
  background: var(--paper);
  border-left: 5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(1rem, 0.92rem + 0.4vw, 1.2rem);
  line-height: 1.85;
  color: var(--muted);
}

.char.pending {
  color: var(--muted);
}

.char.correct {
  color: var(--ink);
}

.char.wrong {
  color: var(--error);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.char.current {
  color: var(--paper);
  background: var(--accent);
}

.field-label {
  display: block;
  margin: 0 0 8px;
  font-weight: 800;
}

.typing-input {
  display: block;
  width: 100%;
  min-height: 9em;
  margin: 0 0 8px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 0.92rem + 0.4vw, 1.2rem);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 0;
  resize: vertical;
}

.typing-input:read-only {
  border-color: var(--muted);
}

.help {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.test-status {
  margin: 20px 0 0;
  padding: 14px 16px;
  max-width: none;
  min-height: 3.2em;
  background: var(--paper);
  border-left: 5px solid var(--accent);
  font-weight: 700;
}

/* Lists and specs */
ol.principles li,
ul.checklist li {
  margin-bottom: 0.9em;
  padding-left: 0.2em;
}

ol.principles li::marker {
  font-family: var(--font-mono);
  font-weight: 700;
}

.spec {
  margin: 0 0 26px;
  border-top: 3px solid var(--ink);
}

.spec > div {
  display: grid;
  gap: 6px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 720px) {
  .spec > div {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: baseline;
  }
}

.spec dt {
  font-weight: 800;
}

.spec dd {
  margin: 0;
  max-width: var(--measure);
}

.formula {
  max-width: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  background: var(--paper);
  border-left: 5px solid var(--ink);
  overflow-wrap: anywhere;
}

.glossary {
  margin: 0;
}

.glossary > div {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.glossary dt {
  font-weight: 800;
}

.glossary dd {
  margin: 4px 0 0;
  max-width: var(--measure);
}

/* Field guide chapters */
.guide-chapter {
  padding-top: 28px;
  border-top: 3px solid var(--ink);
  margin-bottom: 40px;
}

.guide-chapter p {
  max-width: var(--measure);
}

/* Contact */
.mail-link {
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.4rem);
  overflow-wrap: anywhere;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 44px 0;
  background: var(--ink);
  color: var(--paper);
}

.site-footer p {
  max-width: none;
  margin: 0 0 12px;
  color: var(--paper);
}

.site-footer a {
  color: var(--paper);
  text-decoration-thickness: 2px;
}

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

.site-footer :focus-visible {
  outline-color: var(--paper);
}

.footer-inner {
  display: grid;
  gap: 28px;
}

@media (min-width: 720px) {
  .footer-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-width: none;
}

.foot-links a {
  font-weight: 700;
  border-bottom: 2px solid var(--paper);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--line);
  border-bottom-color: var(--line);
}

/* Motion: animated versions only when the reader has not asked for reduced motion */
@media (prefers-reduced-motion: no-preference) {
  html.js .panel:not([hidden]) {
    animation: panel-in 0.28s ease-out;
  }

  .tab,
  .btn,
  .nav-list a,
  .options label {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .drop {
    animation: drip 2.8s ease-in infinite;
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drip {
  0% {
    opacity: 0;
    transform: translateY(0);
  }

  15% {
    opacity: 1;
  }

  80% {
    opacity: 1;
    transform: translateY(92px);
  }

  100% {
    opacity: 0;
    transform: translateY(104px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html.js .panel:not([hidden]) {
    animation: none;
  }

  .tab,
  .btn,
  .nav-list a,
  .options label {
    transition: none;
  }

  .drop {
    animation: none;
    opacity: 1;
    transform: translateY(52px);
  }
}
