/* SPDX-FileCopyrightText: 2026 Wonmor and Tilo contributors */
/* SPDX-License-Identifier: Apache-2.0 */

/* ---------- fonts (self-hosted, OFL, see /fonts/OFL.txt) ---------- */
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/lexend-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/lexend-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/inter-cyrillic-wght-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/inter-cyrillic-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }

/* ---------- tokens: palette from the Tilo 01 "Geometrik" mark ---------- */
:root {
  --bg: #F7F5F0; --bg2: #EFEBE2; --panel: #FFFFFF; --panel2: #F2EFE8;
  --ink: #15171C; --muted: #4D525A; --faint: #6B7078; --line: #DCD6CA; --line2: #E8E3D9;
  --teal: #0B7A67; --water: #1497B8; --water-ink: #0D6C85; --gold: #F2A81D; --gold-ink: #8A5800;
  --bad: #B23E2B; --ok: #0B7A67;
  --teal-soft: color-mix(in srgb, var(--teal) 11%, transparent);
  --water-soft: color-mix(in srgb, var(--water) 12%, transparent);
  --gold-soft: color-mix(in srgb, var(--gold) 18%, transparent);
  --bad-soft: color-mix(in srgb, var(--bad) 11%, transparent);
  --shadow: 0 1px 0 rgba(21, 23, 28, .04), 0 14px 36px -18px rgba(21, 23, 28, .22);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --expo: cubic-bezier(.16, 1, .3, 1);
  --font: 'Lexend', 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101214; --bg2: #14171A; --panel: #171A1E; --panel2: #1C2024;
    --ink: #F3F1EC; --muted: #AAAEB4; --faint: #8D9198; --line: #2C3137; --line2: #23272C;
    --teal: #34C9A8; --water: #4FD3F0; --water-ink: #4FD3F0; --gold: #F6B93B; --gold-ink: #F6B93B;
    --bad: #FF8B74; --ok: #34C9A8;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 18px 40px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101214; --bg2: #14171A; --panel: #171A1E; --panel2: #1C2024;
  --ink: #F3F1EC; --muted: #AAAEB4; --faint: #8D9198; --line: #2C3137; --line2: #23272C;
  --teal: #34C9A8; --water: #4FD3F0; --water-ink: #4FD3F0; --gold: #F6B93B; --gold-ink: #F6B93B;
  --bad: #FF8B74; --ok: #34C9A8;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 18px 40px -20px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--water); outline-offset: 3px; border-radius: 6px; }
button { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 12px; }

/* ---------- deck view ---------- */
html.deck-view, html.deck-view body { height: 100%; overflow: hidden; }
html.deck-view body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(46% 40% at 8% 0%, var(--teal-soft), transparent 72%),
    radial-gradient(40% 36% at 100% 100%, var(--water-soft), transparent 70%); }
.stage { position: relative; }
html.deck-view .stage { position: fixed; left: 50%; top: 50%; width: 1600px; height: 900px; transform-origin: 50% 50%; z-index: 1; }
html.deck-view .slide { position: absolute; inset: 0; padding: 70px 96px 92px; display: flex; flex-direction: column; gap: 18px;
  opacity: 0; visibility: hidden; transform: translateX(36px); transition: opacity .6s var(--ease), transform .7s var(--ease), visibility 0s .7s; }
html.deck-view .slide.past { transform: translateX(-36px); }
/* centre the content block between the kicker and the bottom bar */
html.deck-view .slide > .kicker + * { margin-top: auto; }
html.deck-view .slide > :nth-last-child(2) { margin-bottom: auto; }
html.deck-view .slide.active { opacity: 1; visibility: visible; transform: none; transition: opacity .6s var(--ease), transform .7s var(--ease), visibility 0s; }
html.deck-view .slide.off-track { display: none; }
html.instant .slide, html.instant .f { transition: none !important; }

/* reveal per step (only hides once JS is running) */
html.js.deck-view .f { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .8s var(--ease); }
html.js.deck-view .f.fade { transform: none; }
html.js.deck-view .f.on { opacity: 1; transform: none; }
html.js.deck-view .f.gone { opacity: 0; transform: none; pointer-events: none; }
html.js .f.dim.gone { opacity: .28; }

