/*
 * The public site nastastopp.se. Fonts are served from this site (the deploy build places them in /fonts/); the
 * site's Content-Security-Policy allows only this stylesheet, so no page carries a style of its own. The home pages
 * draw a living map behind their chapters (site.js). Every rule without `.anim` gives the finished, still picture,
 * which is what a page shows without the script, with reduced motion and after Pause; site.js sets `js` once it can
 * reveal the chapters and `anim` while pictures may move.
 */

@font-face {
    font-family: "Barlow Semi Condensed";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/barlow_semi_condensed_medium.ttf") format("truetype");
}

@font-face {
    font-family: "Barlow Semi Condensed";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/barlow_semi_condensed_bold.ttf") format("truetype");
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/atkinson_hyperlegible_next_medium.ttf") format("truetype");
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/atkinson_hyperlegible_next_bold.ttf") format("truetype");
}

:root {
    color-scheme: dark;
    --bg: #05070a;
    --fg: #f3f5f8;
    --muted: #a0a8b3;
    --accent: #6ea8ff;
    --gold: #ffc61a;
    --gold-soft: rgba(255, 198, 26, .16);
    --ink: #17171a;
    --ok: #54d68c;
    --edge: #1d222a;
    --glass: rgba(10, 13, 18, .68);
    --glass-edge: rgba(255, 255, 255, .08);
    --gutter: clamp(16px, 6vw, 88px);
    --display: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
    --body: "Atkinson Hyperlegible Next", system-ui, sans-serif;
}

/* Neither family draws Arabic: Arabic text uses the system's fonts. */
:root:lang(ar) {
    --display: system-ui, "Segoe UI", Tahoma, sans-serif;
    --body: system-ui, "Segoe UI", Tahoma, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 500 17px/1.65 var(--body);
}

main {
    max-width: 1040px;
    margin: 0 auto;
    padding-inline: 20px;
    padding-block: 48px 64px;
    display: grid;
    gap: 56px;
}

a {
    color: var(--accent);
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px 24px;
}

/* The privacy notice keeps its header in the page column, above <main>. */
body:not(.home) > .top {
    max-width: 1040px;
    margin: 0 auto;
    padding: 48px 20px 0;
}

.brand {
    font: 700 1.1rem var(--display);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
}

.langs {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: .95rem;
}

.langs a {
    color: var(--muted);
}

.langs [aria-current] {
    color: var(--fg);
}

h1 {
    font: 700 clamp(3rem, 9vw, 6.5rem)/0.95 var(--display);
    margin: 8px 0 0;
    text-wrap: balance;
}

h1 .next {
    color: var(--gold);
    display: block;
    font-size: .42em;
    letter-spacing: .3em;
}

.lead {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 46ch;
    margin: 20px 0 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.item {
    border-top: 2px solid var(--edge);
    padding-top: 14px;
}

.item h2,
.item h3 {
    font: 700 1.5rem var(--display);
    margin: 0 0 6px;
}

.item p {
    margin: 0;
    color: var(--muted);
}

.tag {
    font: 700 .8rem var(--body);
    color: var(--accent);
    letter-spacing: .08em;
    text-transform: uppercase;
}

footer {
    color: var(--muted);
    font-size: .9rem;
    border-top: 1px solid var(--edge);
    padding-top: 16px;
}

footer p {
    margin: 0 0 6px;
}

/* The privacy notice. */
.doc {
    max-width: 72ch;
}

.doc h1 {
    font-size: clamp(2.4rem, 7vw, 4rem);
}

.doc h2 {
    font: 700 1.5rem var(--display);
    margin: 40px 0 8px;
}

.doc p {
    margin: 0 0 12px;
}

.doc ul {
    margin: 0;
    padding-inline-start: 1.2em;
}

.doc li {
    margin: 0 0 8px;
}

.doc dl {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 24px;
    margin: 0;
}

.doc dt {
    color: var(--muted);
}

.doc dd {
    margin: 0;
}

/* ---- The home pages: the living map and its chapters. ---- */

.map {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100lvh;
    display: block;
    z-index: 0;
}

.map[hidden] {
    display: none;
}

.veil {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(5, 7, 10, .94) 0%, rgba(5, 7, 10, .62) 34%, rgba(5, 7, 10, 0) 60%),
        radial-gradient(ellipse at 68% 54%, rgba(5, 7, 10, 0) 45%, rgba(5, 7, 10, .55) 100%);
}

