@font-face {
  font-family: "Ubuntu";
  src: url("./ubuntu-reading.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu";
  src: url("./ubuntu-heading.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("./roboto-label.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #14243f;
  --quiet-ink: #34445f;
  --link-ink: #163e78;
  --edge: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.25);
  --blue: #0080ff;
  --purple: #8b00ff;
  --pink: #ff1493;
  --teal: #20b2aa;
  --reading: "Ubuntu", system-ui, sans-serif;
  --labels: "Roboto", system-ui, sans-serif;
  --measure: 72ch;
  font-family: var(--reading);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: #eaf0fc;
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  overflow-wrap: break-word;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 6% 4%, rgba(255, 255, 255, 0.93) 0, rgba(255, 255, 255, 0) 42%),
    radial-gradient(ellipse at 88% 15%, rgba(139, 0, 255, 0.20) 0, rgba(139, 0, 255, 0) 48%),
    radial-gradient(ellipse at 78% 51%, rgba(255, 20, 147, 0.14) 0, rgba(255, 20, 147, 0) 42%),
    radial-gradient(ellipse at 2% 48%, rgba(0, 128, 255, 0.20) 0, rgba(0, 128, 255, 0) 53%),
    radial-gradient(ellipse at 85% 100%, rgba(32, 178, 170, 0.22) 0, rgba(32, 178, 170, 0) 48%);
}

body::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0));
  background-color: rgba(255, 255, 255, 0.26);
}

header, main, footer {
  width: min(1280px, calc(100% - 96px));
  margin-inline: auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 24px;
  border-bottom: 1px solid var(--edge);
}

main { padding-block: 48px 72px; }

article { min-width: 0; }

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

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 {
  margin-bottom: 24px;
  max-width: 28ch;
  font-size: 2.25rem;
}

h2 {
  margin-bottom: 24px;
  max-width: 30ch;
  font-size: 1.75rem;
}

h3 { font-size: 1.25rem; }

p {
  max-width: var(--measure);
  margin-bottom: 16px;
}

p:last-child { margin-bottom: 0; }

ul, ol {
  max-width: var(--measure);
  padding-left: 24px;
  margin-bottom: 24px;
}

li {
  padding-left: 8px;
  margin-block: 8px;
  font-size: 1rem;
}

li::marker { color: #235780; }

dl { margin-bottom: 24px; }

dt {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 8px;
}

dd { margin-left: 0; }

a {
  color: var(--link-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding-block: 8px;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

a:focus-visible {
  outline: 3px solid #4c1781;
  outline-offset: 4px;
  border-radius: 6px;
}

code, time {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1rem;
}

code {
  background: rgba(255, 255, 255, 0.27);
  border-radius: 4px;
  padding: 0 4px;
  white-space: nowrap;
}

footer {
  padding-block: 32px;
  border-top: 1px solid var(--edge);
  font-size: 1rem;
}

footer > p:first-child { max-width: 65ch; }

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-block: 16px 24px;
}

footer a {
  min-height: 48px;
  border-bottom: 1px solid rgba(20, 36, 63, 0.25);
}

.site-mark {
  color: var(--ink);
  text-decoration: none;
  align-items: baseline;
  gap: 16px;
  padding-block: 0;
}

.site-mark span:first-child {
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.04em;
}

.site-mark span:last-child {
  font-family: var(--labels);
  font-weight: 500;
  border-left: 1px solid rgba(20, 36, 63, 0.25);
  padding-left: 16px;
}

.guide-label {
  margin: 0;
  font-family: var(--labels);
  font-weight: 500;
  font-size: 1rem;
  color: var(--quiet-ink);
}

.word-label {
  font-family: var(--labels);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--quiet-ink);
  margin-bottom: 16px;
}

.skip-reading {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 10;
  min-height: 48px;
  padding: 8px 16px;
  color: #fff;
  background: var(--ink);
}

.skip-reading:focus { top: 16px; }

.primer-top {
  padding-block: 16px 8px;
  position: relative;
  max-width: 1056px;
}

.primer-top > div > p:not(.word-label) { max-width: 62ch; }

main[data-page="start"] .primer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  align-items: center;
  gap: 64px;
  max-width: none;
  padding-block: 16px 24px;
}

main[data-page="start"] h1 {
  font-size: clamp(2.5rem, 4.4vw, 4rem);
  max-width: 22ch;
  line-height: 1.13;
  letter-spacing: -0.045em;
}

