/* =====================================================================
   SWISS / EDITORIAL  (the page's type system)
   Schibsted Grotesk for everything read, Geist Mono for labels and figures.
   A two-column grid hangs from the top edge with hairline rules; place
   names and the title fill the measure; word pairs are tied to their
   object by one leader line that runs up between the two words and
   becomes their divider. One red letter, once: kaloryfer / kalorifer.

   Scale (phone; tracking tightens as size grows)
     label    10.5 mono caps  +.14em
     caption  16 / 1.32       -.006em  (14 inside cards, never less)
     find     21              -.025em  find labels (a reward, quieter than the stops)
     road     22              -.03em   road words on the verge, dom / ev
     stop     30              -.04em   anchored cards
     word     40              -.04em   pair heroes
     collision fills measure  -.05em
     place    fills measure   -.055em  (2px rule above, km in mono)
     title    fills measure   -.055em
     sen      fills the pair  -.06em
   ===================================================================== */
:root {
  --f-text: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --t-label: 10.5px; --t-cap: 16px; --t-road: 22px; --t-word: 40px; --t-stop: 30px; --t-find: 21px; --t-big: 96px; --t-place: 140px; --t-title: 110px; --t-sen: 150px;
  --e-in: cubic-bezier(.16, 1, .3, 1); --e-out: cubic-bezier(.55, 0, .9, .4);
}
body, #ui, #fallback, #km, #finds { font-family: var(--f-text); }

/* ---- roles ---- */
.lab { font: 500 var(--t-label)/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink2); margin-bottom: 8px; }
.w { font-weight: 620; font-size: calc(var(--t-word) * var(--fit, 1)); line-height: 1; letter-spacing: -.04em; }
.cap { margin-top: 12px; font-weight: 430; font-size: var(--t-cap); line-height: 1.32; letter-spacing: -.006em; }
.blk .col.pl { text-align: left; }   /* the grid: both columns flush left */
.d { color: var(--acc); }             /* the letter that differs (collisions only) */

/* hairline over each column, drawn left to right */
.blk .hero > .col::before, .blk .cap:first-child > .col::before, .k-title .date > .col::before {
  content: ""; display: block; height: 1px; margin-bottom: 9px; background: currentColor; opacity: .5;
  transform: scaleX(0); transform-origin: left; transition: transform .25s var(--e-out); }
.m.on .blk .hero > .col::before, .m.on .blk .cap:first-child > .col::before, .k-title.on .date > .col::before { transform: none; transition: transform .7s var(--e-in); }
.m.on .blk .col.tr::before { transition-delay: .06s; }

/* ---- the zone: text hangs from the top; behind it the backdrop colour, solid to just past the text, then a short fade ---- */
.blk { top: var(--top); }
.scrim { top: 0; height: calc(var(--blk-b, 30vh) + 110px);
  background: linear-gradient(to bottom, rgba(var(--sc), .94) 0, rgba(var(--sc), .9) calc(100% - 110px), rgba(var(--sc), .66) calc(100% - 78px),
    rgba(var(--sc), .32) calc(100% - 46px), rgba(var(--sc), .1) calc(100% - 20px), rgba(var(--sc), 0) 100%); }

/* ---- motion: lines rise out of their masks, fast; leave the way the reader travels ---- */
.li { transform: translateY(110%); transition: transform .24s var(--e-out); }
.m.up .li { transform: translateY(-110%); }
.m.on .li { transform: none; transition: transform .62s var(--e-in) calc(var(--d, 0s) + var(--i, 0) * 50ms + var(--late, 0s)); }
/* the last line of a turn (sen, all seventeen) arrives a beat after the others */
.ln.late { --late: .75s; }
.lab { opacity: 0; transition: opacity .15s; }
.m.on .lab { opacity: 1; transition: opacity .4s .2s; }
.col.tr { --d: 60ms; }
.cap { --d: 140ms; } .cap .col.tr { --d: 200ms; }

/* ---- title: Sobota flush left, Cumartesi flush right, both filling the measure ---- */
.k-title .blk { top: calc(var(--top) + 2.5vh); }
.duo.title { grid-template-columns: minmax(0, 1fr); }
.duo.title .w { font-size: calc(var(--t-title) * var(--fit, 1)); font-weight: 640; letter-spacing: -.055em; line-height: .9; }
.blk .duo.title .col.tr { text-align: right; margin-top: .06em; }
.duo.title > .col::before { display: none; }
.duo.title .lab { margin-bottom: 4px; }
.k-title .date { margin-top: 24px; font-weight: 620; font-size: var(--t-cap); letter-spacing: -.01em; }
.k-title .date .li { --d: 120ms; }
.k-title .cap { margin-top: 4px; }
.k-title .duo.title .lab { opacity: 0; }
.k-title.on .duo.title .lab { opacity: 1; }
/* the invitation to the finds: quiet, at the foot of the title screen (the HUD comes only after the title has gone) */
.k-title .foot { position: absolute; left: var(--edgeL); right: var(--edgeR); bottom: var(--bot); }
.k-title .foot .cap { margin-top: 0; }
.k-title .foot .col.pl { text-align: left; }
.k-title .foot .cap > .col::before { content: ""; display: block; height: 1px; margin-bottom: 9px; background: currentColor; opacity: .5; transform: scaleX(0); transform-origin: left; transition: transform .25s var(--e-out); }
.k-title.on .foot .cap > .col::before { transform: none; transition: transform .7s var(--e-in) .2s; }
.k-title .foot .cap { --d: 260ms; } .k-title .foot .cap .col.tr { --d: 300ms; }
.k-title .do { margin-top: 10px; font: 500 var(--t-label)/1.2 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink2); }
.k-title .do .li { --d: 380ms; }

