/* ============================================================
   "The Formative Turn" — the big sheet.

   One continuous expanse of warm paper, viewport-wide. Everything
   on it reads as pen: blue-black ink for words, three semantic
   pens for the argument's eras (blue = innate, red = schooling,
   green = after AI), mono for annotations. A faint engineering
   grid appears only where work is happening (under figures).
   Words move in three registers: spine, wander, scale-break.
   Space itself argues: expansive, then constricted (the warp),
   then open again.

   Identity validated live via scratch/identity-big-sheet.html.
   ============================================================ */

:root {
  --paper:  #f9f6ee;   /* warm working paper */
  --ink:    #1c2b3a;   /* blue-black pen, everything reads as ink */
  --faint:  rgba(28, 43, 58, 0.55);
  --grid:   rgba(96, 140, 158, 0.18);

  --blue:   #2d5c8a;   /* pen 1: the innate, the natural */
  --red:    #b83a2a;   /* pen 2: schooling, the warp */
  --green:  #0f7b5f;   /* pen 3: after AI, the turn */
  --accent: var(--blue);  /* studio line-art compatibility */

  --serif:  "Newsreader", Charter, "Iowan Old Style", Georgia, serif;
  --mono:   "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  /* studio aliases */
  --font-serif: var(--serif);
  --font-sans:  var(--mono);
  --text:   var(--ink);
  --muted:  var(--faint);
  --hairline: rgba(28, 43, 58, 0.16);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- the canvas: the whole sheet, no column boundary ---------- */
.canvas {
  width: 100%;
  padding: 0 0 35vh;   /* long tail so there's always "more" below */
}

/* ---------- panels: one unit of thought, full-bleed slots ---------- */
.panel { position: relative; padding: 13vh 6vw; }
.panel p { margin: 0 0 1.1em; }
.panel em { font-style: italic; }
.panel strong { font-weight: 600; }
.panel ul { margin: 0 0 1.1em; padding-left: 1.3em; }
.panel li { margin: 0 0 0.45em; }

/* era weather: nearly subliminal washes a panel can opt into */
.era-innate { background: linear-gradient(180deg, rgba(45,92,138,0.04), rgba(45,92,138,0.0) 70%); }
.era-warp   { background: linear-gradient(180deg, rgba(184,58,42,0.0), rgba(184,58,42,0.05) 40%, rgba(184,58,42,0.0)); }
.era-turn   { background: linear-gradient(180deg, rgba(15,123,95,0.0), rgba(15,123,95,0.045)); }

/* ---------- word registers ---------- */

/* 1. the steady spine: a readable thread walking down the sheet */
.spine { max-width: 62ch; margin-inline: auto; }

/* 2. wandering: text and a figure sharing the open sheet */
.wander {
  display: grid;
  grid-template-columns: minmax(34ch, 46ch) 1fr;
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
  max-width: 1480px;
  margin-inline: auto;
}
.wander--figfirst { grid-template-columns: 1fr minmax(34ch, 46ch); }

/* 3. scale-break: a pivotal sentence set huge across the canvas */
.panel--quote blockquote {
  margin: 0 auto;
  max-width: 1300px;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 5rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-indent: -0.45em;
}
.panel--quote .attrib {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  color: var(--faint);
  margin-top: 2.2em;
  display: block;
}

/* ---------- lead: a sincere statement, larger than spine, smaller than a
   scale-break quote. For the opening promise and its closing line. ---------- */
.lead {
  font-size: clamp(1.45rem, 3vw, 1.95rem);
  line-height: 1.3;
  font-weight: 500;
  margin: 0 0 0.7em;
}
.lead--close { margin-top: 0.9em; }

/* ---------- callout: a key line pulled from the flow ----------
   .callout-key is the big accent line; .callout-lead is the quiet line set
   underneath it as an understated punch line. Accent follows the era via the
   modifier classes (defaults to the blue pen). */
.callout {
  --co-accent: var(--blue);
  max-width: 40ch;
  margin: 2.6em auto;
  padding: 1.25em 1.6em;
  border-left: 3px solid var(--co-accent);
  background: color-mix(in srgb, var(--co-accent) 6%, transparent);
}
.callout--warp { --co-accent: var(--red); }
.callout--turn { --co-accent: var(--green); }
/* drop the left rule; the corner icon carries the accent instead */
.callout--plain { border-left: none; position: relative; padding-right: 4.8em; }
.callout-icon { position: absolute; right: 1.1em; bottom: 1em; width: 40px; height: 40px; opacity: 0.55; }
.callout-icon svg { width: 100%; height: 100%; display: block; }
.callout-lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.42rem;
  line-height: 1.4;
  color: var(--faint);
  margin: 0.7em 0 0;
}
.callout-key {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 1.9rem);
  line-height: 1.2;
  color: var(--co-accent);
  margin: 0;
}

