/* Pea Sprout Games — shared styles. Self-hosted fonts only; no scripts.
   World: a family's doorframe height chart. Painted wall, maple ruler,
   graphite pencil, masking tape, a ruled index card, a painted baseboard.
   System of record: DESIGN.md at the project root. */

@font-face { font-family: "Fredoka"; src: url("/fonts/fredoka-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("/fonts/fredoka-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Patrick Hand"; src: url("/fonts/patrick-hand-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  /* Daylight: a painted nursery wall */
  --wall: #bcd9ee;
  --ink: #1f2833;          /* graphite, ~11:1 on --wall */
  --ink-soft: #33465a;     /* ~6.7:1 on --wall */
  --pencil: #2b3440;
  --pencil-faint: #4d6074;
  --ruler: #f2b84b;
  --ruler-ink: #4a3410;
  --red: #b52f17;          /* ~4.8:1 on --wall */
  --green: #1f5216;        /* ~6:1 on --wall */
  --green-hover: #143a0e;
  --card: #fffefa;
  --card-rule: #cfe0f2;
  --card-red: #e07a68;
  --card-ink: #1f2833;
  --card-link: #2a6a1c;
  --tape: #efe2bf;
  --tape-edge: #dccb9f;
  --tape-ink: #1f2833;
  --trim: #23405a;
  --trim-ledge: #2f5474;
  --trim-ink: #e6eef6;
  --pea: #5fa83a;
  --pea-light: #8cc967;
  --leaf: #2f6b1f;
  --leaf-2: #4a8f2c;
  --cheek: #f09a8a;
  --face: #1f2833;
  --focus: #a8400c;
  --shadow: 31 40 51;
  --measure: 66ch;
  --wrap: 1120px;
  --ruler-w: 72px;
  --tick-l: 30px; --tick-m: 20px; --tick-s: 11px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Night: the same wall with the lamp low */
    --wall: #1a3350;
    --ink: #e9eef4;
    --ink-soft: #b8c6d5;
    --pencil: #d3dce6;
    --pencil-faint: #92a4b8;
    --ruler: #d9a443;
    --ruler-ink: #3a2a0c;
    --red: #ff8f75;
    --green: #a8dd86;
    --green-hover: #c6eeac;
    --card: #24425f;
    --card-rule: #36597a;
    --card-red: #b5604f;
    --card-ink: #e9eef4;
    --card-link: #a8dd86;
    --tape: #d9cba3;
    --tape-edge: #bfae80;
    --trim: #0f2033;
    --trim-ledge: #1c3550;
    --trim-ink: #c9d5e2;
    --pea: #6dbb45;
    --pea-light: #9bd876;
    --leaf: #7cc456;     /* lifted so the sprout reads on the night wall */
    --leaf-2: #5fae3a;
    --focus: #ffb27a;
    --shadow: 0 0 0;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--ink-soft) var(--wall); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100svh;
  display: flex; flex-direction: column;
}
main { flex: 1 0 auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
::selection { background: var(--ruler); color: var(--ruler-ink); }
img, svg { max-width: 100%; }

h1, h2, h3 { font-family: "Fredoka", "Atkinson Hyperlegible", system-ui, sans-serif; font-weight: 600; line-height: 1.12; text-wrap: balance; }

a { color: var(--green); text-underline-offset: 0.2em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--green-hover); text-decoration-thickness: 0.14em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 3px; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--wall);
  padding: 0.6rem 1rem; border-radius: 6px; z-index: 10; text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--wall); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* Logo and pea: colors come from tokens so dark mode can lift them */
.logo-pea { fill: var(--pea); }
.logo-shine { fill: var(--pea-light); }
.logo-stem { stroke: var(--leaf); stroke-width: 4; stroke-linecap: round; fill: none; }
.logo-leaf { fill: var(--leaf); }
.logo-leaf-2 { fill: var(--leaf-2); }

