/* ==========================================================================
   /planner and /ai-tutor, on the design the /flashcards page set
   (css/flashcards.css is loaded first and gives the tokens, the type, the
   buttons, the sections, the dark band, the app window, the questions and the
   closing). This sheet holds what those two pages share on top of it: their
   lights, the rest of the springs, a head with a way in, and the furniture of
   a sheet that shows part of the app.
   ========================================================================== */

:root {
  /* The other two v2 springs, sampled (DESIGN.md section 7). */
  --spring-glide: linear(0, .028, .094, .179, .272, .364, .452, .532, .604, .667, .722, .769, .809, .843, .871, .894, .913, .93, .943, .954, .962, .97, .975, .98, .984, .987, .99, .992, .993, .995, .996, .997, 1);
  --spring-glide-t: .648s;
  --spring-catch: linear(0, .029, .103, .204, .319, .437, .55, .654, .745, .823, .887, .938, .977, 1.005, 1.025, 1.037, 1.043, 1.046, 1.044, 1.041, 1.037, 1.032, 1.026, 1.021, 1.016, 1.012, 1.008, 1.005, 1.003, 1.001, 1, .999, 1);
  --spring-catch-t: .471s;
  --pen-ease: cubic-bezier(.5, 0, .2, 1);
}

/* The ink key's 2px of travel, on the `key` spring, without a script. */
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
.key { transition: background-color var(--t-fast) var(--ease), --p var(--spring-key-t) var(--spring-key); }
.key:active:not(:disabled) { --p: 1; }

/* ---- the head: the headline, what it is, and the way in ------------------- */
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 20px; margin-top: 6px; }
.hero-cta .key svg, .closing .key svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hero-cta .more { margin-top: 0; min-height: 44px; }
.hero h1 .l2 { white-space: nowrap; }

/* ---- a sheet that shows part of the app ---------------------------------- */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.bar { display: flex; align-items: center; gap: 9px; min-height: 52px; padding: 0 20px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.bar h2, .bar h3, .bar strong { font-size: 15.5px; font-weight: 600; letter-spacing: -.014em; line-height: 1.25; }
.bar > span:last-child { margin-left: auto; font-size: 13.5px; color: var(--ink-3); text-align: right; }
.foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; min-height: 60px; padding: 10px 20px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); }
.state { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.state .ico { display: none; width: 16px; height: 16px; color: var(--ok); stroke-width: 2; }
.saved .state { color: var(--ink); }
.saved .state .ico { display: block; }
.kind { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-3); }
.kind .ico { width: 16px; height: 16px; }
.split-copy .kind { margin-bottom: -2px; }
.split { align-items: center; }
.split > .sheet, .split > figure { min-width: 0; }
.demo-note { margin-top: 14px; text-align: center; font-size: 14px; color: var(--ink-3); }
.shead-c p { max-width: 56ch; color: var(--ink-2); }
.section > .wrap > .more { margin-top: 22px; }