[dir="rtl"] .veil {
    background:
        linear-gradient(270deg, rgba(5, 7, 10, .94) 0%, rgba(5, 7, 10, .62) 34%, rgba(5, 7, 10, 0) 60%),
        radial-gradient(ellipse at 32% 54%, rgba(5, 7, 10, 0) 45%, rgba(5, 7, 10, .55) 100%);
}

.home main {
    position: relative;
    z-index: 1;
    max-width: none;
    padding: 0;
    display: block;
}

.home .top {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: center;
    flex-wrap: nowrap;
    padding: 14px var(--gutter);
    background: rgba(5, 7, 10, .35);
    border-bottom: 1px solid transparent;
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    transition: background .4s, border-color .4s;
}

.scrolled .top {
    background: rgba(5, 7, 10, .78);
    border-bottom-color: var(--glass-edge);
}

.progress {
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), #ffe08a);
    transform: scaleX(0);
    transform-origin: left;
    box-shadow: 0 0 12px rgba(255, 198, 26, .6);
}

[dir="rtl"] .progress {
    transform-origin: right;
}

.home .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    flex: none;
}

.logo {
    width: 32px;
    height: 32px;
    flex: none;
    filter: drop-shadow(0 0 14px rgba(255, 198, 26, .35));
}

.sections {
    display: flex;
    gap: 22px;
    font-size: .92rem;
    margin-inline: auto;
}

.sections a,
.home .langs a {
    color: var(--muted);
    text-decoration: none;
    transition: color .25s;
}

.sections a:hover,
.home .langs a:hover {
    color: var(--fg);
}

.home .langs {
    flex: none;
    gap: 14px;
}

/* Pause: stops every picture of the page (never stored). */
.still-toggle {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    font: 700 .8rem var(--body);
    cursor: pointer;
}

.still-toggle:hover {
    color: var(--fg);
}

.still-toggle[hidden] {
    display: none;
}

/* Two bars while pictures move; a play mark while they stand still. */
.still-toggle::before {
    content: "";
    width: 10px;
    height: 11px;
    border-inline: 3px solid currentColor;
}

.still-toggle[aria-pressed="true"] {
    color: var(--gold);
    border-color: rgba(255, 198, 26, .5);
}

.still-toggle[aria-pressed="true"]::before {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent currentColor;
}

[dir="rtl"] .still-toggle[aria-pressed="true"]::before {
    border-width: 6px 10px 6px 0;
    border-color: transparent currentColor transparent transparent;
}

/* The opening. */
.hero {
    min-height: calc(100vh - 64px);
    min-height: calc(100svh - 64px);
    max-width: calc(680px + 2 * var(--gutter));
    padding: 56px var(--gutter) 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kicker {
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font: 700 .78rem var(--body);
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
}

.kicker::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 0 rgba(255, 198, 26, .6);
    animation: beacon 2.4s ease-out 2;
}

.home h1 {
    font-size: clamp(3rem, 7.6vw, 6.6rem);
    margin: 0;
    background: linear-gradient(180deg, #ffffff 35%, #9db3d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.home h1 .next {
    display: flex;
    align-items: center;
    gap: .35em;
    color: var(--gold);
    -webkit-text-fill-color: var(--gold);
    margin-bottom: .18em;
}

.home h1 .next::after {
    content: "";
    width: .5em;
    height: .5em;
    border: solid currentColor;
    border-width: .14em .14em 0 0;
    transform: rotate(45deg);
    animation: nudge 1.8s ease-in-out 2;
}

[dir="rtl"] .home h1 .next::after {
    transform: rotate(-135deg);
    animation-name: nudge-rtl;
}

/* Arabic needs room above and below its letters. */
.home h1:lang(ar) {
    line-height: 1.2;
}

.home .lead {
    color: #c3cad4;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px 0 0;
}

.button {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .18);
    color: var(--fg);
    text-decoration: none;
    font-weight: 700;
    background: rgba(255, 255, 255, .04);
    transition: transform .25s, box-shadow .25s, background .25s;
}

.button:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, .08);
}

.button.primary {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--ink);
    box-shadow: 0 10px 34px rgba(255, 198, 26, .28);
}

.button.primary:hover {
    background: #ffd54a;
    box-shadow: 0 14px 44px rgba(255, 198, 26, .42);
}