/* ---------- story view (phones, narrow windows, ?view=page) ---------- */
html.story-view .stage { width: 100%; max-width: 1120px; margin: 0 auto; }
html.story-view .slide { position: relative; padding: 56px 20px 48px; display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--line2); }
html.story-view .slide:first-child { border-top: 0; }
html.story-view .slide.off-track { display: none; }
html.js.story-view .f { transition: opacity .8s var(--ease), transform .9s var(--ease); }
html.js.story-view .slide:not(.played) .f { }
html.story-view .f.gone:not(.dim) { display: none; }
html.story-view .deck-only { display: none !important; }
html.deck-view .story-only { display: none !important; }
@media (max-width: 520px) { html.story-view .slide { padding: 44px 16px 40px; } }

/* ---------- type ---------- */
.kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.kicker .kn { font-variant-numeric: tabular-nums; color: var(--faint); }
.kicker .dev-chip { letter-spacing: .06em; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--water-soft); color: var(--water-ink); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.display { font-size: 92px; line-height: 1.02; letter-spacing: -.035em; font-weight: 600; }
h2.title { font-size: 50px; line-height: 1.1; max-width: 24ch; }
h2.title.wide { max-width: 34ch; }
h3 { font-size: 24px; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
.lead { font-size: 26px; line-height: 1.45; color: var(--muted); max-width: 52ch; }
.body { font-size: 21px; line-height: 1.5; color: var(--muted); }
.small { font-size: 16px; line-height: 1.45; color: var(--muted); }
.tiny { font-size: 14px; line-height: 1.4; color: var(--faint); }
b, strong { color: var(--ink); font-weight: 600; }
.hl { color: var(--teal); }
.hl-w { color: var(--water-ink); }
.hl-b { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
ul.clean { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.clean li { position: relative; padding-left: 24px; font-size: 20px; line-height: 1.45; color: var(--muted); }
ul.clean li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
ul.clean.x li::before { background: var(--bad); border-radius: 2px; transform: rotate(45deg); }
ul.clean.w li::before { background: var(--water); }
ul.clean.sm li { font-size: 17px; }

/* source tag: every number carries one */
.src { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; line-height: 1.2; font-weight: 500; letter-spacing: .01em;
  color: var(--faint); text-decoration: none; padding: 3px 9px 3px 7px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); white-space: nowrap; vertical-align: middle; }
.src::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--water); flex: none; }
a.src:hover { color: var(--ink); border-color: var(--water); }
.src.doc::before { background: var(--gold); }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; }
.est { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); background: var(--gold-soft); padding: 2px 8px; border-radius: 6px; vertical-align: middle; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 5px 12px; border-radius: 99px; background: var(--teal-soft); color: var(--teal); white-space: nowrap; }
.chip.w { background: var(--water-soft); color: var(--water-ink); }
.chip.g { background: var(--gold-soft); color: var(--gold-ink); }
.chip.b { background: var(--bad-soft); color: var(--bad); }
.chip.n { background: var(--panel2); color: var(--muted); }