/* ---------- side card: a footnote/aside set beside the spine ---------- */
.aside-row {
  display: grid;
  grid-template-columns: minmax(0, 60ch) minmax(220px, 26ch);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  max-width: 1080px;
  margin-inline: auto;
}
.aside-row .spine { margin-inline: 0; max-width: none; }
.sidecard {
  border-left: 2px solid var(--hairline);
  padding: 0.1em 0 0.2em 1.2em;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--faint);
}
.sidecard .sc-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  margin-bottom: 0.8em;
}
.sidecard p { margin: 0 0 0.7em; }
.sidecard em { font-style: italic; }
@media (max-width: 860px) {
  .aside-row { grid-template-columns: 1fr; }
  .sidecard { margin-top: 0.6em; }
}

/* ---------- a figure with a footnote set to its LEFT ---------- */
.fig-aside-left {
  display: grid;
  grid-template-columns: minmax(220px, 25ch) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
  max-width: 1140px;
  margin-inline: auto;
}
.fig-aside-left > figure { margin: 0; }
@media (max-width: 860px) { .fig-aside-left { grid-template-columns: 1fr; } }

/* ---------- question card: a question held, set apart, in a bordered card ---------- */
.qcard {
  max-width: 42ch;
  margin: 2.2em auto;
  padding: 1.1em 1.5em;
  border: 1.5px solid var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.35;
  text-align: center;
}
/* a question given the floor: bigger, bordered in the warp pen, lots of air */
.qcard--feature {
  max-width: 24ch;
  margin: 5vh auto;
  padding: 1.6em 1.4em;
  border: 2px solid var(--red);
  background: color-mix(in srgb, var(--red) 5%, transparent);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 600;
  font-style: normal;
  line-height: 1.2;
  color: var(--red);
}

/* ---------- annotation pen (mono) ---------- */
.kicker {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--faint);
  margin: 0 0 1.6em;
}

.margin-note {
  position: absolute;
  right: 4vw;
  top: 15vh;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--faint);
  writing-mode: vertical-rl;
}

.figcap {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin: 1.2em 0 0;
}
.pen-b { color: var(--blue); }
.pen-r { color: var(--red); }
.pen-g { color: var(--green); }

/* ---------- inline highlight: more than bold, less than a callout ----------
   a marker swipe sitting low behind the words, in the era's pen. Override the
   pen per use with style="--hi: var(--blue)" etc. */
.hi {
  --hi: var(--red);
  font-weight: 500;
  background-image: linear-gradient(transparent 58%, color-mix(in srgb, var(--hi) 30%, transparent) 0);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 0 0.06em;
  border-radius: 1px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.era-innate .hi { --hi: var(--blue); }
.era-warp .hi { --hi: var(--red); }
.era-turn .hi { --hi: var(--green); }

/* ---------- title panel ---------- */
.panel--title {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.panel--title h1 {
  font-weight: 600;
  font-size: clamp(3.2rem, 10vw, 7.4rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 0 0 0.18em;
}
.turn-arrow {
  width: clamp(140px, 18vw, 230px);
  margin: 0.6rem auto 1.6rem;
  display: block;
  overflow: visible;
}
.scroll-cue {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--faint);
  margin-top: 7vh;
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(7px); }
}

/* ---------- workareas: the grid appears where work happens ---------- */
.workarea { position: relative; }
.workarea::before {
  content: "";
  position: absolute;
  inset: -48px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 45%, transparent 78%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 45%, transparent 78%);
  opacity: 0;
  transition: opacity 1.4s ease-out;
  pointer-events: none;
}
.reveal.is-visible .workarea::before { opacity: 1; }
.workarea svg { position: relative; width: 100%; height: auto; display: block; overflow: visible; }