/* The announcement the passengers hear. */
.announce {
    margin-top: 32px;
    max-width: 540px;
    padding: 16px 18px 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(22, 28, 38, .78), rgba(10, 13, 18, .62));
    border: 1px solid var(--glass-edge);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.announce p {
    margin: 0;
}

.announce-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chip {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--ink);
    font: 700 .72rem var(--body);
    letter-spacing: .12em;
    text-transform: uppercase;
}

.clock {
    font: 700 1.35rem/1 var(--display);
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
}

.wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 22px;
    margin-inline-start: auto;
}

.wave i {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: var(--gold);
    transform: scaleY(.18);
    opacity: .7;
}

.announce .announce-text {
    margin-top: 10px;
    min-height: 3.3em;
    font: 700 1.04rem/1.6 var(--body);
    color: #e9edf3;
}

/* The words still to come hold their place, so typing never moves the page. */
.announce-text .rest {
    color: transparent;
}

.announce .announce-foot {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.listen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 198, 26, .5);
    background: var(--gold-soft);
    color: var(--gold);
    font: 700 .85rem var(--body);
    cursor: pointer;
    transition: background .25s;
}

.listen::before {
    content: "";
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent currentColor;
}

[dir="rtl"] .listen::before {
    border-width: 5px 8px 5px 0;
    border-color: transparent currentColor transparent transparent;
}

/* While the voice speaks, the mark is a square: a second press stops it. */
.listen[aria-pressed="true"]::before {
    width: 9px;
    height: 9px;
    border: 0;
    background: currentColor;
}

.listen:hover {
    background: rgba(255, 198, 26, .26);
}

.listen[hidden] {
    display: none;
}

.caption {
    margin: 10px 0 0;
    max-width: 540px;
    font-size: .85rem;
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    gap: 10px 32px;
    margin: 32px 0 0;
}

.stats div {
    display: flex;
    flex-direction: column-reverse;
}

.stats dd {
    margin: 0;
    font: 700 clamp(1.6rem, 3vw, 2.2rem)/1 var(--display);
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}

.stats div:first-child dd {
    color: var(--gold);
}

.stats dt {
    margin-top: 6px;
    font-size: .74rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

.map-note {
    margin: 22px 0 0;
    max-width: 52ch;
    font-size: .85rem;
    color: var(--muted);
}

/* The chapters. */
.chapter {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: 12vh var(--gutter);
}

.card {
    position: relative;
    width: min(470px, 100%);
    padding: 28px;
    border-radius: 22px;
    background: var(--glass);
    border: 1px solid var(--glass-edge);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .05);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
}

.card::before {
    content: "";
    position: absolute;
    inset-inline: 28px;
    top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: .7;
}

.card h2 {
    font: 700 clamp(1.8rem, 3.4vw, 2.5rem)/1.05 var(--display);
    margin: 10px 0 12px;
    text-wrap: balance;
}

.card > p {
    margin: 0;
    color: #c3cad4;
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font: 700 .82rem var(--display);
    letter-spacing: .3em;
    color: var(--gold);
}

.step::after {
    content: "";
    width: 44px;
    height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
}

[dir="rtl"] .step::after {
    background: linear-gradient(270deg, var(--gold), transparent);
}

.demo {
    position: relative;
    margin-top: 22px;
    font-size: .92rem;
}

/* 01: the dispatch list being read. */
.dispatch {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .07);
}

.scan {
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 44px;
    background: linear-gradient(180deg, rgba(110, 168, 255, 0), rgba(110, 168, 255, .22));
    border-bottom: 1px solid rgba(160, 200, 255, .8);
    pointer-events: none;
    opacity: 0;
}

.row {
    display: grid;
    grid-template-columns: 3.4em 6.4em 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    border-inline-start: 2px solid var(--gold);
    background: rgba(255, 255, 255, .045);
}

.row .t {
    font: 700 1rem var(--display);
    font-variant-numeric: tabular-nums;
}

.k {
    justify-self: start;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: .76rem;
    font-weight: 700;
}

.k0 {
    background: var(--gold-soft);
    color: var(--gold);
}

.k1 {
    background: rgba(110, 168, 255, .14);
    color: var(--accent);
}

/* 02: answers checked against the register. */
.checks {
    display: grid;
    gap: 10px;
}

.check {
    display: grid;
    grid-template-columns: 30px 1fr;
    column-gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .07);
}