/* Header */
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem; flex-wrap: wrap; padding-top: 0.75rem; padding-bottom: 0.75rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px;
  color: var(--ink); text-decoration: none;
  font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; font-size: 1.3rem;
}
.brand:hover { color: var(--ink); }
.brand .logo { width: 40px; height: 40px; flex: none; }
.site-nav ul { list-style: none; display: flex; gap: 0.25rem; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.7rem;
  color: var(--ink-soft); text-decoration: none;
  font-family: "Fredoka", system-ui, sans-serif; font-weight: 500; font-size: 1.08rem;
}
.site-nav a:hover { color: var(--green); }
.site-nav a[aria-current="page"] {
  color: var(--ink);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5.5C14 2.5 30 3 58 4.2' fill='none' stroke='%23b52f17' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center bottom 6px / calc(100% - 1rem) 8px;
}

/* Chart: the hero is the height chart */
.chart { position: relative; }
.chart-grid {
  position: relative;
  display: grid; grid-template-columns: var(--ruler-w) minmax(0, 1fr);
}
.ruler {
  position: relative; overflow: hidden; contain: size;
  margin-bottom: 0;
  display: flex; flex-direction: column-reverse;
  background:
    repeating-linear-gradient(to top, var(--ruler-ink) 0 2px, transparent 2px 80px) right bottom / var(--tick-l) 100% no-repeat,
    repeating-linear-gradient(to top, var(--ruler-ink) 0 1.5px, transparent 1.5px 40px) right bottom / var(--tick-m) 100% no-repeat,
    repeating-linear-gradient(to top, var(--ruler-ink) 0 1px, transparent 1px 8px) right bottom / var(--tick-s) 100% no-repeat,
    var(--ruler);
  border-radius: 10px 10px 3px 3px;
  box-shadow: inset -2px 0 0 rgb(0 0 0 / 0.08), 0 1px 2px rgb(var(--shadow) / 0.18), 3px 8px 18px -10px rgb(var(--shadow) / 0.45);
}
.ruler::before {          /* finished top end: blank stock with a hanging hole, print wearing off below it */
  content: ""; position: absolute; inset: 0 0 auto; height: 52px; z-index: 1;
  background:
    radial-gradient(circle at 50% 15px, rgb(var(--shadow) / 0.55) 0 4px, rgb(0 0 0 / 0.12) 4.5px 5.5px, transparent 6px),
    linear-gradient(var(--ruler) 0 26px, transparent 52px);
}
.ruler span {
  flex: none; height: 80px; padding-left: 10px;
  display: flex; align-items: flex-start;
  font: 600 0.82rem/1 "Fredoka", system-ui, sans-serif; color: var(--ruler-ink);
  font-variant-numeric: tabular-nums;
  transform: translateY(-0.45em);
}
.chart-body {
  display: flex; flex-direction: column;
  padding: clamp(1.25rem, 3svh, 3.25rem) 0 84px clamp(1.25rem, 3.5vw, 3rem);
}
.chart-intro { max-width: 40rem; }
@media (min-width: 1180px) {
  .chart-intro { max-width: none; display: grid; grid-template-columns: fit-content(36rem) minmax(0, 1fr); gap: 0 3.5rem; align-items: start; }
  .chart-intro h1 { grid-row: 1 / span 2; font-size: clamp(3.4rem, min(5vw, 8.5svh), 4.4rem); margin: 0; }
  .chart-intro .lede, .chart-intro .actions { grid-column: 2; }
  .chart-intro .lede { margin: 0.7rem 0 1.1rem; }
}
.chart-intro h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.6rem); letter-spacing: -0.015em;
  margin: 0 0 1.1rem; color: var(--ink);
}
.lede { font-size: clamp(1.15rem, 1.6vw, 1.32rem); color: var(--ink-soft); max-width: 36ch; margin: 0 0 1.75rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0; }

