:root {
  --paper: #f7f8fa;
  --paper-2: #ffffff;
  --ink: #06122a;
  --quiet: #516075;
  --line: #06122a;
  --copper: #0070e1;
  --copper-2: #f5b000;
  --gold: #f5b000;
  --red: #e21016;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Nunito, "Segoe UI", sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; }

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.narrow { width: min(640px, calc(100% - 40px)); }

h1, h2, h3 { font-family: Nunito, "Segoe UI", sans-serif; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
h1 { font-size: clamp(2.7rem, 7vw, 5.4rem); margin: 0 0 18px; max-width: 16ch; }
h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin: 0 0 12px; }
h3 { font-size: 1.45rem; margin: 0 0 8px; }
p { margin: 0 0 1em; }
a { color: var(--copper); text-underline-offset: 0.18em; }
.kicker, .sheet, .num, .cat, time, .go {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 500;
}
.kicker { color: var(--copper); margin: 28px 0 12px; }
.lede { font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.45; max-width: 38ch; color: var(--ink); }

.home {
  --paper: #f7f8fa;
  --panel: #eef1f6;
  --plate: #ffffff;
  --ink: #06122a;
  --quiet: #516075;
  --rule: #e3e6ee;
  --rule-2: #d5dbe6;
  --leaf: #0070e1;
  color: var(--ink);
  background: var(--paper);
  padding: 36px 0 72px;
}
.home .intro,
.home .charts,
.home .lessons,
.home .none,
.home .pager,
.home .welcome {
  width: min(1120px, calc(100% - 40px));
  margin-left: auto;
  margin-right: auto;
}
.home .intro { container-type: inline-size; }
.home .kicker { color: var(--leaf); margin: 0 0 10px; }
.home h1 {
  max-width: none;
  width: 100%;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  line-height: 1.2;
}
.home .lede {
  max-width: none;
  width: 100%;
  margin: 0;
  color: var(--quiet);
  font-size: 1.05rem;
  line-height: 1.45;
}
.home .lessons { margin-top: 36px; }
.home .lessons h2 {
  margin: 0 0 14px;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}
.home .lessons ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 18px;
  align-items: stretch;
}
.home .lessons a {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 44px;
  padding: 0 0 16px;
  background: #fff;
  border: 1px solid #d5dbe6;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
.home .lessons a:hover { border-color: #0070e1; }
.home .lessons a:hover strong { color: #e21016; }
.home .lessons img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #f6f3ee;
}
.home .pin-copy { display: block; padding: 14px 16px 0; }
.home .lesson-kicker {
  display: block;
  margin-bottom: 6px;
  color: #0070e1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home .lessons strong {
  display: block;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.home .pin-summary {
  display: block;
  margin-top: 6px;
  color: var(--quiet);
  font-size: 1rem;
  line-height: 1.4;
}
.home .find {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin: 16px 0 0;
}
.home .find-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.home .find label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.home .find svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--leaf);
  pointer-events: none;
}
.home .find input {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px 16px 12px 48px;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  background: var(--plate);
  color: var(--ink);
  font: 400 1.05rem/1.3 Nunito, "Segoe UI", sans-serif;
  box-shadow: none;
  appearance: none;
}
.home .find input::-webkit-search-decoration,
.home .find input::-webkit-search-cancel-button { appearance: none; }
.home .find input::placeholder { color: #8b95a5; }
.home .find input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0, 112, 225, 0.28);
}
.home .find button {
  flex: none;
  min-width: 44px;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid #06122a;
  border-radius: 3px;
  background: #06122a;
  color: #fff;
  font: 700 1rem/1 Nunito, "Segoe UI", sans-serif;
  cursor: pointer;
}
.home .find button:hover { background: #0070e1; border-color: #0070e1; }
.home .empty { margin: 8px 0 0; color: var(--quiet); }
.home .charts {
  list-style: none;
  margin-top: 32px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 20px;
}
@media (min-width: 1000px) {
  .home .charts:has(> li:nth-child(3)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.home .charts a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.home .charts img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--plate);
  border: 1px solid var(--rule-2);
  border-radius: 3px;
}
.home .charts a:hover img { border-color: var(--ink); }
.home .chart-copy { display: block; padding: 14px 2px 0; }
.home .card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--leaf);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.home .charts h2 {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(1.15rem, 1.6vw, 1.7rem);
  line-height: 1.15;
}
.home .charts a:hover h2 { color: var(--red); }
.home .none { margin: 22px auto; color: var(--quiet); }
.home .pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
}
.home .pager ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.home .pager li { display: contents; }
.home .pager a,
.home .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  background: var(--plate);
  color: var(--ink);
  text-decoration: none;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.home .pager a:hover { border-color: var(--ink); color: var(--leaf); }