.check .mark {
    grid-row: span 2;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.check.ok .mark {
    background: rgba(84, 214, 140, .16);
    color: var(--ok);
}

.check.ask .mark {
    background: var(--gold-soft);
    color: var(--gold);
}

.check small {
    color: var(--muted);
    font-size: .8rem;
}

/* 03: turn by turn. */
.turns {
    display: grid;
    gap: 8px;
}

.turn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .06);
    transition: opacity .5s, background .5s, border-color .5s, transform .5s;
}

.turn.now {
    background: linear-gradient(90deg, rgba(255, 198, 26, .16), rgba(255, 198, 26, .02));
    border-color: rgba(255, 198, 26, .4);
}

[dir="rtl"] .turn.now {
    background: linear-gradient(270deg, rgba(255, 198, 26, .16), rgba(255, 198, 26, .02));
}

.arrow {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--gold);
    color: var(--ink);
    font: 700 1.1rem/1 system-ui, sans-serif;
}

.a0::before {
    content: "↱";
}

.a1::before {
    content: "↑";
}

.a2::before {
    content: "●";
    font-size: .8rem;
}

/* 04: the passengers' screen: still, the time above the street; moving, time, then NÄSTA, then the street. */
.tablet {
    aspect-ratio: 4 / 3;
    border-radius: 22px;
    border: 10px solid #181c24;
    background: #05070a;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
    overflow: hidden;
}

.tablet .screen {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    background: radial-gradient(circle at 50% 125%, rgba(255, 198, 26, .16), transparent 62%), #05070a;
}

.screen > span:not(.dots) {
    font-family: var(--display);
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.screen .time {
    font-size: clamp(2.4rem, 7vw, 3.4rem);
    font-variant-numeric: tabular-nums;
}

.screen .time i {
    font-style: normal;
    color: var(--gold);
}

.screen .nastaword {
    display: none;
    font-size: clamp(2rem, 6vw, 3rem);
    letter-spacing: .3em;
    color: var(--gold);
}

.screen .street {
    font-size: clamp(1.5rem, 4.5vw, 2rem);
    padding-inline: 12px;
}

.dots {
    display: none;
    position: absolute;
    bottom: 14px;
    gap: 6px;
}

.dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
}

/* 05: the encrypted link, and the server that never sees a name. */
.link {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 22px 12px;
}

.node {
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 198, 26, .45);
    font-weight: 700;
    font-size: .88rem;
    text-align: center;
}

.wire {
    position: relative;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 198, 26, .7), rgba(110, 168, 255, .7));
}

.wire i {
    position: absolute;
    top: -4px;
    left: calc(50% - 5px);
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--gold);
    box-shadow: 0 0 12px rgba(255, 198, 26, .8);
}

.wire b {
    position: absolute;
    top: 10px;
    inset-inline: 0;
    text-align: center;
    font-size: .7rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.node.server {
    grid-column: 1 / -1;
    justify-self: center;
    border-style: dashed;
    border-color: rgba(255, 255, 255, .22);
    color: var(--muted);
}

.node.server small {
    display: block;
    margin-top: 2px;
    color: #ff8a7a;
    font-size: .74rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* 06: the products. */
.products {
    justify-content: center;
}

.card.wide {
    width: min(1080px, 100%);
}

.home .grid {
    margin-top: 22px;
    gap: 14px;
}

.home .item {
    position: relative;
    border-top: 0;
    padding: 22px;
    border-radius: 16px;
    background:
        radial-gradient(360px circle at var(--mx, 50%) var(--my, -40%), rgba(255, 198, 26, .12), transparent 45%),
        rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .08);
    transition: transform .35s, border-color .35s;
}

.home .item:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 198, 26, .35);
}

.home .item h3 {
    margin: 8px 0 8px;
    font-size: 1.6rem;
}