.tape-button {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0.55rem 1.6rem;
  background: var(--tape); color: var(--tape-ink); text-decoration: none;
  font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; font-size: 1.125rem;
  clip-path: polygon(0 10%, 2% 0, 30% 5%, 62% 0, 98% 4%, 100% 0, 98.5% 50%, 100% 100%, 70% 95%, 35% 100%, 3% 96%, 0 100%, 1.5% 50%);
  transform: rotate(-1.2deg);
  box-shadow: inset 0 -3px 0 var(--tape-edge);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}
.tape-button:hover { color: var(--tape-ink); transform: rotate(0deg) translateY(-1px); filter: drop-shadow(0 6px 8px rgb(var(--shadow) / 0.28)); }
.tape-button:focus-visible { outline-offset: 5px; }
.quiet-link {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: "Fredoka", system-ui, sans-serif; font-weight: 500; font-size: 1.08rem;
}


/* The mark: what we're making right now, drawn on the wall just under the intro */
.mark {
  margin-top: clamp(2.5rem, 7svh, 4.5rem);
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 1.25rem;
  padding: 0 0 0.85rem 2.25rem;
}
/* the pencil mark: a heavy tick on the ruler edge, then a hand-drawn line across the wall */
.mark::before {
  content: ""; position: absolute; bottom: -2px; width: 30px; height: 4px; border-radius: 2px;
  left: calc(-1 * clamp(1.25rem, 3.5vw, 3rem) - 18px);
  background: var(--pencil); rotate: -2deg;
}
.pencil-line {
  position: absolute; bottom: -4px; height: 8px; right: 0;
  left: calc(-1 * clamp(1.25rem, 3.5vw, 3rem) + 6px);
  width: calc(100% + clamp(1.25rem, 3.5vw, 3rem) - 6px); max-width: none; display: block;
  fill: none; stroke: var(--pencil); stroke-width: 2.4; stroke-linecap: round;
  vector-effect: non-scaling-stroke; overflow: visible;
  transform-origin: left center;
}
.pencil-line path { vector-effect: non-scaling-stroke; }
.mark-text h2 { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2rem); }
.mark-text p { margin: 0.35rem 0 0; color: var(--ink-soft); max-width: 48ch; font-size: clamp(1.15rem, 1.6vw, 1.32rem); }
.mark-note {
  margin: 0; align-self: end;
  font-family: "Patrick Hand", cursive; font-size: 1.35rem; line-height: 1.2; color: var(--ink-soft);
  white-space: nowrap;
}
.mark-note--now { position: relative; color: var(--red); padding: 0.25rem 1.15rem 0.25rem 1rem; }
.pencil-circle {
  position: absolute; inset: -0.35rem -0.5rem; width: calc(100% + 1rem); height: calc(100% + 0.7rem);
  fill: none; stroke: var(--red); stroke-width: 2.2; stroke-linecap: round;
  vector-effect: non-scaling-stroke; overflow: visible;
}

/* The pea measuring itself at the ruler's foot */
.pea-kid {
  position: absolute; bottom: 0; left: calc(1.25rem + var(--ruler-w) + 0.25rem);
  width: 92px; height: auto; overflow: visible;
}
.pea-foot { fill: var(--leaf); }
.pea-eye { fill: var(--face); }
.pea-cheek { fill: var(--cheek); opacity: 0.75; }
.pea-smile { fill: none; stroke: var(--face); stroke-width: 3; stroke-linecap: round; }
.pea-arm { fill: none; stroke: var(--leaf-2); stroke-width: 5; stroke-linecap: round; }
.pea-pencil { stroke: var(--red); stroke-width: 4.5; stroke-linecap: round; }
.pea-sprout { transform-box: view-box; transform-origin: 60px 50px; }

