/* Landing page of Talea. Colours come from tokens.css (light and dark); the figures stay as the
   paper draws them. Annotations sit beside the drawings, never over them. */

:root { --gutter: 32px; --ease: cubic-bezier(.3, .7, .2, 1); --t-zoom: .55s; --t-fade: .2s; }
@media (prefers-reduced-motion: reduce) { :root { --t-zoom: 0s; --t-fade: 0s; } }

html { scroll-behavior: smooth; overflow-x: hidden; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { overflow-x: clip; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

:focus-visible { outline: 2px solid var(--teach); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--paper); padding: 8px 12px; border: 1px solid var(--hair); border-radius: 8px; z-index: 10; }
.skip:focus { left: 16px; }

/* header */
header.site { display: flex; align-items: center; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--hair); margin-bottom: 40px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.01em; text-decoration: none; display: inline-flex; align-items: center; gap: 9px; }
.brand img { display: block; }
.nav { margin-left: auto; display: flex; gap: 18px; font-size: 14px; }
.nav a { color: var(--grey); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.theme { flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 1px solid var(--hair); background: var(--paper); color: var(--grey); cursor: pointer; display: grid; place-items: center; }
.theme:hover { color: var(--ink); border-color: var(--light); }
.theme svg { width: 16px; height: 16px; }
.theme .sun, :root[data-theme="dark"] .theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
/* the header itself wraps on a phone: brand and theme switch on one line, the links on the next */
@media (max-width: 560px) {
  header.site { flex-wrap: wrap; row-gap: 8px; margin-bottom: 28px; padding: 14px 0; }
  .theme { margin-left: auto; }
  .nav { order: 3; margin-left: 0; width: 100%; flex-wrap: wrap; gap: 6px 16px; }
}

/* title block */
.venue { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); display: block; margin-bottom: 12px; }
h1 { font-size: clamp(24px, 3.2vw, 33px); line-height: 1.2; letter-spacing: -.02em; margin: 0 0 14px; max-width: 26ch; }
.lede { font-size: 16.5px; line-height: 1.55; color: var(--grey); max-width: 66ch; margin: 0; }
.cta { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.cta .key {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 10px 16px; border-radius: 9px; background: var(--ink); color: var(--ground); border: 1px solid var(--ink);
}
.cta .key svg { width: 15px; height: 15px; }
.cta .plain { font-size: 14px; color: var(--grey); }
.cta .plain:hover { color: var(--ink); }

section { margin: 56px 0; scroll-margin-top: 16px; }
h2 { font-size: 20px; letter-spacing: -.015em; margin: 0 0 14px; }
.prose { font-size: 15px; line-height: 1.6; color: var(--grey); max-width: 72ch; margin: 0; }
.fineprint { font-size: 13px; line-height: 1.55; color: var(--grey); margin: 10px 0 0; }
.cta + .fineprint { margin-top: 16px; max-width: 66ch; }
.fineprint .dated { color: var(--ink); font-weight: 500; white-space: nowrap; }

/* ── Figure 1, scene by scene ─────────────────────────────────────────── */
.fig { margin: 0; background: var(--paper); border: 1px solid var(--hair); border-radius: 14px; padding: 16px; }
@media (max-width: 560px) { .fig { padding: 10px; border-radius: 12px; } }
/* the stage keeps the paper's white in dark mode: the figure is the paper's own */
.stage { position: relative; overflow: hidden; border-radius: 8px; background: #fff; aspect-ratio: 2048 / 1090; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-tap-highlight-color: transparent; }
@media (max-width: 640px) { .stage { aspect-ratio: 5 / 4; } }
.canvas { position: absolute; left: 0; top: 0; width: 2048px; height: 1090px; transform-origin: 0 0; transition: transform var(--t-zoom) var(--ease); will-change: transform; }
.canvas img { position: absolute; display: block; pointer-events: none; -webkit-user-drag: none; }
.canvas .layer { left: 0; top: 0; width: 2048px; height: 1090px; }
.canvas .dim { opacity: .2; filter: grayscale(1); transition: opacity var(--t-fade); }
.canvas .focus { transition: clip-path var(--t-zoom) var(--ease); }
.canvas .rec { left: 818px; top: 494px; width: 372px; height: 68px; opacity: 0; transition: opacity .5s .25s, filter var(--t-fade); }
@media (prefers-reduced-motion: reduce) { .canvas .rec { transition: none; } }
.canvas.has-record .rec { opacity: 1; }
.canvas.has-record .rec.out { opacity: .2; filter: grayscale(1); }
.canvas.all .dim { opacity: 1; filter: none; }

.under { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px 22px; margin-top: 14px; align-items: start; }
@media (max-width: 760px) { .under { grid-template-columns: minmax(0, 1fr); } }

.stops { display: flex; align-items: flex-end; gap: 6px 14px; flex-wrap: wrap; }
.group { display: grid; gap: 4px; justify-items: start; }
.group .gl { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); line-height: 1; }
.group.t .gl { color: var(--teach); } .group.l .gl { color: var(--learn); } .group.c .gl { color: var(--collab); }
.group .dots { display: flex; gap: 2px; }
.dot { width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: 50%; color: var(--light); }
.dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; transition: transform var(--t-fade); }
.group.t .dot { color: var(--teach); } .group.l .dot { color: var(--learn); } .group.c .dot { color: var(--collab); } .group.n .dot { color: var(--grey); }
.dot[aria-current="step"]::before { background: currentColor; transform: scale(1.3); }
.dot:hover::before { transform: scale(1.3); }
.allbtn { font: inherit; font-size: 12px; font-weight: 600; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--hair); background: var(--paper); color: var(--grey); cursor: pointer; }
.allbtn[aria-current="step"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.arrows { margin-left: auto; display: flex; gap: 6px; }
.arrows button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--hair); background: var(--paper); color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0; }
.arrows button:hover { border-color: var(--light); }
.arrows svg { width: 15px; height: 15px; }
@media (max-width: 560px) {
  .group .gl { display: none; }
  .stops { gap: 6px 4px; }
  .allbtn { padding: 0 8px; margin-right: 2px; }
}