.home footer {
    position: relative;
    z-index: 1;
    padding: 28px var(--gutter) 40px;
    background: rgba(5, 7, 10, .86);
    border-top: 1px solid var(--glass-edge);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

footer .small {
    font-size: .8rem;
    opacity: .8;
}

/* Arabic is never letter-spaced or set in capitals. */
:lang(ar) .brand,
:lang(ar) .tag,
:lang(ar) h1 .next,
:lang(ar) .kicker,
:lang(ar) .chip,
:lang(ar) .stats dt,
:lang(ar) .wire b,
:lang(ar) .node.server small,
:lang(ar) .still-toggle {
    letter-spacing: 0;
    text-transform: none;
}

/* ---- Motion: only while the script runs and pictures may move. ---- */

.js.anim .card {
    opacity: 0;
    transform: translateY(48px) scale(.97);
    transition: opacity 1s ease, transform 1s cubic-bezier(.2, .75, .2, 1);
}

.js.anim .seen .card {
    opacity: 1;
    transform: none;
}

.anim .live .wave i {
    animation: bar .9s ease-in-out infinite;
}

.anim .live .wave i:nth-child(3n) {
    animation-duration: .7s;
}

.anim .live .wave i:nth-child(3n + 1) {
    animation-duration: 1.1s;
    animation-delay: -.3s;
}

.anim .live .wave i:nth-child(4n + 2) {
    animation-delay: -.55s;
}

/* The caret: an empty inline border before the words to come, so it adds no width and no line break. */
.anim .typing .announce-text .rest::before {
    content: "";
    border-inline-start: 2px solid var(--gold);
    margin-inline-end: -2px;
    animation: caret .8s steps(1) infinite;
}

.js.anim .on .scan {
    animation: scan 2.6s cubic-bezier(.45, 0, .55, 1) infinite;
}

.js.anim .row {
    opacity: .35;
    border-inline-start-color: transparent;
    background: rgba(255, 255, 255, .02);
    transition: opacity .5s, border-color .5s, background .5s;
}

.js.anim .seen .row {
    animation: parsed .6s ease forwards;
}

.js.anim .seen .row:nth-child(3) {
    animation-delay: .45s;
}

.js.anim .seen .row:nth-child(4) {
    animation-delay: .9s;
}

.js.anim .seen .row:nth-child(5) {
    animation-delay: 1.35s;
}

.js.anim .check .mark {
    transform: scale(0);
}

.js.anim .seen .check .mark {
    animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) .5s forwards;
}

.js.anim .seen .check + .check .mark {
    animation-delay: 1.1s;
}

.js.anim .turn {
    opacity: .4;
}

.js.anim .turn.now {
    opacity: 1;
    transform: translateX(4px);
}

[dir="rtl"].js.anim .turn.now {
    transform: translateX(-4px);
}

.js.anim .screen > span:not(.dots) {
    position: absolute;
    opacity: 0;
}

.js.anim .screen .time {
    font-size: clamp(3rem, 9vw, 4.6rem);
}

.js.anim .screen .nastaword {
    display: block;
}

.js.anim .screen .street {
    font-size: clamp(1.8rem, 5.5vw, 2.6rem);
}

.js.anim .dots {
    display: flex;
}

.js.anim .seen .screen > span:not(.dots) {
    animation: stage 9s ease infinite backwards;
}

.js.anim .seen .screen > span.nastaword {
    animation-delay: 3s;
}

.js.anim .seen .screen > span.street {
    animation-delay: 6s;
}

.js.anim .seen .dots i {
    animation: dot 9s steps(1) infinite;
}

.js.anim .seen .dots i:nth-child(2) {
    animation-delay: 3s;
}

.js.anim .seen .dots i:nth-child(3) {
    animation-delay: 6s;
}

.js.anim .wire i {
    left: 0;
    opacity: 0;
}

.js.anim .on .wire i {
    animation: packet 2.4s linear infinite;
}

[dir="rtl"].js.anim .on .wire i {
    animation-name: packet-rtl;
}

.js.anim .on .wire i:nth-child(2) {
    animation-delay: .8s;
}

.js.anim .on .wire i:nth-child(3) {
    animation-delay: 1.6s;
}

html.anim {
    scroll-behavior: smooth;
}

/* Still: nothing moves, whatever asked for it (reduced motion, or Pause). */
html.still *,
html.still *::before,
html.still *::after {
    animation: none !important;
    transition: none !important;
}

@keyframes beacon {
    0% { box-shadow: 0 0 0 0 rgba(255, 198, 26, .6); }
    70%, 100% { box-shadow: 0 0 0 12px rgba(255, 198, 26, 0); }
}

@keyframes nudge {
    0%, 100% { transform: translateX(0) rotate(45deg); opacity: 1; }
    50% { transform: translateX(.18em) rotate(45deg); opacity: .55; }
}

@keyframes nudge-rtl {
    0%, 100% { transform: translateX(0) rotate(-135deg); opacity: 1; }
    50% { transform: translateX(-.18em) rotate(-135deg); opacity: .55; }
}