/* The one authored moment: the mark is drawn from the ruler, circled, then the sprout perks */
@media (prefers-reduced-motion: no-preference) {
  .pencil-line { animation: draw 0.9s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
  .mark--now .pencil-line { animation-delay: 0.3s; }
  .pencil-circle path { stroke-dasharray: 320; animation: circle 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.9s backwards; }
  .pea-sprout { animation: perk 1.1s cubic-bezier(0.16, 1, 0.3, 1) 1.2s backwards; }
  a, .tape-button { transition-property: color, background-color, transform, text-decoration-thickness; }
}
@keyframes draw { from { clip-path: inset(-6px 100% -6px 0); } to { clip-path: inset(-6px 0 -6px 0); } }
@keyframes circle { from { stroke-dashoffset: 320; } }
@keyframes perk { from { transform: scale(0.55) rotate(-8deg); } }

/* Parents: an index card taped to the next stretch of wall */
.parents { padding: clamp(4.5rem, 9vw, 7rem) 0 clamp(4rem, 8vw, 6rem); }
.parents-grid {
  display: grid; gap: 3rem 4rem;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start;
}
.index-card {
  position: relative;
  background:
    linear-gradient(var(--card-red), var(--card-red)) 0 4.4rem / 100% 2px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), var(--card-rule) calc(2rem - 1px) 2rem) 0 5.5rem / 100% calc(100% - 5.5rem) no-repeat,
    var(--card);
  color: var(--card-ink);
  padding: 1.5rem clamp(1.25rem, 4vw, 2.75rem) 2rem;
  line-height: 2rem;
  border-radius: 3px;
  transform: rotate(-0.6deg);
  box-shadow: 0 1px 2px rgb(var(--shadow) / 0.16), 0 18px 34px -16px rgb(var(--shadow) / 0.45);
}
.index-card::before {      /* tape */
  content: ""; position: absolute; top: -14px; left: 50%; width: 128px; height: 30px;
  background: var(--tape); opacity: 0.92; translate: -50% 0; rotate: 1.8deg;
  clip-path: polygon(0 8%, 4% 0, 96% 6%, 100% 0, 98% 50%, 100% 100%, 95% 92%, 4% 100%, 0 94%, 2% 50%);
}
.index-card h2 { margin: 0 0 2rem; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 2rem; }
.promises { list-style: none; margin: 0 0 2rem; padding: 0; }
.promises li { position: relative; padding-left: 2.4rem; font-size: 1.125rem; }
.check {
  position: absolute; left: 0; top: 0.1rem; width: 1.6rem; height: 1.6rem;
  fill: none; stroke: var(--leaf); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.index-card p { margin: 0; }
.index-card a { color: var(--card-link); }
.card-links { display: flex; flex-wrap: wrap; gap: 0 1.75rem; margin-top: 2rem !important; }
.card-links a { display: inline-block; padding: 0.375rem 0; margin: -0.375rem 0; font-weight: 700; }

.about { padding-top: 0.5rem; }
.about h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0 0 1rem; }
.about p { margin: 0 0 1rem; color: var(--ink-soft); max-width: 44ch; }
.about a { font-weight: 700; overflow-wrap: anywhere; }