/* ---------- layout ---------- */
.row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-height: 0; }
.g { display: grid; gap: 20px; }
.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.split.l { grid-template-columns: 1fr 1.25fr; }
.mt-a { margin-top: auto; }
.center { align-items: center; justify-content: center; text-align: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.flat { box-shadow: none; background: var(--panel2); border-color: var(--line2); }
.card .k { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.card h3 { font-size: 22px; }
.card p { font-size: 17px; line-height: 1.45; color: var(--muted); }
.card .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card.accent { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.card.warn { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .v { font-size: 64px; line-height: 1; font-weight: 600; letter-spacing: -.035em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat .v small { font-size: .45em; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.stat .l { font-size: 18px; line-height: 1.4; color: var(--muted); }
.stat.big .v { font-size: 120px; }

.icon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal); }
.icon svg { width: 26px; height: 26px; }
.icon.w { background: var(--water-soft); color: var(--water-ink); }
.icon.g { background: var(--gold-soft); color: var(--gold-ink); }
.icon.b { background: var(--bad-soft); color: var(--bad); }

/* ---------- chrome: corner mark, language, bar ---------- */
.corner { position: fixed; left: 28px; top: 22px; z-index: 5; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.corner svg { height: 30px; width: auto; display: block; }
.langs { display: flex; gap: 4px; font-size: 14px; font-weight: 600; }
.langs a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 9px; }
.langs a[aria-current="true"] { color: var(--ink); background: var(--panel2); }
.langs a:hover { color: var(--ink); }
html.deck-view .top-right { position: fixed; right: 24px; top: 18px; z-index: 5; display: flex; gap: 8px; align-items: center; }

.bar { position: fixed; z-index: 6; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 86%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bar button, .tb { display: inline-flex; align-items: center; gap: 7px; height: 38px; min-width: 38px; padding: 0 10px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.bar button:hover, .tb:hover { background: var(--panel2); color: var(--ink); }
.bar button:active, .tb:active { transform: scale(.97); }
.bar svg, .tb svg { width: 19px; height: 19px; flex: none; }
.bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.bar .counter { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); padding: 0 8px; min-width: 62px; text-align: center; }
.progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 7; background: transparent; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--water)); transform-origin: 0 50%; transform: scaleX(0); transition: transform .5s var(--ease); }
html.story-view .bar, html.story-view .progress, html.story-view .corner, html.story-view .top-right { display: none; }
html.shot .bar, html.shot .progress { display: none; }

/* story header */
.top { display: none; }
html.story-view .top { display: flex; position: sticky; top: 0; z-index: 8; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid var(--line2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.top .brand { display: flex; align-items: center; color: var(--ink); }
.top .brand svg { height: 26px; width: auto; }
.top .acts { display: flex; align-items: center; gap: 2px; }
.tb.app-link { text-decoration: none; color: var(--teal); background: var(--teal-soft); font-weight: 600; }
.tb.app-link:hover { color: var(--teal); filter: brightness(.97); }
.top .tb { height: 40px; padding: 0 9px; }
.top .tb .lbl { font-size: 13px; }
@media (max-width: 400px) { .top .tb .lbl.opt { display: none; } }
.trackbar { display: none; }
html.story-view .trackbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 16px 0; max-width: 1120px; margin: 0 auto; }
.trackbar button { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 8px 14px; font-size: 14px; cursor: pointer; color: var(--muted); }
.trackbar button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* overlays */
.ov, .help, .notes-box { position: fixed; z-index: 20; }
.ov { inset: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); overflow: auto; padding: 72px 40px 40px; }
.ov h2 { font-size: 26px; margin: 0 auto 18px; max-width: 1400px; display: flex; justify-content: space-between; align-items: center; }
.ov-grid { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ov-card { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 14px 16px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 118px; }
.ov-card:hover { border-color: var(--teal); }
.ov-card.cur { outline: 2px solid var(--teal); }
.ov-card.dev { background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(90deg, var(--water), var(--teal)) border-box; border-color: transparent; }
.ov-n { font-size: 13px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.ov-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
.ov-t { font-size: 15px; line-height: 1.35; color: var(--ink); }
.notes-box { left: 50%; bottom: 72px; transform: translateX(-50%); width: min(900px, calc(100vw - 32px)); max-height: 40vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 20px; }
.notes-box .nh { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); font-weight: 600; margin-bottom: 6px; }
.notes-box .nb { font-size: 17px; line-height: 1.55; color: var(--ink); }
html.story-view .notes-box { bottom: 16px; }
.help { inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(6px); }
.help .box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 30px; box-shadow: var(--shadow); max-width: 520px; width: calc(100vw - 32px); }
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 14px 0 0; font-size: 16px; }
.help dt { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.help dd { margin: 0; color: var(--muted); }
.x-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; height: 36px; padding: 0 12px; cursor: pointer; font-size: 14px; }
[hidden] { display: none !important; }
.toast { position: fixed; left: 50%; top: 22px; transform: translate(-50%, -8px); z-index: 30; background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* footer (story view + 404) */
.foot-site { display: none; }
html.story-view .foot-site { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center; max-width: 1120px; margin: 0 auto; padding: 28px 20px 40px; border-top: 1px solid var(--line2); font-size: 14px; color: var(--faint); }
.foot-site nav { display: flex; gap: 16px; flex-wrap: wrap; }
.foot-site a { color: var(--muted); }
.deck-foot { position: fixed; z-index: 4; right: 26px; bottom: 26px; display: flex; gap: 14px; font-size: 13px; }
.deck-foot a { color: var(--faint); text-decoration: none; }
.deck-foot a:hover { color: var(--ink); }
html.story-view .deck-foot, html.shot .deck-foot { display: none; }
@media (max-width: 1280px) { .deck-foot { display: none; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