/* shared in-figure text */
.figname  { font-family: var(--serif); font-weight: 600; }
.figannot { font-family: var(--mono); }
.figfaint { fill: var(--faint); }

/* ---------- ink: figures draw themselves in ----------
   Give any path/line/shape pathLength="1" and class "ink"
   (plus a stroke). Stagger with .d2 - .d5. */
.ink {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.6s ease-out;
}
.reveal.is-visible .ink { stroke-dashoffset: 0; }
.reveal.is-visible .ink.d2 { transition-delay: 0.35s; }
.reveal.is-visible .ink.d3 { transition-delay: 0.7s; }
.reveal.is-visible .ink.d4 { transition-delay: 1.05s; }
.reveal.is-visible .ink.d5 { transition-delay: 1.4s; }

/* ---------- the warp: the sheet physically constricts ---------- */
.panel--warp { padding-top: 18vh; padding-bottom: 18vh; }
.warp-field { position: relative; max-width: 880px; margin-inline: auto; }
.warp-copy {
  max-width: 38ch;
  margin-inline: auto;
  font-size: 1.04rem;
  line-height: 1.52;
}
.warp-label {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--red);
  opacity: 0.55;
  white-space: nowrap;
}

/* ---------- the inquiry loop ---------- */
.loop-wrap { max-width: 640px; margin: 4vh auto 0; }
.orbit { animation: orbit 9s linear infinite; transform-origin: 280px 300px; }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- studio line-art vocabulary (static drawings) ---------- */
.drawing { margin: 1.8em auto; text-align: center; }
.drawing svg { width: 100%; max-width: 420px; height: auto; overflow: visible; }

.line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line--accent { stroke: var(--accent); }
.fill-soft    { fill: var(--hairline); stroke: none; }
.fill-text    { fill: var(--ink); stroke: none; }
.fill-accent  { fill: var(--accent); stroke: none; }

.fig-label {
  font-family: var(--mono);
  font-size: 13px;
  fill: var(--faint);
}

/* ---------- scroll-reveal: one consistent motion ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .ink { stroke-dashoffset: 0; transition: none; }
  .workarea::before { transition: none; }
  .scroll-cue, .orbit { animation: none; }
}

/* ---------- the sheet folds: one generous column ---------- */
@media (max-width: 860px) {
  body { font-size: 1.14rem; }
  .panel { padding: 10vh 6vw; }
  .wander, .wander--figfirst { grid-template-columns: 1fr; }
  .margin-note { display: none; }
}

/* ---------- mobile foundation: readable captions + big touch sliders ----------
   The per-figure bespoke reflows build on this baseline. */
@media (max-width: 640px) {
  .figcap { font-size: 0.92rem; line-height: 1.5; }

  /* big, touch-friendly range sliders in any widget */
  .workarea input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 7px; border-radius: 999px;
    background: var(--hairline); cursor: pointer; margin: 12px 0; touch-action: manipulation;
  }
  .workarea input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 30px; height: 30px;
    border-radius: 50%; background: var(--ink); border: 3px solid var(--paper);
    box-shadow: 0 2px 8px rgba(28, 43, 58, 0.3);
  }
  .workarea input[type="range"]::-moz-range-thumb {
    width: 30px; height: 30px; border-radius: 50%; background: var(--ink); border: 3px solid var(--paper);
  }
  .el-island .island-range::-webkit-slider-thumb { background: var(--blue); }
  .el-island .island-range::-moz-range-thumb { background: var(--blue); }
  .el-sorting .sort-range::-webkit-slider-thumb { background: var(--red); }
  .el-sorting .sort-range::-moz-range-thumb { background: var(--red); }

  /* bigger widget control labels + readouts */
  .el-island .island-label, .el-sorting .sort-label { font-size: 0.78rem; }
  .el-island .island-readout, .el-sorting .sort-readout { font-size: 1.12rem; line-height: 1.5; }

  /* near-square figures: bump the in-SVG labels so they read on a phone (CSS overrides the font-size attribute) */
  .el-gym text { font-size: 14px; }
  .el-chain .figname { font-size: 24px; }
  .el-chain .figannot { font-size: 20px; }
  .el-classroom .figannot { font-size: 18px; }
  .el-promptessay .figannot { font-size: 20px; }
  .el-promptessay .figname { font-size: 24px; }
}
