/* Prosper: the story of an apple.
   Editorial and restrained: near-white paper, ink hairlines, one serif. ASCII is the only mono,
   because the fruit is the machine. Color is kept for living things: a bud, a sprout, one apple. */

:root {
  --paper: #FCFBF8;
  --ink: #141614;
  --ink-2: rgba(20, 22, 20, 0.78);
  --ink-3: rgba(20, 22, 20, 0.5);
  --hair: rgba(20, 22, 20, 0.14);
  --node: #1E9E4A;
  --green-deep: #1E4A32; /* small touches only */

  --serif: "Gentium Plus", "Iowan Old Style", Georgia, serif;
  /* Both fonts are drawn at the size that gives a line the same length as in the face the page was set
     in (EB Garamond), so every line breaks where it did: Gentium (lowercase 0.46 of its size) at 0.42,
     Familjen Grotesk (0.50) at 0.455 */
  --serif-adjust: 0.42;
  /* the copy: a modern sans (headlines, numbers and the drawings' italic labels stay Gentium) */
  --sans: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans-adjust: 0.455;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "Courier New", monospace;

  --gutter: clamp(20px, 4vw, 56px);
  --max: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

/* no scroll anchoring: the page's own eased scroll decides where it is, the browser must not nudge it */
/* the scrollbar's room is kept even while the intro locks the page, so unlocking doesn't narrow the
   page under a drawing and a dock already measured against it */
html { scroll-padding-block: 80px 96px; background: var(--paper); overflow-anchor: none; scrollbar-gutter: stable; }
/* no rubber-band bounce at the ends of the page (iOS): a fast flick into the footer made the page spring
   past its end and back under the bars, which stay put, so the footer wobbled as the words landed */
html, body { overscroll-behavior-y: none; }
html.is-locked, html.is-locked body { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  html.is-free { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font: 400 1.125rem/1.55 var(--sans);
  font-size-adjust: var(--sans-adjust);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-size-adjust: var(--serif-adjust);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.012em;
  text-wrap: balance;
}

:focus-visible { outline: 1.5px solid var(--green-deep); outline-offset: 4px; }
::selection { background: var(--green-deep); color: var(--paper); }

.skip {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -60px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  &:focus { top: 16px; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.6rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--green-deep);
  color: var(--paper);
  font: 400 1rem/1 var(--sans);
  font-size-adjust: var(--sans-adjust);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
  &:hover { opacity: 0.82; }
  &:disabled { opacity: 0.5; cursor: default; }
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  z-index: 50;
  top: 18px;
  left: 50%;
  translate: -50% 0;
  width: min(var(--max), 100% - 2 * var(--gutter));
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  > * { pointer-events: auto; }
}
/* a band of paper across the top of the screen, fading down, so the logo and Contact stay legible
   over the drawing and the text scrolling beneath them */
body::before {
  content: "";
  position: fixed;
  z-index: 45;
  inset: 0 0 auto;
  /* solid paper as far as the nav reaches, then a short fade: text scrolling under the nav is hidden,
     never half seen through it (the client saw ghost lines beside the logo) */
  height: 112px;
  background: linear-gradient(to bottom,
    var(--paper) 0%,
    var(--paper) 66%,
    color-mix(in srgb, var(--paper) 70%, transparent) 84%,
    transparent 100%);
  pointer-events: none;
}
.nav__brand img { height: 40px; width: auto; margin-left: -10px; } /* the leaf and the name; the file has a little room around it */
/* in the opening scene the large logo stands in for the small one */
.nav__brand { transition: opacity 0.6s; }
html.at-top .nav__brand { opacity: 0; pointer-events: none; }
.nav__end { display: flex; align-items: center; gap: 1.6rem; }
/* on a wide screen the bar is held to the content's width; its right end moves out toward the edge (up
   to an inch, never closer than 28 px to it), so it covers less of the drawing as you scroll */
:root { --nav-out: 0px; }
@media (min-width: 821px) {
  :root { --nav-out: clamp(0px, (100vw - min(var(--max), 100vw - 2 * var(--gutter))) / 2 - 28px, 96px); }
  .nav__end { translate: var(--nav-out) 0; }
}
/* the sound switch: four hairlines, still when it is off, swaying a little when it is on */
.nav__sound {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  &:hover { color: var(--green-deep); }
  &:focus-visible { outline: 1px solid var(--green-deep); outline-offset: 4px; }
}
.nav__sound-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
  i { display: block; width: 1px; height: 11px; background: currentColor; transform-origin: bottom; transform: scaleY(0.35); transition: transform 0.4s; }
  i:nth-child(2) { transform: scaleY(0.7); }
  i:nth-child(3) { transform: scaleY(0.5); }
  i:nth-child(4) { transform: scaleY(0.25); }
}
html.sound-on .nav__sound { color: var(--ink); }
html.sound-on .nav__sound-bars i { animation: sway 1.6s ease-in-out infinite alternate; }
html.sound-on .nav__sound-bars i:nth-child(2) { animation-duration: 1.2s; animation-delay: -0.4s; }
html.sound-on .nav__sound-bars i:nth-child(3) { animation-duration: 1.9s; animation-delay: -0.9s; }
html.sound-on .nav__sound-bars i:nth-child(4) { animation-duration: 1.4s; animation-delay: -0.2s; }
@keyframes sway { from { transform: scaleY(0.3); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { html.sound-on .nav__sound-bars i { animation: none; transform: scaleY(0.7); } }
@media (max-width: 640px) { .nav__end { gap: 1rem; } .nav__sound { min-height: 44px; padding: 0 0.3rem; font-size: 0.9rem; } }
@media (pointer: coarse) { .nav__sound { display: none; } } /* no sound on touch screens (assets/sound.js) */
@media (max-width: 350px) { .nav__sound-word { display: none; } .nav__sound { min-width: 44px; justify-content: center; } }
.nav__link {
  padding: 0.4rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  &:hover { color: var(--green-deep); }
}

/* ---------- depth: a three.js world behind the page (progressive enhancement) ---------- */
/* watercolor washes on the paper, under the drawing: the shader draws the paper itself, tinted by
   the washes, so no blending with the page is needed */
/* The drawn layers live in the page, not fixed to the screen: each canvas covers the screen plus a
   margin above and below, and is moved to where the page is whenever it is redrawn. In between,
   the browser scrolls it together with the text, so the drawing never lags or swims behind the
   words, even when a frame is late (phones). The layer is as tall as the page and clips. */
.layers {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}
.wash, .world {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  pointer-events: none;
  will-change: transform;
}
/* the watercolor lies over the drawing, as paint over a sketch, so the background trees don't cross it */
.world { z-index: 0; }
.wash { z-index: 1; }
/* the watercolor without WebGL (assets/wash-cpu.js, only a fallback): painted tiles, in page coordinates,
   each fading in where the shader would have bloomed it; where the shader's canvas would be (over the drawing) */
.wash-cpu { position: absolute; left: 0; top: 0; z-index: 1; width: 100%; height: 0; overflow-x: clip; pointer-events: none; }
.wash-tile { position: absolute; display: block; pointer-events: none; opacity: 0; transition: opacity 1.6s cubic-bezier(0.2, 0.6, 0.3, 1); }
.wash-tile.is-on { opacity: 1; }
.wash-tile.instant { transition: none; }
/* without the 3D world only (main.js flatFx): faint trees at their page places, still,
   and the pulses along the strands and into the roots */
.flat-trees { position: absolute; z-index: 0; overflow: hidden; pointer-events: none; }
.flat-trees svg { position: absolute; overflow: visible; will-change: opacity; }
.flat-pulses { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; will-change: transform; }
.roots-pulse { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.labels { z-index: 2; }
/* once the 3D world is up it draws the vine, decorations and roots; the SVG stays as the fallback */
html.has-depth .spine,
html.has-depth .roots { visibility: hidden; }
.fruit--depth { will-change: transform; }
html.has-depth .fruit, html.has-depth .apple { will-change: transform; }

/* labels in 3D: screen-facing HTML that rides a point in the world */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; } /* in page coordinates, inside .layers */
.label3 {
  position: absolute;
  left: 0;
  top: 0;
  font: italic 400 14px var(--serif);
  font-size-adjust: var(--serif-adjust);
  color: var(--ink-3);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.8s ease-out;
  &.is-on { opacity: 1; }
}

/* ---------- the story canvas ---------- */
.story { position: relative; overflow: clip; }
.spine {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}
.vine, .strand { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.head__dot { fill: var(--ink); }
.head__ring { fill: none; stroke: var(--ink); stroke-opacity: 0.18; }
.head { transition: opacity 0.4s; }

.draw { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.pop { transform: scale(0); transform-origin: 0 0; }
.fade { opacity: 0; }
.deco.is-on {
  .draw { stroke-dashoffset: 0; transition: stroke-dashoffset 1s cubic-bezier(0.5, 0.05, 0.3, 1); }
  .pop { transform: scale(1); transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.3, 1.15); }
  .fade { opacity: 1; transition: opacity 0.9s ease-out 0.3s; }
}
.deco.instant * { transition: none !important; }

.tag { font: italic 400 14px var(--serif); font-size-adjust: var(--serif-adjust); fill: var(--ink-3); }
.flow { stroke-dasharray: 0.1 7; }
@media (prefers-reduced-motion: no-preference) {
  .flow.is-live { animation: flow 5s linear 3; }
}
@keyframes flow { to { stroke-dashoffset: 71; } }

/* ---------- ASCII fruit (12px, scaled with transforms) ---------- */
.ascii {
  margin: 0;
  font-family: var(--mono);
  font-size-adjust: none; /* the drawings keep their exact character grid */
  font-weight: 500;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  text-align: left; /* buttons center text by default, which would shift each row */
  white-space: pre;
  font-variant-ligatures: none;
  --fo: #3D120C; --fd: #5E1D13; --fm: #7B2A1E; --fl: #A05A48; --fx: #C48E80;
  .to { color: var(--fo); }
  .td { color: var(--fd); }
  .tm { color: var(--fm); }
  .tl { color: var(--fl); }
  .tx { color: var(--fx); }
  .ts { color: #3E3E38; }
  .tf { color: #5E6E5A; }
  .tb { color: #A7B0A3; } /* a leaf turned away, behind the fruit */
  .tg { color: var(--node); } /* the living seed */
}
.fruits { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.fruit, .apple { position: absolute; left: 0; top: 0; }
/* a fruit is a thing, not text: no grey tap flash on a phone, no selecting its characters, and no
   copy/look-up menu when a finger rests on it */
.fruit, .apple, .fruit .ascii, .apple .ascii {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* a hanging fruit can be picked: click it and it falls */
.fruit--hang.is-ripe, .fruit--hang.is-showing { pointer-events: auto; cursor: pointer; }
/* the copies in the monoculture are drawn small and grey: slightly heavier strokes so they hold */
.fruit--frozen .ascii { -webkit-text-stroke: 0.35px currentColor; }
.fruit--hang::after { content: ""; position: absolute; inset: -8px; } /* a little room round it: it sways */
.fruit--hang.is-dropped { pointer-events: none; }
.fruit .ascii, .apple .ascii { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
/* the cut apple is drawn small and mostly in fine marks, so its strokes are thickened to hold their color */
.fruit--cut .ascii { -webkit-text-stroke: 0.55px currentColor; }
@media (max-width: 820px) { .fruit--cut .ascii { -webkit-text-stroke: 0.9px currentColor; } }

/* the fruit in the grass can be picked up; it fades in as the grass grows up to it */
.fruit--toy {
  opacity: 0;
  transition: opacity 1.1s ease-out;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  &.is-on { opacity: 1; }
  &.instant { transition: none; }
  &.is-held { cursor: grabbing; }
}

.apple {
  padding: 0;
  border: 0;
  border-radius: 45%;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  &.is-landed { cursor: default; pointer-events: none; }
}
.swing { position: absolute; inset: 0; transform-origin: var(--ox, 50%) var(--oy, 0); }
@media (prefers-reduced-motion: no-preference) {
  /* (no hover tilt: the apple keeps its own swing whatever the mouse does, main.js animateFruits) */
  .apple.nudge .swing { animation: nudge 0.9s ease-out; }
}
@keyframes nudge {
  20% { rotate: 7deg; }
  45% { rotate: -5deg; }
  70% { rotate: 2.5deg; }
  100% { rotate: 0deg; }
}

/* ---------- scenes ---------- */
.scene {
  position: relative;
  z-index: 1;
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 7vw, 120px);
  align-items: center;
  padding-block: clamp(80px, 14vh, 170px);
}
.scene--flip .stage { order: -1; }
.stage { height: clamp(440px, 62vh, 600px); }

.copy__inner { max-width: 29rem; }
.copy h2 { margin-bottom: 1.3rem; font-size: clamp(2rem, 3.3vw, 2.9rem); line-height: 1.1; }
.copy p { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }
.copy h2:focus { outline: none; }


/* hero: one phrase and an apple */
.scene--hero {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: 100svh;
  gap: 0;
  padding-block: 0 11vh;
  text-align: center;
  h1 { max-width: 7.2em; /* the 15 figures wide it was set at */ font-size: clamp(2.6rem, min(5.4vw, 8.6vh), 4.8rem); line-height: 1.04; }
}
/* the logo, right above the title; it grows in along its strokes, drawn on a canvas over the picture
   (main.js, growLogo), then the picture itself is shown again */
.hero-logo {
  position: relative;
  display: block;
  /* smaller than the title, so the two don't compete (client notes): the line leads, the mark signs it */
  width: clamp(112px, min(11.5vw, 20vh), 172px);
  margin-bottom: clamp(0.7rem, 2vh, 1.2rem);
  img { display: block; width: 100%; height: auto; }
  canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
}
html.logo-grows .hero-logo img, .hero-logo.is-growing img { visibility: hidden; }
/* short screens: the apple hangs from the top, so the logo and title sit lower and closer */
@media (max-height: 760px) and (min-width: 821px) {
  .scene--hero { padding-bottom: 6vh; }
  .hero-after { margin-top: 1.1rem; }
}
/* under the title, once the apple is picked: what Prosper is (it keeps its room before, so nothing moves) */
.hero-after { display: grid; justify-items: center; margin-top: 1.8rem; }
.hero-after > * { grid-area: 1 / 1; margin: 0; }
/* a short paragraph under the title, set large and dark enough to hold its own beside it (V3 notes:
   at the reading size it got lost under the big line) */
.hero-what {
  max-width: 31em;
  font-size: clamp(1.14rem, 1.5vw, 1.4rem);
  line-height: 1.5;
  text-wrap: pretty;
  color: var(--ink);
  opacity: 0;
  transition: opacity 1.2s ease 0.5s;
}
html.is-free .hero-what { opacity: 1; }
/* short screens: the paragraph runs wider (three lines), the title a little smaller, and all of it
   clears the bottom bar and stays under the hanging apple */
@media (max-height: 760px) and (min-width: 821px) {
  .scene--hero { padding-bottom: 78px; }
  .scene--hero h1 { font-size: clamp(2.4rem, min(5vw, 7.2vh), 4.4rem); }
  .hero-logo { width: clamp(100px, min(10vw, 17vh), 150px); margin-bottom: 0.6rem; }
  .hero-after { margin-top: 0.9rem; }
  .hero-what { max-width: 42em; font-size: 1.08rem; line-height: 1.45; }
}
/* phones: the paragraph keeps clear of the vine down the right side */
@media (max-width: 820px) {
  .hero-what { max-width: min(30em, 80vw); font-size: 1.1rem; line-height: 1.45; }
}
/* the vision, set apart: one statement floating in the space between the opening and the first
   chapter, with the vine passing beside it */
.interlude {
  position: relative;
  z-index: 2;
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: clamp(120px, 24vh, 260px) clamp(30px, 6vh, 80px);
  text-align: center;
  p {
    max-width: 21em;
    margin: 0 auto;
    font-family: var(--serif);
    font-size-adjust: var(--serif-adjust);
    font-size: clamp(1.5rem, 2.3vw, 2.05rem);
    line-height: 1.3;
    color: var(--ink);
    letter-spacing: -0.01em;
    text-wrap: balance;
  }
}
@media (max-width: 820px) {
  .interlude { padding-block: 124px 40px; } /* well clear of the opening; room under it for the vine to cross to the left margin */
  .interlude p { max-width: min(21em, 78vw); font-size: 1.32rem; }
}

/* what people are noticing, laid out as the notes' sketch (in the site's paper and ink): a hairline card
   with a head line and the count, one quote at a time (main.js, initVoices), field · publication ·
   author under it, and every publication it's reported across. Every quote sits in the same grid cell,
   so the card is as tall as the longest one and nothing around it moves as they turn */
.voices {
  max-width: 30rem;
  margin: 0;
  padding: 16px 20px 18px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 88%, white);
}
.voices__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 0.9rem; }
.copy p.voices__title { margin: 0; font-size: 0.85rem; line-height: 1.3; color: rgba(20, 22, 20, 0.66); }
/* the room keeps the tallest quote's space (main.js sets its min-height); the card inside grows and
   shrinks to fit the quote it shows, so it's never half empty */
.voices-room { margin: 2rem 0 0; }
.voices__deck {
  display: grid;
  overflow-x: visible;
  overflow-y: clip; /* a longer quote fading out doesn't spill while the card closes up */
  transition: height 0.55s cubic-bezier(0.3, 0, 0.2, 1);
}
.voice {
  grid-area: 1 / 1;
  align-self: start; /* its own height, not the cell's, so the card can fit it */
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0s linear 0.6s;
  blockquote { margin: 0; }
  blockquote p {
    margin: 0;
    font-family: var(--serif);
    font-size-adjust: var(--serif-adjust);
    font-size: clamp(1.3rem, 1.7vw, 1.55rem);
    line-height: 1.25;
    color: var(--ink);
    text-indent: -0.4em; /* the opening quote mark hangs in the margin */
  }
  figcaption { margin-top: 0.7rem; font-size: 0.9rem; line-height: 1.4; color: rgba(20, 22, 20, 0.7); }
  figcaption a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
  figcaption a:hover { color: var(--green-deep); }
}
.voice.is-on { opacity: 1; visibility: visible; transition: opacity 0.6s ease 0.2s, visibility 0s; }
.voices__ctrl { display: flex; align-items: center; gap: 0.2rem; font-size: 0.85rem; color: rgba(20, 22, 20, 0.66); }
.voices__btn {
  appearance: none;
  margin: -6px 0;
  padding: 6px 7px;
  border: 0;
  border-radius: 4px;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  &:hover { color: var(--ink); }
  &:focus-visible { outline: 1px solid var(--ink); outline-offset: 1px; }
}
.voices__count { min-width: 3.6em; text-align: center; font-variant-numeric: tabular-nums; }
.voices__across {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--hair);
  .copy & p:not(.voices__title) { margin: 0.25rem 0 0; font-size: 0.85rem; line-height: 1.45; color: var(--ink-2); }
}
@media (prefers-reduced-motion: reduce) {
  .voice, .voice.is-on, .voices__deck { transition: none; }
}

.scene--more {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 24px;
  padding-bottom: 0;
  .copy__inner { max-width: 34rem; }
  .copy h2 { font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 1.04; }
  .stage { width: 100%; height: clamp(340px, 50vh, 480px); }
}
.plant {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: center;
  gap: 14px 18px;
  max-width: calc(29rem + 18px); /* the story spans the width of name and email side by side */
  margin: 2.2rem auto 0;
  text-align: left;
}
.field {
  display: grid;
  gap: 0.2rem;
  label { font-size: 0.95rem; color: var(--ink-3); }
  input, textarea {
    width: 14.5rem;
    min-height: 46px;
    padding: 0.4rem 0;
    border: 0;
    border-bottom: 1px solid #767676;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: max(1.05rem, 1em);
  }
  :is(input, textarea):focus-visible { outline: none; border-bottom-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
  :is(input, textarea):user-invalid { border-bottom-color: #A3321F; }
}
.field__opt { opacity: 0.8; }
/* the story: a few lines to write in, growing with what's written where the browser can */
.field--story, .field--long {
  flex-basis: 100%;
  textarea {
    width: 100%;
    min-height: 4rem;
    max-height: 16rem;
    line-height: 1.5;
    resize: none;
    field-sizing: content;
  }
}
.plant__status { flex-basis: 100%; min-height: 1.5em; text-align: center; font-style: italic; color: var(--ink-2); }
/* the line that opens the form, over the name and the email */
.copy p.plant__lead { flex-basis: 100%; margin: 0 0 0.4rem; text-align: center; font-family: var(--serif); font-size-adjust: var(--serif-adjust); font-size: 1.35rem; line-height: 1.3; color: var(--ink); }

@media (max-width: 820px) {
  .scene { grid-template-columns: 1fr; gap: 28px; padding-block: 40px; } /* a chapter's words close under the drawing before them */
  .scene--flip .stage { order: 0; }
  .copy { padding-left: 30px; }
  .stage { height: 400px; }
  .scene--more .copy { padding-left: 0; }
  .hero-logo { width: min(38vw, 164px); margin-bottom: 1rem; }
  /* close to where it always sat, with just enough room for the line under the title to clear the bottom bar */
  .scene--hero { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .hero-after { margin-top: 1.1rem; }
  /* the form stacks into one centered column: fields and button share a width, labels and text centered */
  .plant { flex-direction: column; align-items: stretch; width: min(100%, 21rem); margin-inline: auto; gap: 18px; }
  .field { text-align: center; }
  .field input { width: 100%; text-align: center; }
  .field--story textarea { text-align: left; }
  .plant .btn { width: 100%; margin-top: 4px; }
  .plant__status { flex-basis: auto; }
}

/* reveals: decorative, progressive enhancement */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .copy__inner, .interlude p {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 10% entry 60%;
    }
  }
}
@keyframes rise { from { opacity: 0; translate: 0 24px; } }

/* ---------- review plate (?specimens) ---------- */
.plate {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 56px 64px;
  padding: 64px var(--gutter);
  figure { margin: 0; display: grid; gap: 14px; justify-items: center; }
  figcaption { font-style: italic; font-size: 0.95rem; color: var(--ink-3); }
}
.plate__fruit { position: relative; }
.plate__fruit .ascii { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* ---------- the roots ---------- */
.roots-footer {
  position: relative;
  overflow: hidden;
  @media (min-width: 821px) { padding-bottom: 0 !important; }
  min-height: 100svh;
  /* the grid fills the footer, so on a tall screen the base row still sits at the very bottom */
  display: flex;
  flex-direction: column;
  padding: clamp(160px, 24vh, 260px) var(--gutter) 36px;
  background: transparent;
  color: var(--ink-2);
  h2 { font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.06; margin-bottom: 1.1rem; }
}
.roots { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
/* text in the footer sits on soft patches of paper, feathered so the roots fade out behind it */
/* The patches lie on a layer under all the footer's text, so one never covers the words next to it (a
   patch on each grid item painted over its neighbours and faded them on phones). */
.f-intro, .person { position: relative; }
.f-intro::after, .person::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--paper);
  box-shadow: 0 0 34px 26px var(--paper);
  pointer-events: none;
}
.f-base { box-shadow: 0 0 34px 26px var(--paper); }
.rnode { transform: scale(0); transform-origin: 0 0; transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.3, 1.3); }
.rnode.is-on { transform: scale(1); }
.rfade { opacity: 0; transition: opacity 1s; }
.rfade.is-on { opacity: 1; }
.rlabel { font: italic 400 14px var(--serif); font-size-adjust: var(--serif-adjust); fill: var(--ink-3); }

.f-grid {
  position: relative;
  z-index: 1;
  width: min(var(--max), 100%);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr clamp(140px, 16vw, 240px) 1fr;
  grid-template-areas:
    "intro . ."
    "base base base";
  grid-template-rows: auto 1fr; /* any spare height goes above the base row */
  flex: 1 0 auto;
  row-gap: clamp(72px, 12vh, 140px);
  align-items: start;
}
.f-intro {
  grid-area: intro;
  justify-self: end;
  max-width: 26rem;
  padding: 18px 0;
  p { color: var(--ink-2); }
}
.f-people { grid-area: people; display: grid; gap: 40px; max-width: 25rem; }
.person {
  padding: 6px 0;
  h3 { font-size: 1.45rem; }
  .role { margin: 0.2rem 0 0.6rem; font-style: italic; color: var(--ink-3); }
  p:not(.role) { font-size: 1.02rem; color: var(--ink-2); }
}
.f-base {
  grid-area: base;
  align-self: end;
  position: relative;
  /* the last line of the page, static (one page, so no bar floats over the story): the copyright at
     the left, the leaf in the middle, where the taproot goes down */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--hair);
  background: var(--paper);
  flex-wrap: wrap;
  gap: 18px 32px;
  font-size: 0.95rem;
  color: var(--ink-3);
  /* the copyright where the logo was (V4 notes: the logo at the top is enough), and every page */
  .f-base__copy { margin: 0; line-height: 34px; white-space: nowrap; }
  .f-base__leaf { grid-column: 2; display: block; width: auto; height: 28px; margin-block: -5px; }
  .f-nav ul { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; padding: 0; list-style: none; }
  .f-nav a { font-size: 1.05rem; color: var(--ink); text-decoration: none; }
  .f-nav a:hover { color: var(--green-deep); }
  /* on a wide screen it spans the top bar exactly: from under its logo to under its "Contact" (which
     sits out past the content, --nav-out), at the very foot of the page, the same bar as the other
     pages' footer settles into */
  @media (min-width: 821px) {
    padding: 14px 0 calc(16px + env(safe-area-inset-bottom));
    .f-nav ul { line-height: 34px; }
    .f-nav a { display: block; font-size: 1.08rem; }
  }
  /* the foot of the page is plain paper, edge to edge: no roots, grass or wash show behind it */
  &::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 -100vw -36px; /* down through the footer's bottom padding */
    background: var(--paper);
  }
}

/* ---------- the dock ----------
   The footer's links ride along at the foot of the screen, either side of a small node where the
   vine runs through. It stays, centered, to the very end of the page; there the copyright fades in at
   its left (is-end, set by main.js). */
.dock {
  --dock-gap: clamp(20px, 2.6vw, 40px); /* one gap between every word and the leaf */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--dock-gap);
  padding: 14px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
  transition: opacity 0.9s ease-out, translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0.9s;
  &::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: color-mix(in srgb, var(--paper) 84%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--hair);
  }
}
html:not(.is-free) .dock { opacity: 0; visibility: hidden; translate: 0 24px; }
.dock__copy {
  position: absolute;
  left: max(var(--gutter), (100% - var(--max)) / 2); /* under the top bar's logo */
  bottom: calc(16px + env(safe-area-inset-bottom));
  margin: 0;
  font-size: 0.95rem;
  line-height: 19px;
  white-space: nowrap;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.dock.is-end .dock__copy { opacity: 1; }
.dock__side {
  display: flex;
  gap: var(--dock-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.dock__side--l { justify-content: flex-end; }
.dock__side a {
  position: relative;
  display: inline-block;
  font-size: 1.08rem;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
  pointer-events: auto;
  &:hover { color: var(--green-deep); }
  &::after { content: ""; position: absolute; inset: -10px -8px; } /* a comfortable target */
}
/* the leaf from the logo, where the bar's two halves meet */
.dock__node {
  display: block;
  width: auto;
  height: 28px;
  margin-block: -5px; /* bigger, without making the bar taller */
}

@media (max-width: 820px) {
  /* on a phone the four words and the leaf share one row (the two lists step aside), centered, with
     even gaps a quarter narrower than spreading them from padding to padding would give: the five
     items take 209.6px, so a full spread gap is (row - 209.6px) / 4 and three quarters of it is
     18.75% of the row less 39.3px. It is drawn like the footer's last line (same size, same line,
     same padding, its hairline on the same pixel) */
  .dock { --bar-gap: max(10px, calc(18.75% - 39.3px)); display: flex; align-items: center; justify-content: center; column-gap: var(--bar-gap); padding-top: 15px; }
  .dock__side { display: contents; line-height: 26px; }
  .dock__side a { font-size: 0.92rem; line-height: 26px; white-space: nowrap; }
  /* small enough to sit clear of the centered words on a 360px screen */
  .dock__copy { left: var(--gutter); font-size: 0.75rem; line-height: 26px; }
}
/* on touch screens a live blur under a fixed bar costs every scrolled frame: plain paper instead */
@media (pointer: coarse) {
  .dock::before {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: color-mix(in srgb, var(--paper) 95%, transparent);
  }
}

@media (max-width: 820px) {
  .roots-footer { padding-left: 52px; }
  .f-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "intro" "base";
    grid-template-rows: auto 1fr;
    row-gap: 56px;
  }
  .f-intro { justify-self: start; }
  /* one line on a phone, the same bar as the other pages' footer: edge to edge with its hairline,
     the copyright at the left gutter, the pages flush with the right one, at the foot of the page */
  .roots-footer { padding-bottom: 0; }
  .f-base {
    flex-wrap: nowrap;
    gap: 12px;
    margin: 0 calc(-1 * var(--gutter)) 0 -52px;
    padding: 14px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  }
  .f-base .f-base__copy { font-size: 0.92rem; line-height: 26px; }
  .f-base .f-nav ul { flex-wrap: nowrap; justify-content: flex-end; gap: 12px; line-height: 26px; }
  .f-base .f-nav a { display: block; font-size: 0.92rem; white-space: nowrap; }
}
/* the narrowest phones: a little tighter, so the copyright and the four pages keep to one line inside the gutters */
@media (max-width: 380px) {
  .f-base { gap: 10px; }
  .f-base .f-base__copy { font-size: 0.86rem; }
  .f-base .f-nav ul { gap: 10px; }
}

/* ---------- the other pages: vision, documentation, careers ----------
   The story's paper, ink and serif, read like an essay: a heading and a lede, then sections that
   alternate a figure and a column of text, one vine drawing down the margin (assets/page.js). */
body.doc .nav__brand { opacity: 1; pointer-events: auto; }
.doc-main {
  position: relative;
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(130px, 18vh, 190px) 0 clamp(80px, 10vw, 140px);
}
/* the watercolor (assets/wash.js): a page-sized, clipped layer under the text and the drawings */
body.doc { position: relative; }
/* nothing reaches past the sides of the screen: the paper glow behind a text block runs 48px beyond it,
   which on a phone (text from gutter to gutter) made the page wider than the screen, so phones zoomed
   out and the bottom bar sat below it. Clipped, not hidden: the sticky bottom bar keeps working. */
html:has(> body.doc), body.doc { overflow-x: clip; }
.doc-paint { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.doc-paint canvas { position: absolute; left: 0; top: 0; display: block; }
body.doc .doc-main, body.doc .doc-foot { position: relative; z-index: 1; }
.doc-vine { position: absolute; left: calc(-0.5 * var(--gutter) - 40px); top: 0; overflow: visible; pointer-events: none; }
.doc-leaf, .doc-node { opacity: 0; transition: opacity 0.6s; }
.doc-leaf.is-on { opacity: 0.85; }
.doc-node.is-on { opacity: 1; }
.doc-head, .doc-sec, .doc-end, .doc-cases { margin-left: clamp(0px, 7vw, 110px); }
.doc-head { max-width: 46rem; margin-bottom: clamp(90px, 12vw, 150px); }
.doc-head h1 { margin-bottom: 1.5rem; font-size: clamp(2.6rem, 5.2vw, 4.5rem); line-height: 1.04; }
.doc-head .lede { font-size: clamp(1.22rem, 1.7vw, 1.48rem); line-height: 1.5; color: var(--ink-2); }
.doc-sec {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  margin-bottom: clamp(90px, 12vw, 160px);
}
.doc-sec--flip { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.doc-sec--flip .doc-fig { order: 2; }
.doc-fig { display: flex; justify-content: center; min-width: 0; }
.fig[data-fig] { position: relative; }
.fig[data-fig] > .fruit-at { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fig[data-fig] .ascii { -webkit-text-stroke: 0.4px currentColor; } /* a touch heavier, to hold against the washes */
.doc-text { max-width: 31rem; }
.doc-text h2, .doc-end h2 { margin-bottom: 1.2rem; font-size: clamp(2rem, 3.2vw, 2.8rem); line-height: 1.1; }
.doc-text p, .doc-end p { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }
.doc-text p + p { margin-top: 1rem; }
.doc-text ul { margin: 1.1rem 0 0; padding: 0; list-style: none; }
.doc-text li { position: relative; padding-left: 1.3rem; font-size: 1.1rem; line-height: 1.5; color: var(--ink-2); }
.doc-text li + li { margin-top: 0.5rem; }
.doc-text li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--node); }
.doc-note { margin-top: 1rem; font-style: italic; font-size: 1rem; color: var(--ink-3); }
.doc-cases {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px);
  margin-bottom: clamp(90px, 12vw, 160px);
}
.doc-case h3 { margin: 1.2rem 0 0.6rem; font-size: 1.5rem; line-height: 1.15; }
.doc-case p { font-size: 1.05rem; line-height: 1.55; color: var(--ink-2); }
.doc-case .fig { margin: 0 auto; }
.doc-end { max-width: 36rem; }
.doc-end .btn { margin-top: 1.6rem; }
.doc-person + .doc-person { margin-top: 1.6rem; }
.doc-person h3 { font-size: 1.45rem; }
.doc-person .role { margin: 0.15rem 0 0.5rem; font-style: italic; font-size: 1rem; color: var(--ink-3); }
.doc-foot {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin: 0 auto;
  padding: 28px 0 40px;
  border-top: 1px solid var(--hair);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  ul { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; padding: 0; list-style: none; }
  a { text-decoration: none; color: var(--ink); font-size: 1.05rem; }
  a:hover, a[aria-current="page"] { color: var(--green-deep); }
  a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
  img { height: 34px; width: auto; margin-left: -8px; }
  small { color: var(--ink-3); font-size: 0.9rem; }
}
/* The other pages' footer is the story's bottom bar: it rides at the foot of the screen as you read
   and stays just as it is, centered, at the end of the page (V4 notes: no logo-left, links-right
   footer on these pages). */
.doc-dock {
  --dock-gap: clamp(20px, 2.6vw, 40px);
  --side: max(var(--gutter), (100% - var(--max)) / 2); /* where the top bar's logo starts */
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 14px var(--side) calc(16px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-top: 1px solid var(--hair);
  pointer-events: none; /* only its links take clicks */
}
.doc-dock a { pointer-events: auto; }
.doc-dock__links {
  display: flex;
  align-items: center;
  justify-content: center; /* centered like the landing page's bar */
  gap: var(--dock-gap);
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 34px;
  a { display: block; font-size: 1.08rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
  a:hover, a[aria-current="page"] { color: var(--green-deep); }
}
.doc-dock__leaf {
  display: flex;
  max-width: 20px;
  img { display: block; height: 28px; width: auto; margin-block: -5px; }
}
@media (max-width: 820px) {
  .doc-dock { --dock-gap: 12px; }
  .doc-dock__links {
    gap: max(10px, calc(18.75% - 39.3px)); /* the landing page's bar, same gaps */
    line-height: 26px;
    a { font-size: 0.92rem; }
  }
}

/* settling in */
html.doc-ready .doc-head, html.doc-ready .doc-sec, html.doc-ready .doc-end, html.doc-ready .doc-cases > *,
html.doc-ready .doc-block, html.doc-ready .doc-grid > * {
  opacity: 0;
  translate: 0 18px;
  transition: opacity 0.9s ease, translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.doc-ready .is-in { opacity: 1 !important; translate: 0 0 !important; }
@media (prefers-reduced-motion: reduce) {
  html.doc-ready .doc-head, html.doc-ready .doc-sec, html.doc-ready .doc-end, html.doc-ready .doc-cases > *,
  html.doc-ready .doc-block, html.doc-ready .doc-grid > * { opacity: 1; translate: none; transition: none; }
}
@media (max-width: 760px) {
  .doc-vine { display: none; } /* no margin to draw it in: it would run through the text */
  .doc-head, .doc-sec, .doc-end, .doc-cases { margin-left: 0; }
  .doc-sec, .doc-sec--flip { grid-template-columns: 1fr; gap: 28px; }
  .doc-sec--flip .doc-fig { order: 0; }
  .doc-cases { grid-template-columns: 1fr; gap: 56px; }
  .doc-foot { justify-content: center; text-align: center; ul { justify-content: center; } }
}

.doc-text .btn { margin-top: 1.4rem; }
.doc-case__fig { height: 190px; display: flex; align-items: flex-end; justify-content: center; }

/* a heading and a few lines on their own, introducing what follows (careers) */
.doc-block { max-width: 46rem; margin: 0 0 clamp(36px, 4.5vw, 56px) clamp(0px, 7vw, 110px); }
.doc-block h2 { margin-bottom: 1rem; font-size: clamp(2rem, 3.2vw, 2.8rem); line-height: 1.1; }
.doc-block p { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); }
.doc-grid { display: grid; gap: clamp(32px, 5vw, 80px); margin: 0 0 clamp(90px, 12vw, 160px) clamp(0px, 7vw, 110px); }

/* cards and traits: figures over a few lines */
.doc-card__fig { height: 210px; display: flex; align-items: flex-end; justify-content: center; }
.doc-card h3 { margin: 1.5rem 0 0.15rem; font-size: 1.6rem; line-height: 1.15; }
.doc-card .role { margin-bottom: 0.7rem; font-style: italic; font-size: 1rem; color: var(--ink-3); }
.doc-card p:not(.role) { font-size: 1.1rem; line-height: 1.55; color: var(--ink-2); }
.doc-trait__fig { height: 160px; display: flex; align-items: flex-end; justify-content: center; }
.doc-trait .trait { margin-top: 1.2rem; text-align: center; font-size: clamp(1.3rem, 1.9vw, 1.6rem); line-height: 1.25; color: var(--ink); }
@media (max-width: 760px) {
  .doc-block, .doc-grid { margin-left: 0; }
}

/* ---------- loading ----------
   Only the logo shows, growing where it stays above the title; once the world is built, everything
   else fades in around it (main.js removes is-loading). */
html.is-loading .nav,
html.is-loading .dock,
html.is-loading .layers,
html.is-loading .roots-footer,
html.is-loading .story > :not(.scene--hero),
html.is-loading .scene--hero > :not(.hero-logo) { opacity: 0; }
html.is-loading body::before { opacity: 0; }
html.is-revealing .nav,
html.is-revealing .dock,
html.is-revealing .layers,
html.is-revealing .roots-footer,
html.is-revealing .story > :not(.scene--hero),
html.is-revealing .scene--hero > :not(.hero-logo),
html.is-revealing body::before { transition: opacity 1.2s cubic-bezier(0.3, 0, 0.2, 1); }

/* a nav place kept for a page that isn't there yet (Placeholder): it reads like its neighbours but isn't a link */
a:not([href]), .doc-dock a:not([href]) { pointer-events: none; cursor: default; }

/* a light underglow of paper under the text, so it reads where it crosses the watercolor (client notes):
   one soft gradient behind each block of text, drawn once. (A blurred text-shadow on every line looked
   the same but roughly doubled the rastering while scrolling, which phones felt as a less smooth page.) */
.copy__inner, .hero-after, .interlude p,
body.doc .doc-main :is(.doc-head, .doc-text, .doc-block, .doc-end, .doc-trait) {
  position: relative;
  isolation: isolate;
}
.copy__inner::before, .hero-after::before, .interlude p::before,
body.doc .doc-main :is(.doc-head, .doc-text, .doc-block, .doc-end, .doc-trait)::before {
  content: "";
  position: absolute;
  inset: -34px -48px;
  z-index: -1;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--paper) 78%, transparent) 0%,
    color-mix(in srgb, var(--paper) 62%, transparent) 55%,
    transparent 100%);
  pointer-events: none;
}
/* and a tight halo of paper around the letters themselves, where they cross the color (small blurs only:
   the 16px one was what made scrolling heavy) */
.copy :is(h2, p, label, figcaption), .hero-what, .interlude p,
body.doc .doc-main :is(h1, h2, h3, p, li, figcaption, label, dt, dd) {
  text-shadow: 0 0 2px var(--paper), 0 0 5px var(--paper), 0 0 5px var(--paper);
}