.home .pager [aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.home .pager .is-off { color: #9a8d7e; background: transparent; }
.home .pager .gap { min-width: 32px; border: 0; background: transparent; padding: 0; }
.home .welcome {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1fr);
  gap: 24px 48px;
  align-items: center;
  min-height: calc(100svh - var(--em-bar-h) - 180px);
}
.home .welcome-art img { width: min(100%, 340px); height: auto; }

.prose { padding: 42px 0 80px; }
.prose h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.prose p { max-width: 62ch; font-size: 1.15rem; }

.legal {
  --cream: #f7f8fa;
  --mist: #c5cedd;
  color: var(--cream);
  background: #06122a;
  min-height: calc(100svh - var(--em-bar-h));
  padding: 56px 0 96px;
}
.legal-head,
.legal-list {
  width: min(1240px, calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
}
.legal .kicker { color: #f5b000; margin: 0 0 14px; }
.legal h1 {
  color: var(--cream);
  max-width: 10ch;
  margin: 0 0 22px;
  font-size: clamp(3.2rem, 6vw, 5.6rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.92;
}
.legal .lede {
  max-width: 38rem;
  margin: 0;
  color: var(--mist);
  font-size: 1.25rem;
  line-height: 1.45;
}
.legal .updated {
  margin: 22px 0 0;
  color: var(--mist);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.legal-list { margin-top: 48px; }
.legal-list section {
  display: grid;
  grid-template-columns: minmax(12rem, 0.8fr) minmax(0, 1.2fr);
  gap: 12px 64px;
  align-items: start;
  padding: 28px 0 8px;
  border-top: 1px solid rgba(244, 239, 230, 0.16);
}
.legal h2 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.55rem, 2.1vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}
.legal .copy p,
.legal .copy li {
  max-width: 62ch;
  color: var(--mist);
  font-size: 1.08rem;
  line-height: 1.55;
}
.legal .copy ul { margin: 0.2em 0 1em; padding: 0 0 0 1.15em; }
.legal .copy li { margin: 0.28em 0; }
.legal .copy li::marker { color: #e21016; }
.legal a { color: #f5b000; }
.legal code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.86em;
}
.em-foot nav a[aria-current="page"] { color: #0070e1 !important; }
body.em-home .em-foot nav a[aria-current="page"] { color: #f5b000 !important; }

.flashes { list-style: none; margin: 16px auto; padding: 0; }
.flash { padding: 12px 14px; border: 1px solid var(--ink); background: #fff; }
.flash.error { border-color: #8f2d2d; }
.flash.ok { border-color: #2f6b3a; }

@media (max-width: 800px) {
  .home { padding: 24px 0 56px; }
  .home .intro,
  .home .charts,
  .home .lessons,
  .home .none,
  .home .pager,
  .home .welcome { width: min(1120px, calc(100% - 32px)); }
  .home .welcome { min-height: 0; grid-template-columns: 1fr; gap: 8px; }
  .home .welcome-art img { width: min(100%, 220px); }
  .home .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; margin-top: 24px; }
  .home .charts h2 { font-size: 1.05rem; }
  .home .card-meta { flex-wrap: wrap; letter-spacing: 0.06em; }
  .home h1 { max-width: none; }
  .home .lessons ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .legal { padding: 36px 0 72px; }
  .legal-head,
  .legal-list { width: min(1240px, calc(100% - 36px)); }
  .legal h1 { max-width: none; font-size: clamp(2.8rem, 12vw, 4.2rem); }
  .legal-list section { grid-template-columns: 1fr; gap: 10px; padding-top: 22px; }
  h1 { max-width: none; }
}
@media (max-width: 640px) {
  .home .lessons ul { grid-template-columns: 1fr; gap: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.home .solids,
.home .none {
  width: min(1120px, calc(100% - 40px));
  margin-left: auto;
  margin-right: auto;
}
.home .solids {
  list-style: none;
  margin-top: 32px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
.home .solids a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.home .tile {
  display: block;
  height: 210px;
  background:
    linear-gradient(#f5b000, #f5b000) left top / 33.34% 4px no-repeat,
    linear-gradient(#0070e1, #0070e1) center top / 33.34% 4px no-repeat,
    linear-gradient(#e21016, #e21016) right top / 33.34% 4px no-repeat,
    #fff;
  border: 1px solid #e3e6ee;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(6, 18, 42, 0.06);
}
.home .tile canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.home .solids a:hover .tile { border-color: #0070e1; }
.home .solid-copy { display: block; padding: 14px 2px 0; }
.home .solids h2 {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(1.2rem, 1.6vw, 1.7rem);
  line-height: 1.15;
}
.home .solids a:hover h2 { color: #e21016; }
.home .solid-copy p {
  margin: 6px 0 0;
  color: var(--quiet);
  font-size: 1.02rem;
  line-height: 1.4;
}

.shape {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 80px;
}
.shape-head .kicker { margin-top: 8px; }
.shape h1 { max-width: 16ch; font-size: clamp(2.4rem, 6vw, 4.4rem); }
.shape .lede { max-width: 42rem; }
.shape-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 28px;
  align-items: start;
  margin-top: 8px;
}
.stage {
  background: #fff;
  border: 1px solid #e3e6ee;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(6, 18, 42, 0.06);
}
.stage canvas {
  display: block;
  width: 100%;
  height: 460px;
  touch-action: none;
  cursor: grab;
}
.stage canvas:active { cursor: grabbing; }
.hint {
  margin: 0;
  padding: 10px 14px 14px;
  color: var(--quiet);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.measure label {
  display: block;
  margin: 0 0 14px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--quiet);
}
.measure input,
.measure select {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #d5dbe6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 400 1rem/1.3 Nunito, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-transform: none;
}
.measure input:focus,
.measure select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0, 112, 225, 0.28);
}
.measure small {
  display: block;
  margin-top: 6px;
  font-family: Nunito, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.35;
  color: var(--quiet);
}
.measure button {
  min-height: 48px;
  margin: 4px 0 18px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: #06122a;
  color: #f7f8fa;
  font: 700 1rem/1 Nunito, "Segoe UI", sans-serif;
  cursor: pointer;
}
.measure button:hover { background: #e21016; }
.results h2 { font-size: 1.35rem; margin: 0 0 8px; }
.calc-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff4f4;
  color: #e21016;
}
.result {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid #e3e6ee;
}
.result-label { display: block; color: var(--ink); font: 600 1rem/1.3 Nunito, "Segoe UI", sans-serif; letter-spacing: 0; text-transform: none; }
.formula {
  display: block;
  margin-top: 2px;
  color: var(--quiet);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: none;
}
.result strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  align-self: center;
}
.round { margin: 8px 0 0; color: var(--quiet); font-size: 0.92rem; }
.notes { margin-top: 36px; max-width: 68ch; }
.notes p { font-size: 1.08rem; }

@media (min-width: 640px) {
  .home .solids { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
}
@media (min-width: 1000px) {
  .home .solids { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .home .solids,
  .home .none,
  .shape { width: min(1120px, calc(100% - 32px)); }
  .shape { padding-top: 24px; }
  .shape-grid { grid-template-columns: 1fr; gap: 18px; }
  .stage canvas { height: 280px; }
  .measure button { width: 100%; }
}
@media (min-width: 801px) {
  .measure button { width: auto; }
}