.start-phrase { color: #442868; }

.first-word {
  position: relative;
  isolation: isolate;
  padding: 40px 32px;
  border: 1px solid var(--edge);
  border-radius: 28px 28px 28px 8px;
  background: var(--glass);
  box-shadow: 0 16px 40px rgba(58, 71, 128, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.first-word::before {
  content: "";
  position: absolute;
  inset: -16px 24px 24px -16px;
  z-index: -2;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(-5deg);
}

.first-word::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 96px;
  top: -28px;
  right: 16px;
  z-index: -3;
  background: rgba(255, 20, 147, 0.28);
  border-radius: 50%;
  filter: blur(32px);
}

.first-word dt {
  font-size: clamp(2.25rem, 3.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.first-word > p:last-child {
  padding-top: 16px;
  border-top: 1px solid var(--edge);
  color: var(--quiet-ink);
}

.question-tabs { margin-block: 48px 64px; }

.question-tabs ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: none;
  list-style: none;
  padding: 0;
  margin: 0;
}

.question-tabs li { padding: 0; margin: 0; min-width: 0; }

.question-tabs a {
  display: flex;
  height: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border: 1px solid var(--edge);
  border-radius: 14px 14px 6px 6px;
  background: rgba(255, 255, 255, 0.21);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-family: var(--labels);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.question-tabs a:hover { background: rgba(255, 255, 255, 0.4); }

.question-tabs a[aria-current="page"] {
  color: #fff;
  background: #172d4e;
  border-color: #172d4e;
  box-shadow: inset 0 -3px 0 var(--blue), 0 8px 24px rgba(20, 36, 63, 0.12);
}

.question-reading { max-width: 1136px; }

.primer-row {
  display: grid;
  grid-template-columns: minmax(0, 72ch) minmax(0, 25ch);
  gap: 64px;
  align-items: start;
  margin-block: 0 64px;
}

.primer-row > div:first-child { min-width: 0; }

.primer-row > div:first-child > a {
  margin-top: 8px;
  padding: 12px 16px;
  min-height: 48px;
  border: 1px solid rgba(22, 62, 120, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.26);
}

.margin-words {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 8px;
}

.term-note {
  padding: 24px 24px 24px 20px;
  border-left: 3px solid var(--teal);
  border-top: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  border-radius: 4px 20px 20px 4px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 24px rgba(58, 71, 128, 0.06);
}

.term-note .word-label { margin-bottom: 12px; }

.term-note dl { margin: 0; }

.term-note dt { font-size: 1.125rem; line-height: 1.35; }

.term-note dd p { font-size: 1rem; }

.treatment-words, .cost-pieces { margin: 32px 0 0; }

.treatment-words > div, .cost-pieces > div {
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--blue);
  border-radius: 4px 20px 20px 4px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.treatment-words > div:nth-child(2) { border-left-color: var(--purple); }
.treatment-words > div:nth-child(3) { border-left-color: var(--pink); }
.cost-pieces > div:nth-child(even) { border-left-color: var(--teal); }

.reading-list {
  padding: 32px;
  max-width: 72ch;
  border: 1px solid var(--edge);
  border-radius: 24px 24px 24px 6px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-block: 16px 64px;
}

.reading-list ul, .source-notes { list-style: none; padding: 0; margin: 0; }

.reading-list li, .source-notes li {
  margin: 0;
  padding: 24px 0;
  border-top: 1px solid rgba(20, 36, 63, 0.18);
}

.reading-list li:first-child { border-top: 0; padding-top: 0; }
.reading-list li:last-child { padding-bottom: 0; }
.source-notes li:first-child { padding-top: 0; border-top: 0; }

.reading-list .word-label { margin: 0; }

.reading-list a, .source-notes a {
  font-weight: 700;
  min-height: 48px;
  width: 100%;
  margin-bottom: 8px;
}

.next-question {
  max-width: 72ch;
  padding-top: 24px;
  border-top: 1px solid rgba(20, 36, 63, 0.18);
}

.next-question a {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  min-height: 64px;
  width: 100%;
  border-radius: 16px 16px 6px 16px;
  background: #172d4e;
  color: #fff;
  text-decoration: none;
  box-shadow: inset 0 -3px 0 var(--teal);
}

.next-question a:hover { text-decoration: underline; }

.next-question a span { flex-shrink: 0; font-size: 1.5rem; }

.domain-label {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1rem;
  color: var(--quiet-ink);
}

@media (max-width: 960px) {
  header, main, footer { width: calc(100% - 64px); }
  main[data-page="start"] .primer-top { gap: 32px; }
  .first-word { padding: 32px 24px; }
  .primer-row { gap: 32px; grid-template-columns: minmax(0, 1fr) minmax(0, 24ch); }
}

@media (max-width: 680px) {
  header, main, footer { width: calc(100% - 32px); }
  header { flex-wrap: wrap; gap: 8px; padding-block: 16px; }
  .guide-label { width: 100%; }
  .site-mark span:first-child { font-size: 1.5rem; }
  .site-mark span:last-child { font-size: 1rem; }
  main { padding-block: 24px 48px; }
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.5rem; margin-bottom: 16px; }
  main[data-page="start"] .primer-top { display: block; padding: 8px 0 0; }
  main[data-page="start"] h1 { font-size: clamp(2.5rem, 9.8vw, 3rem); }
  .primer-top { padding-top: 8px; }
  .first-word { margin: 32px 8px 0; padding: 24px; }
  .first-word dt { font-size: 2.5rem; }
  .first-word::before { inset: -8px 16px 16px -8px; transform: rotate(-2deg); }
  .first-word::after { top: 0; right: 8px; width: 64px; height: 64px; }
  .question-tabs { margin-block: 40px 48px; }
  .question-tabs ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-tabs li:last-child { grid-column: 1 / -1; }
  .question-tabs a { padding: 12px; min-height: 56px; line-height: 1.4; }
  .primer-row { display: block; margin-bottom: 48px; }
  .margin-words { padding: 0; margin-top: 24px; gap: 16px; }
  .term-note { padding: 20px; }
  .term-note dt { margin-bottom: 4px; }
  .term-note .word-label { margin-bottom: 8px; }
  .treatment-words > div, .cost-pieces > div { padding: 20px; }
  .reading-list { padding: 24px 20px; margin-bottom: 48px; }
  .next-question a { padding: 16px 20px; }
  footer { padding-block: 24px; }
}

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

@media print {
  :root { background: #fff; color: #000; }
  body::before, body::after, .first-word::before, .first-word::after { display: none; }
  header, main, footer { width: 100%; }
  main { padding-block: 24px; }
  .first-word, .term-note, .treatment-words > div, .cost-pieces > div, .reading-list { background: #fff; box-shadow: none; }
  .question-tabs { display: none; }
  .primer-row { break-inside: avoid; margin-bottom: 32px; }
  .next-question a { background: #fff; color: #000; border: 1px solid #000; }
}