/* Long-form pages: a sheet taped to the wall */
.doc { padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(3rem, 6vw, 5rem); }
.doc > .wrap {
  position: relative;
  width: min(100% - 2rem, 52rem);
  background: var(--card); color: var(--card-ink);
  padding: clamp(2rem, 5vw, 3.25rem) clamp(1.25rem, 5vw, 3.5rem) clamp(2.25rem, 5vw, 3.5rem);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgb(var(--shadow) / 0.16), 0 18px 34px -16px rgb(var(--shadow) / 0.45);
}
.doc > .wrap::before, .doc > .wrap::after {
  content: ""; position: absolute; top: -12px; width: 104px; height: 26px;
  background: var(--tape); opacity: 0.92;
  clip-path: polygon(0 8%, 4% 0, 96% 6%, 100% 0, 98% 50%, 100% 100%, 95% 92%, 4% 100%, 0 94%, 2% 50%);
}
.doc > .wrap::before { left: 1.5rem; rotate: -4deg; }
.doc > .wrap::after { right: 1.5rem; rotate: 3deg; }
.doc .wrap > * { max-width: var(--measure); }
.doc a { color: var(--card-link); }
.doc h1 { font-size: clamp(2.1rem, 5vw, 3rem); letter-spacing: -0.01em; margin: 0 0 0.6rem; }
.doc h2 { font-size: 1.5rem; margin: 2.75rem 0 0.6rem; }
.doc h3 { font-size: clamp(1.25rem, 2vw, 1.55rem); margin: 1.75rem 0 0.35rem; }
.doc ul, .doc ol { padding-left: 1.3rem; }
.doc li { margin: 0.3rem 0; }
.doc li::marker { color: var(--pencil-faint); }
.meta { font-family: "Patrick Hand", cursive; font-size: 1.35rem; color: var(--pencil-faint); margin-top: 0; }
.doc .meta { color: var(--card-ink); opacity: 0.8; }
.doc .lede { color: inherit; max-width: var(--measure); font-size: clamp(1.15rem, 1.6vw, 1.32rem); }
.toc, .contact-card {
  border: 1.5px solid var(--card-rule); border-radius: 6px;
  padding: 1rem 1.25rem; margin: 1.5rem 0 0.5rem;
}
.toc h2 { font-family: "Patrick Hand", cursive; font-weight: 400; font-size: 1.35rem; margin: 0 0 0.3rem; }
.toc ol { margin: 0; padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; }
.toc li { break-inside: avoid; }
.toc a { display: inline-block; padding: 0.55rem 0; }
.toc li { margin: 0; }
.contact-card p { margin: 0.2rem 0; }
.doc .actions { margin-top: 1.5rem; }

/* 404 */
.lost { text-align: left; }
.lost .pea-lost { width: 110px; height: auto; display: block; margin-bottom: 1rem; overflow: visible; }

/* Footer: the baseboard */
.site-footer {
  background: linear-gradient(var(--trim-ledge) 0 8px, var(--trim) 8px);
  color: var(--trim-ink); padding: 2rem 0 2.25rem; font-size: 1rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; align-items: center; }
.site-footer ul { list-style: none; display: flex; gap: 0 0.5rem; margin: 0; padding: 0; flex-wrap: wrap; }
.site-footer a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.5rem;
  color: var(--trim-ink); overflow-wrap: anywhere;
}
.site-footer a:hover { color: var(--trim-ink); text-decoration-thickness: 0.16em; }
.site-footer p { margin: 0; }
.site-footer :focus-visible { outline-color: var(--ruler); }

/* Small screens */
@media (max-width: 760px) {
  :root { --ruler-w: 46px; --tick-l: 16px; --tick-m: 11px; --tick-s: 6px; }
  .tape-button { font-size: 1.08rem; padding: 0.55rem 1.15rem; }
  .ruler span { padding-left: 5px; font-size: 0.7rem; }
  .chart-grid { min-height: 0; }
  .chart-body { padding-top: 2rem; padding-bottom: 6.5rem; }
  .mark { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; padding-left: 0; }
  .mark-note { justify-self: start; font-size: 1.2rem; }
  .mark-note--now { margin-left: -0.6rem; }
  .pea-kid { width: 76px; left: calc(1.25rem + var(--ruler-w) + 0.5rem); }
  .parents-grid { grid-template-columns: 1fr; }
  .index-card { transform: none; }
  .site-footer .wrap { flex-direction: column; align-items: flex-start; }
  .site-footer ul { margin-left: -0.5rem; }
}

@media print {
  .site-header, .site-footer, .skip-link, .ruler, .pea-kid, .pencil-line { display: none; }
  body, .parents, .doc > .wrap, .index-card { background: #fff !important; color: #000; box-shadow: none; }
  .doc > .wrap::before, .doc > .wrap::after, .index-card::before { display: none; }
  .chart-grid { display: block; }
}