/* ---- place header: a 2px rule, the kilometre figure in mono, the name across the full measure ---- */
.k-header .blk::before { content: ""; display: block; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .25s var(--e-out); }
.k-header.on .blk::before { transform: none; transition: transform .8s var(--e-in); }
.pkm { margin-top: 8px; font: 500 var(--t-label)/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink2); text-align: right; }
.pkm .li { --d: 160ms; }
.place { margin-top: 4px; font-weight: 640; font-size: calc(var(--t-place) * var(--fitp, 1)); line-height: .9; letter-spacing: -.055em; }
.place .ln { padding-right: 0; margin-right: 0; }
.place .li { --d: 40ms; }
.k-header .hero { margin-top: 18px; }
.k-header .hero .col.pl { --d: 200ms; } .k-header .hero .col.tr { --d: 260ms; }

/* ---- collisions: stacked across the measure, the differing letter in red ---- */
.duo.big { grid-template-columns: minmax(0, 1fr); }
.duo.big > .col::before { display: none; }
.blk .duo.big .col.tr { text-align: right; }
.duo.big .w { font-size: calc(var(--t-big) * var(--fit, 1)); letter-spacing: -.05em; line-height: .95; }
.duo.big .lab { display: none; }
.k-big .cap { margin-top: 18px; }

/* ---- the card: word pair, hairline, caption beneath, on one flat field of the backdrop colour;
        placed beside its subject by the solver in text.js (never over it), one straight leader to a dot on the subject ---- */
.k-anchor, .k-road, .k-find { --lift: 22px; --safe-t: 20px; --maxw: .6; }
.k-anchor.has-cap { --maxw: .8; }   /* captioned cards: columns as wide as the longest authored line (never re-wrapped), up to 80 % */
.unit { position: absolute; left: 0; top: 0; padding: 7px 7px 9px 8px; background: rgba(var(--sc), .9); will-change: transform;
  opacity: 0; transition: opacity .18s; }
.m.on .unit { opacity: 1; transition: opacity .3s; }
.upair { grid-template-columns: var(--c1, max-content) var(--c2, max-content); column-gap: 9px; }
.unit .col.pl { text-align: left; }
.unit .w { font-size: calc(var(--t-stop) * var(--fit, 1)); letter-spacing: -.04em; }
.ucap { display: block; margin-top: 8px; font-weight: 430; font-size: calc(14px * var(--capfit, 1)); line-height: 1.3; letter-spacing: -.006em; }
.ucap::before { content: ""; display: block; height: 1px; margin-bottom: 7px; background: currentColor; opacity: .45;
  transform: scaleX(0); transform-origin: left; transition: transform .2s var(--e-out); }
.m.on .ucap::before { transform: none; transition: transform .6s var(--e-in) .1s; }
.unit .col.tr { --d: 50ms; }
.ucap { --d: 120ms; } .unit .col.tr .ucap { --d: 170ms; }
.lead line { stroke: var(--ink); stroke-width: 1; }

/* road words: small, on the verge beside the road (never on the asphalt), a tight field, no leader */
.k-road { --lift: 10px; }
.k-road .unit { background: rgba(var(--sc), .86); padding: 4px 8px 5px; }
.k-road .upair { column-gap: 10px; }
.k-road .unit .w { font-size: var(--t-road); letter-spacing: -.03em; font-weight: 600; }
.k-road .unit .col.tr { border-left: 1px solid currentColor; padding-left: 9px; }

/* the end of the road (dom / ev): a plain line in the text zone, no anchor */
.duo.roadend .w { font-size: var(--t-road); letter-spacing: -.03em; }

/* ---- climax: "sen | sen" as large as the pair can be, high in the frame, arriving last and calm;
        the leader drops straight to the stag; the caption sits under the words on the same axis ---- */