.cap { font-size: 14.5px; line-height: 1.5; color: var(--grey); margin: 12px 2px 0; min-height: 4.5em; }
.cap b { font-weight: 600; color: var(--ink); }
.cap b.t { color: var(--teach); } .cap b.l { color: var(--learn); } .cap b.c { color: var(--collab); }
.cap .count { font-variant-numeric: tabular-nums; color: var(--grey); font-size: 12.5px; margin-left: 6px; white-space: nowrap; }
/* the "step through it" hint wraps on phones (R2-EMA-12) */
.cap .hint { color: var(--grey); font-size: 12.5px; margin-left: 6px; }

/* the request beside the figure: refused before teaching, served after the record exists.
   It reuses the panel's drawing language (white card, grey request, pills) as live text. */
.ask { border: 1px solid var(--hair); border-radius: 12px; padding: 12px; background: var(--ground); transition: opacity var(--t-fade); }
.ask.lit { border-color: var(--grey); }
.ask .label { display: flex; justify-content: space-between; gap: 8px; color: var(--grey); }
.ask .state { letter-spacing: .06em; }
.ask .state.no { color: var(--alert); }
.ask .state.yes { color: var(--learn); }
.ask .req { margin: 8px 0 0; background: var(--panel); border-radius: 9px; padding: 8px 10px; font-size: 13.5px; line-height: 1.4; }
.ask .reply { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink); font-weight: 500; }
.ask .reply span { display: block; font-weight: 400; color: var(--grey); margin-top: 4px; }
.ask .pills { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ask .pill { font-size: 12px; font-weight: 500; border: 1.2px solid currentColor; border-radius: 12px; padding: 2px 10px; color: var(--collab); }
.ask .pill.go { color: var(--learn); }
.ask .slot { display: grid; grid-template-areas: "x"; }
.ask .slot > div { grid-area: x; transition: opacity var(--t-fade); }
.ask .slot > [hidden] { display: block; visibility: hidden; opacity: 0; }

/* ── Interaction modalities ───────────────────────────────────────────── */
/* Each panel is at rest until the pointer is over a part of its drawing, a badge or a legend row
   (site.js); then that part alone stays clear. */
.sechead { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.sechead h2 { margin: 0; }
.sechint { margin: 0; font-size: 12.5px; color: var(--grey); }
.sechint .coarse { display: none; }
@media (hover: none) { .sechint .fine { display: none; } .sechint .coarse { display: inline; } }
.row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto auto; gap: 0 28px; }
.mode { display: grid; grid-row: span 4; grid-template-rows: subgrid; gap: 10px 0; min-width: 0; }
@media (max-width: 860px) { .row { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 0; } .mode { grid-row: auto; grid-template-rows: none; margin-bottom: 36px; } }
.mode .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mode h3 { margin: 0; font-size: 16px; }
.mode.learn { --acc: var(--learn); --acc-ink: var(--learn-ink); --soft: var(--learn-soft); }
.mode.teach { --acc: var(--teach); --acc-ink: var(--teach-ink); --soft: var(--teach-soft); }
.mode.collab { --acc: var(--collab); --acc-ink: var(--collab-ink); --soft: var(--collab-soft); }
.mode h3 { color: var(--acc-ink); }
.mode .who { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); font-weight: 600; }