@keyframes bar {
    0%, 100% { transform: scaleY(.2); }
    50% { transform: scaleY(1); }
}

@keyframes caret {
    50% { border-color: transparent; }
}

@keyframes scan {
    0% { transform: translateY(-44px); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(210px); opacity: 0; }
}

@keyframes parsed {
    to {
        opacity: 1;
        border-inline-start-color: var(--gold);
        background: rgba(255, 255, 255, .045);
    }
}

@keyframes pop {
    to { transform: scale(1); }
}

@keyframes stage {
    0% { opacity: 0; transform: translateY(14px) scale(.98); }
    5%, 29% { opacity: 1; transform: none; }
    34%, 100% { opacity: 0; transform: translateY(-14px); }
}

@keyframes dot {
    0% { background: var(--gold); }
    33.3%, 100% { background: rgba(255, 255, 255, .25); }
}

@keyframes packet {
    0% { left: 0; opacity: 0; }
    15%, 85% { opacity: 1; }
    100% { left: calc(100% - 10px); opacity: 0; }
}

@keyframes packet-rtl {
    0% { left: calc(100% - 10px); opacity: 0; }
    15%, 85% { opacity: 1; }
    100% { left: 0; opacity: 0; }
}

/* ---- Sizes. ---- */

/* The section links need the full row, next to the brand, Pause and the languages. */
@media (max-width: 1240px) {
    .sections {
        display: none;
    }

    .home .top {
        justify-content: space-between;
        gap: 12px;
    }

    .still-toggle {
        margin-inline-start: auto;
    }
}

/* Until the map is limited by height, its western edge sits at about 41% of the width: the plain text of the
   opening ends before it. */
@media (min-width: 860px) and (max-width: 1540px) {
    .hero > .kicker,
    .hero > .lead,
    .hero > .caption,
    .hero > .map-note,
    .hero > .stats {
        max-width: calc(41vw - var(--gutter) - 12px);
    }

    .stats {
        grid-template-columns: repeat(2, auto);
    }
}

@media (max-width: 859px) {
    .veil,
    [dir="rtl"] .veil {
        background: linear-gradient(180deg, rgba(5, 7, 10, 0) 0%, rgba(5, 7, 10, .2) 30%, rgba(5, 7, 10, .9) 52%, rgba(5, 7, 10, .96) 100%);
    }

    /* The map sits above the opening; the opening's text carries its own dark ground as it scrolls over the map. */
    .hero {
        padding-top: 44vh;
        padding-top: 44svh;
        justify-content: flex-start;
        background: linear-gradient(180deg, rgba(5, 7, 10, 0) calc(44vh - 150px), rgba(5, 7, 10, .92) calc(44vh - 40px), rgba(5, 7, 10, .92) calc(100% - 64px), rgba(5, 7, 10, 0) 100%);
        background: linear-gradient(180deg, rgba(5, 7, 10, 0) calc(44svh - 150px), rgba(5, 7, 10, .92) calc(44svh - 40px), rgba(5, 7, 10, .92) calc(100% - 64px), rgba(5, 7, 10, 0) 100%);
    }

    .chapter {
        align-items: flex-end;
        padding-top: 48vh;
        padding-bottom: 8vh;
    }

    .stats {
        grid-template-columns: repeat(2, auto);
    }

    /* A blurred backdrop over a map that changes every frame costs too much on a phone; denser glass instead. */
    .card,
    .announce,
    .home footer {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .card {
        background: rgba(10, 13, 18, .9);
    }

    .announce {
        background: linear-gradient(135deg, rgba(22, 28, 38, .94), rgba(10, 13, 18, .9));
    }

    .home footer {
        background: rgba(5, 7, 10, .96);
    }
}

@media (max-width: 560px) {
    .doc dl {
        grid-template-columns: 1fr;
    }

    .doc dd {
        margin-bottom: 10px;
    }

    .home .langs {
        gap: 10px;
        font-size: .85rem;
    }

    /* The brand's name and the Pause label stay for screen readers when only the marks fit. */
    .home .brand span,
    .still-toggle span {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .still-toggle {
        width: 34px;
        padding: 0;
        justify-content: center;
    }

    .card {
        padding: 22px 18px;
    }

    .row {
        grid-template-columns: 3em 5.6em 1fr;
        gap: 8px;
    }
}

/* Without the script, reduced motion stops the stylesheet's own two short animations. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