.k-climax { --py-fix: .15; --gap: 16px; --safe-t: 20px; }
.k-climax .fw .w { font-size: calc(var(--t-sen) * var(--fit, 1)); font-weight: 600; letter-spacing: -.06em; line-height: .9; }
.k-climax .li { transition-duration: .3s; }
.k-climax.on .li { transition: transform 1.1s var(--e-in) var(--d, 0s); }
.k-climax .fw.tr .li { --d: 450ms; }
.k-climax .blk { left: 0; right: 0; top: calc(var(--py) + var(--fh) / 2 + 22px); }
.k-climax .cap { line-height: 1.36; }
.k-climax .cap { grid-template-columns: calc(var(--px) - var(--gap)) minmax(0, 1fr); column-gap: calc(2 * var(--gap)); margin: 0; }
.k-climax .blk .cap .col.pl { text-align: right; }
.k-climax .blk .cap > .col::before { display: none; }
.k-climax .cap { --d: 1100ms; } .k-climax .cap .col.tr { --d: 1160ms; }
.k-climax .lead line { transition-delay: .9s; transition-duration: 1.1s; }
.k-climax .lead circle { display: none; }   /* a divider between the words, not a leader: no dot */

/* ---- end: the total and the closing lines, nothing else ---- */
.k-end .blk { top: calc(var(--top) + 8vh); text-align: left; }
.k-end .total { font-weight: 640; font-size: 72px; letter-spacing: -.055em; line-height: 1; }
.k-end .cap { margin-top: 26px; }
.k-end .cap { --d: 300ms; } .k-end .cap .col.tr { --d: 360ms; }

/* ---- HUD: flat, tight chips of the backdrop colour; no halos ---- */
#km, #finds { background: rgba(var(--sc), .88); padding: 6px 9px 7px; }
#km { left: var(--edgeL); bottom: var(--bot); gap: 8px; }
#km .kv { font-weight: 620; font-size: 16px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-width: 3.1em; text-align: right; }
#km .ku { font: 500 var(--t-label)/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink2); margin-right: 4px; }
#km .track { width: 72px; opacity: .8; }
#finds { right: var(--edgeR); bottom: var(--bot); display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
#finds .fn { font: 500 11px/1 var(--f-mono); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
#finds .fv { font-weight: 600; }
#finds .ft { color: var(--ink2); }
#finds .ticks { display: flex; gap: 2px; }
#finds .ticks i { width: 3px; height: 7px; background: currentColor; opacity: .28; transition: opacity .3s, background-color .3s; }
#finds .ticks i.got { opacity: 1; }
#finds .ticks i.new { background: var(--acc); }

/* ---- a find: a reward, not a headline: smaller and quieter than the stop words, beside the object (same solver) ---- */
.k-find { --lift: 16px; --maxw: .8; }   /* the columns are as wide as the longest authored line, up to 80 % of the canvas */
.k-find .unit { padding: 6px 9px 8px; background: rgba(var(--sc), .82); }
.k-find .upair { column-gap: 10px; }
.k-find .unit .w { font-size: calc(var(--t-find) * var(--fit, 1)); font-weight: 560; letter-spacing: -.025em; }
.k-find .ucap { margin-top: 6px; font-size: calc(14px * var(--capfit, 1)); }
.k-find .ucap::before { margin-bottom: 6px; }
/* it appears at once on the tap: short entrance, no stagger */
.k-find.now .li { transition: transform .26s var(--e-in) 0s; }
.k-find.now .unit { transition: opacity .12s; }
.k-find.now .lead line { transition: stroke-dashoffset .25s var(--e-in) 0s; }
.k-find.now .lead circle { transition: opacity .15s 0s; }
/* while a find is named, the moment's own unit steps back so the two never collide */
/* (not the climax: its divider, sen | sen, is part of the composition, not a leader; the label goes elsewhere) */
#ui.finding .m:not(.k-find):not(.k-climax) :is(.unit, .lead) { opacity: 0 !important; transition: opacity .2s; }

/* all seventeen found: once, caption size, a fade and nothing else */
.k-all .blk { top: auto; bottom: calc(var(--bot) + 56px); background: rgba(var(--sc), .9); padding: 10px 12px 12px; }
.k-all .cap { margin: 0; }
.k-all .li { transform: none; opacity: 0; transition: opacity .5s; }
.k-all.on .li { opacity: 1; transition: opacity .9s; }
.k-all.on .ln.late .li { transition-delay: .9s; }
.k-all .blk .cap > .col::before { display: none; }

/* the scene's own interim counter is replaced by #finds above */
.finds-count { display: none !important; }

@media (min-width: 760px) {
  :root { --edge0: 40px; --gut: 32px; --t-cap: 17px; --t-word: 52px; --t-road: 26px; --t-stop: 40px; --t-find: 26px; --t-place: 150px; --t-big: 120px; --t-title: 150px; --t-sen: 200px; }
  .blk { right: auto; width: min(640px, calc(100vw - 80px)); }
  .k-title .foot { right: auto; width: min(640px, calc(100vw - 80px)); }
  /* landscape: the title is a narrow column on the paper left of the model */
  .k-title .blk, .k-title .foot { width: clamp(340px, 30vw, 640px); }
  .k-climax .blk { right: 0; width: auto; }
  .ucap { font-size: calc(16px * var(--capfit, 1)); }
  .k-find .ucap { font-size: calc(15px * var(--capfit, 1)); }
}