/* the paper's three states, as thumbnails of the part of the drawing that changes */
.states { padding-left: var(--gutter); display: grid; gap: 5px; justify-items: start; }
.thumbs { display: flex; gap: 8px; }
.thumbs button { position: relative; display: block; width: 60px; height: 46px; padding: 0; border: 1px solid var(--hair); border-radius: 6px; background: #fff; overflow: hidden; cursor: pointer; opacity: .6; transition: opacity var(--t-fade), border-color var(--t-fade), box-shadow var(--t-fade); }
.thumbs img { position: absolute; left: 0; top: 0; display: block; width: 100%; height: auto; margin-top: calc(-1 * var(--top)); pointer-events: none; -webkit-user-drag: none; }
.thumbs button:hover { opacity: .9; }
/* on the dark ground a lower opacity turns the white drawings grey: mute them less */
:root[data-theme="dark"] .thumbs button:not([aria-pressed="true"]) { opacity: .78; border-color: transparent; }
:root[data-theme="dark"] .thumbs button:not([aria-pressed="true"]):hover { opacity: .95; }
.thumbs button[aria-pressed="true"] { opacity: 1; border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.thumbs button:focus-visible { outline-offset: 3px; outline-color: var(--acc); }
.states .sub { font-size: 12.5px; color: var(--grey); line-height: 1.3; }

.frame { align-self: start; padding-left: var(--gutter); }
.drawing { position: relative; width: 100%; aspect-ratio: var(--aw) / var(--ah); align-self: start; -webkit-tap-highlight-color: transparent; }
/* stacked: keep a tall drawing to a readable size on a tablet */
@media (max-width: 860px) { .drawing { max-width: 420px; } }
.drawing.hot { cursor: pointer; }
.drawing img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity var(--t-fade); -webkit-user-drag: none; }
.drawing .focus { opacity: 0; pointer-events: none; transition: opacity var(--t-fade), clip-path var(--t-fade); }
.mode.active .drawing .base { opacity: .32; }
.mode.active .drawing .focus { opacity: 1; }

.mark { position: absolute; left: calc(-1 * var(--gutter)); top: var(--y); transform: translateY(-50%); display: flex; align-items: center; color: var(--acc); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: opacity var(--t-fade); }
.mark .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--soft); border: 1.5px solid var(--acc); box-sizing: border-box; flex: none; transition: transform var(--t-fade); }
.mark .lead { width: 10px; height: 0; border-top: 1.5px solid currentColor; }
.mode.active .mark { opacity: .35; }
.mode.active .mark.on { opacity: 1; }
.mark.on .n { transform: scale(1.18); }

.keys { list-style: none; margin: 0; padding: 0 0 0 var(--gutter); display: grid; gap: 2px; align-content: start; }
.keys button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: baseline; width: 100%; padding: 3px 6px; margin-left: -6px; border-radius: 6px; font-size: 13px; line-height: 1.45; color: var(--grey); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background var(--t-fade), color var(--t-fade); }
.keys b { font-weight: 700; color: var(--acc-ink); font-size: 12px; }
.keys button:focus-visible { outline: 2px solid var(--acc); outline-offset: 0; }
.keys button.on { background: var(--soft); color: var(--ink); }

.figcap { font-size: 13px; color: var(--grey); margin: 6px 0 0; }

footer { border-top: 1px solid var(--hair); padding: 22px 0 52px; margin-top: 52px; font-size: 13px; color: var(--grey); }
footer p { margin: 0 0 6px; }