@media (min-width: 960px) {
  .split.rev > .split-copy { order: 2; }
  .split.rev { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  .split-copy h2 { font-size: clamp(34px, 2vw + 16px, 46px); line-height: 1.06; letter-spacing: -.032em; }
  .split-copy p { font-size: 18px; }
}

/* ---- arrivals: opacity for words, springs for things ---------------------- */
@keyframes ink-in { from { opacity: 0; } }
@keyframes land { from { transform: scale(.4); opacity: 0; } }
@keyframes draw-down { from { transform: scaleY(0); } }
@keyframes ring-on { from { stroke-dashoffset: 1; stroke-width: 3.4; } to { stroke-dashoffset: 0; stroke-width: 3.4; } }
@keyframes ring-dry { from { stroke-width: 3.4; } to { stroke-width: 2.6; } }

/* ==========================================================================
   Light on the paper (DESIGN.md section 9): one light per screen, on the
   ground only, with ink steps that still clear 5:1 at its brightest point
   (light: 5.5:1 under Blossom and Twilight, 5.7:1 under Moonlight;
   dark: 6.3:1 or better under each).
   /planner opens under Blossom and closes under Moonlight; /ai-tutor opens
   under Twilight and /practice-exams under Cumulus, and both close under
   Aurora (which css/flashcards.css draws).
   ========================================================================== */
.lit-blossom, .lit-twilight, .lit-cumulus { position: relative; isolation: isolate; }
.lit-blossom::before, .lit-twilight::before, .lit-cumulus::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: 1180px; pointer-events: none; }
.lit-blossom::before { background: radial-gradient(ellipse 86% 72% at 95% -10%, rgba(255, 96, 160, .3) 0%, rgba(255, 132, 182, .13) 42%, rgba(255, 132, 182, 0) 74%); }
.lit-twilight::before { background: linear-gradient(180deg, rgba(132, 96, 236, .3) 0%, rgba(196, 116, 214, .16) 44%, rgba(214, 128, 196, 0) 82%); }
.lit-blossom .top, .lit-blossom .hero { --ink-2: #51424A; --ink-3: #5B4A53; }
.lit-twilight .top, .lit-twilight .hero { --ink-2: #453E55; --ink-3: #4E4661; }
/* Cumulus: powder blue from the top left, as the paper has it. */
.lit-cumulus::before { background: radial-gradient(ellipse 88% 72% at 5% -10%, rgba(96, 152, 236, .31) 0%, rgba(120, 168, 236, .14) 42%, rgba(120, 168, 236, 0) 74%); }
.lit-cumulus .top, .lit-cumulus .hero { --ink-2: #384250; --ink-3: #404B5C; }
.lit-blossom .top:not([data-scrolled]), .lit-twilight .top:not([data-scrolled]), .lit-cumulus .top:not([data-scrolled]) { background: transparent; }

.lit-moonlight { position: relative; isolation: isolate; --ink-2: #384250; --ink-3: #404B5C; }
.lit-moonlight::before {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: linear-gradient(200deg, rgba(84, 140, 240, .32) 0%, rgba(120, 150, 236, .17) 32%, rgba(150, 130, 230, .06) 56%, rgba(150, 130, 230, 0) 76%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 62%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 62%, transparent 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lit-blossom::before { background: radial-gradient(ellipse 86% 72% at 95% -10%, rgba(255, 96, 160, .24) 0%, rgba(255, 110, 170, .09) 42%, rgba(255, 110, 170, 0) 74%); }
  :root:not([data-theme="light"]) .lit-twilight::before { background: linear-gradient(180deg, rgba(132, 96, 236, .28) 0%, rgba(196, 116, 214, .12) 44%, rgba(214, 128, 196, 0) 82%); }
  :root:not([data-theme="light"]) .lit-blossom .top, :root:not([data-theme="light"]) .lit-blossom .hero { --ink-2: #D6BFC8; --ink-3: #CAB3BC; }
  :root:not([data-theme="light"]) .lit-twilight .top, :root:not([data-theme="light"]) .lit-twilight .hero { --ink-2: #C9C1DC; --ink-3: #BDB5D1; }
  :root:not([data-theme="light"]) .lit-moonlight { --ink-2: #B7C3D6; --ink-3: #ABB8CC; }
  :root:not([data-theme="light"]) .lit-cumulus::before { background: radial-gradient(ellipse 88% 72% at 5% -10%, rgba(96, 152, 236, .25) 0%, rgba(96, 152, 236, .1) 42%, rgba(96, 152, 236, 0) 74%); }
  :root:not([data-theme="light"]) .lit-cumulus .top, :root:not([data-theme="light"]) .lit-cumulus .hero { --ink-2: #B7C3D6; --ink-3: #ABB8CC; }
  :root:not([data-theme="light"]) .lit-moonlight::before { background: linear-gradient(200deg, rgba(84, 140, 240, .25) 0%, rgba(120, 150, 236, .12) 32%, rgba(150, 130, 230, .05) 56%, rgba(150, 130, 230, 0) 76%); }
}
:root[data-theme="dark"] .lit-blossom::before { background: radial-gradient(ellipse 86% 72% at 95% -10%, rgba(255, 96, 160, .24) 0%, rgba(255, 110, 170, .09) 42%, rgba(255, 110, 170, 0) 74%); }
:root[data-theme="dark"] .lit-twilight::before { background: linear-gradient(180deg, rgba(132, 96, 236, .28) 0%, rgba(196, 116, 214, .12) 44%, rgba(214, 128, 196, 0) 82%); }
:root[data-theme="dark"] .lit-blossom .top, :root[data-theme="dark"] .lit-blossom .hero { --ink-2: #D6BFC8; --ink-3: #CAB3BC; }
:root[data-theme="dark"] .lit-twilight .top, :root[data-theme="dark"] .lit-twilight .hero { --ink-2: #C9C1DC; --ink-3: #BDB5D1; }
:root[data-theme="dark"] .lit-moonlight { --ink-2: #B7C3D6; --ink-3: #ABB8CC; }
:root[data-theme="dark"] .lit-cumulus::before { background: radial-gradient(ellipse 88% 72% at 5% -10%, rgba(96, 152, 236, .25) 0%, rgba(96, 152, 236, .1) 42%, rgba(96, 152, 236, 0) 74%); }
:root[data-theme="dark"] .lit-cumulus .top, :root[data-theme="dark"] .lit-cumulus .hero { --ink-2: #B7C3D6; --ink-3: #ABB8CC; }
:root[data-theme="dark"] .lit-moonlight::before { background: linear-gradient(200deg, rgba(84, 140, 240, .25) 0%, rgba(120, 150, 236, .12) 32%, rgba(150, 130, 230, .05) 56%, rgba(150, 130, 230, 0) 76%); }

/* ==========================================================================
   The stage (/planner, /practice-exams): one sheet in the middle of the
   desk, the steps that play it to its left, and what it is made from lying
   loose to its right. A thing that is read is not used up: a copy of it
   lifts off, flies up and over, and lands in the sheet, and the original
   stays where it lay, marked as read. Each page lays out its own sheet.
   ========================================================================== */
.stagebox { position: relative; display: grid; grid-template-areas: "steps" "loose" "sheet"; gap: 14px; padding: 12px; border-radius: var(--r-xl); background: var(--rail-on); overflow: clip; }
@supports not (overflow: clip) { .stagebox { overflow: hidden; } }
@supports (corner-shape: squircle) { .stagebox { corner-shape: squircle; border-radius: calc(var(--r-xl) * 1.6); } }
.chapter-col { grid-area: steps; min-width: 0; display: grid; gap: 10px; }
.chapters { display: flex; gap: 6px; margin: 0 -12px; padding: 2px 12px; overflow-x: auto; scrollbar-width: none; }
.chapters::-webkit-scrollbar { display: none; }
.chapter { flex: none; display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 16px 0 9px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink-2); font-size: 15px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.chapter .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--rule-2); font-size: 13px; font-weight: 600; color: var(--ink-3); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.chapter:hover { background: var(--hover); color: var(--ink); }
.chapter[aria-pressed="true"] { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgb(var(--shade) / calc(.07 * var(--shade-k))); }
.chapter[aria-pressed="true"] .n { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.chapter-say { min-height: 3em; padding: 0 4px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.stage-sheet { grid-area: sheet; min-width: 0; border-radius: var(--r-lg); }
@supports (corner-shape: squircle) { .stage-sheet { border-radius: calc(var(--r-lg) * 1.6); } }

/* What the sheet is made from: small sheets lying loose on the desk. */
.loose { grid-area: loose; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; padding: 4px 2px 2px; }
.note { --h: .12; position: relative; margin: 0; padding: 10px 12px 11px; border-radius: var(--r-sm); background: var(--sheet); transform: rotate(var(--rot)); font-size: 12.5px; line-height: 1.4; color: var(--ink-3); transition: --h var(--spring-settle-t) var(--spring-settle);
  box-shadow: 0 0 0 1px var(--rule), 0 calc(1px + 18px * var(--h)) calc(2px + 40px * var(--h)) calc(-2px - 12px * var(--h)) rgb(var(--shade) / calc((.07 + .12 * var(--h)) * var(--shade-k))), 0 calc(1px + 3px * var(--h)) calc(2px + 6px * var(--h)) rgb(var(--shade) / calc((.04 + .03 * var(--h)) * var(--shade-k))); }
.note b { display: block; font-size: 14px; font-weight: 600; letter-spacing: -.012em; color: var(--ink); line-height: 1.3; }
.note p { display: none; margin-top: 3px; }
.note::after { content: ""; position: absolute; right: 9px; top: 12px; width: 10px; height: 5px; border-left: 1.8px solid var(--ink-3); border-bottom: 1.8px solid var(--ink-3); transform: rotate(-45deg); opacity: 0; transition: opacity .25s var(--ease); }
/* Read: it lies flat again, and says so. */
.note.is-read { --h: 0; }
.note.is-read b { color: var(--ink-2); }
.note.is-read::after { opacity: 1; }
.slip p { display: flex; align-items: center; gap: 8px; }
.slip-mark { position: relative; flex: none; padding: 1px 7px 2px; font: 400 19px/1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.slip-mark svg { position: absolute; inset: -2px -1px; width: calc(100% + 2px); height: calc(100% + 4px); overflow: visible; transform: rotate(-3deg); }
.slip-mark path { fill: none; stroke: var(--pen); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
/* The copy in flight: held, so at full height, and above everything. */
.ghost { --h: 1; position: absolute; z-index: 6; margin: 0; pointer-events: none; transition: none; will-change: transform; }
.note.ghost::after { display: none; }
/* What it costs and covers, under the stage rather than over it. */
.facts-under { margin-top: 18px; }
.hero .desk[data-stage] { margin-top: 26px; }

@media (min-width: 560px) {
  .stagebox { padding: 16px; gap: 16px; }
  .note p { display: block; }
  .slip p { display: flex; }
}
/* Room for the sheet beside what it is made from. */
@media (min-width: 860px) {
  .stagebox { grid-template-areas: "steps steps" "sheet loose"; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; padding: 20px; gap: 18px 22px; }
  .loose { padding-top: 6px; gap: 14px 12px; }
}
/* Room to centre it: the steps to its left, the desk to its right. */
@media (min-width: 1180px) {
  .stagebox { grid-template-areas: "steps sheet loose"; grid-template-columns: minmax(0, 1fr) 460px minmax(0, 1fr); align-items: center; gap: 0 40px; min-height: 668px; padding: 36px 40px; }
  .chapter-col { gap: 18px; max-width: 250px; }
  .chapters { flex-direction: column; align-items: flex-start; gap: 6px; margin: 0; padding: 0; overflow: visible; }
  .chapter { min-height: 48px; padding: 0 18px 0 10px; font-size: 16px; }
  .chapter-say { min-height: 6em; padding: 0 2px; font-size: 16px; }
  .loose { display: block; position: relative; justify-self: end; width: 320px; height: 500px; padding: 0; }
  .loose > * { position: absolute; left: var(--x); top: var(--y); }
  .loose .note { width: 152px; }
}
@media (prefers-reduced-motion: no-preference) {
  .note.back { animation: ink-in .35s ease-out backwards; }
}

@media (prefers-reduced-motion: reduce) {
  .key { transition: background-color var(--t-fast) var(--ease); }
}
