/* Both families are variable fonts: one file covers every weight. */
@font-face {
    font-family: 'Hanken Grotesk';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/fonts/hanken-grotesk-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'Schibsted Grotesk';
    font-style: normal;
    font-weight: 500 800;
    font-display: swap;
    src: url('/fonts/schibsted-grotesk-latin.woff2') format('woff2');
}

:root {
    color-scheme: light;
    --bg: #f7f5f1;
    --surface: #ffffff;
    --ink: #17120d;
    --ink2: #1a1714;
    --body: #4a443b;
    --muted: #6b6459;
    --faint: #8c8478;
    --line: #e7e0d5;
    --line2: #ddd4c6;
    --headerbg: rgba(247, 245, 241, 0.85);
    --poster1: #efeae1;
    --poster2: #e7e1d6;
    --shadow: 0 1px 2px rgba(26, 19, 15, 0.04);
    --band: #17120d;
    --bandline: transparent;
    --bandink: #fbf8f3;
    --bandmuted: #c3bcb0;
    --soft: #f2ede4;
    --soft2: #faf8f4;
    --accent: #d93a2b;
    --accent-text: #d93a2b;
    --accent-tint: #ffefec;      /* accent 9% into surface, in oklch */
    --accent-line: #f8b6ab;      /* 40% */
    --accent-line-soft: #fbc5bb; /* 32% */

    --sans: 'Hanken Grotesk', system-ui, sans-serif;
    --display: 'Schibsted Grotesk', sans-serif;
    --mono: ui-monospace, monospace;
    --gutter: clamp(1.25rem, 4vw, 2rem);
    --ease-out: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #13110e;
    --surface: #1c1915;
    --ink: #f6f0e7;
    --ink2: #efe8dd;
    --body: #cfc6b8;
    --muted: #a99f92;
    --faint: #8a8174;
    --line: #2c2721;
    --line2: #3b342c;
    --headerbg: rgba(19, 17, 14, 0.85);
    --poster1: #201c18;
    --poster2: #1a1714;
    --shadow: 0 0 0 transparent;
    --band: #1c1915;
    --bandline: #2c2721;
    --bandink: #f6f0e7;
    --bandmuted: #a99f92;
    --soft: #26221c;
    --soft2: #211d18;
    --accent-text: #ed8171;      /* accent 68% into white */
    --accent-tint: #2d1d1a;
    --accent-line: #632a22;
    --accent-line-soft: #552721;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink2);
    font-family: var(--sans);
    overflow-x: clip;
    transition: background-color .3s, color .3s;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { opacity: 0.85; }

button { font: inherit; }

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

summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.bare-list { list-style: none; margin: 0; padding: 0; }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--headerbg);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.75rem clamp(1rem, 4vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    flex-shrink: 0;
}

.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }

.brand--small .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.brand--small .brand-name { font-size: 1.1rem; letter-spacing: 0; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--line2);
    background: transparent;
    color: var(--ink2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--line2);
    color: var(--ink2);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill-btn--solid {
    padding: 0 1rem;
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.icon-btn:hover,
.pill-btn:hover { border-color: var(--ink2); }
.pill-btn--solid:hover { filter: brightness(0.93); }

/* Below 420px the Telegram link shrinks to its icon. */
.header-telegram-icon { display: none; }

html:not(.js) .theme-toggle { display: none; }

/* Shown by motion.js on desktops, where the hero's rings are drawn; struck through when off. */
.icon-btn[hidden] { display: none; }
.rings-toggle .rings-off { display: none; }
.rings-toggle[aria-pressed="false"] .rings-off { display: inline; }
.rings-toggle[aria-pressed="false"] { color: var(--muted); }

/* ---------- Hero ---------- */

.hero {
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(2.75rem, 8vw, 6.5rem) var(--gutter) clamp(2.25rem, 5vw, 4rem);
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 1.5rem;
    white-space: nowrap;
}

.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.hero h1 {
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(2.35rem, 7vw, 4.8rem);
    line-height: 1.04;
    letter-spacing: -0.03em;
    margin: 0 0 1.2rem;
    color: var(--ink);
    text-wrap: balance;
}

.hero h1 .accent { color: var(--accent-text); }

/* Behind the hero, full width: motion.js draws Vanta RINGS into it. Its canvas fades in once
   drawn, held back so the text stays readable, and fades out at the bottom into the page. */
.hero-backdrop { position: relative; overflow: hidden; }

.hero-backdrop > .vanta-canvas {
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.hero-backdrop.is-drawn > .vanta-canvas { opacity: 0.5; }

/* While the rings are drawn, the hero's text gets a halo in the page colour to stand clear of them. */
.hero h1,
.hero-lead,
.stat-value,
.stat-label { transition: text-shadow 1.2s ease; }

.hero-backdrop.is-drawn .hero h1 {
    text-shadow: 0 0 3px var(--bg), 0 0 14px var(--bg), 0 0 28px var(--bg), 0 0 44px var(--bg);
}

.hero-backdrop.is-drawn .hero-lead,
.hero-backdrop.is-drawn .stat-value,
.hero-backdrop.is-drawn .stat-label {
    text-shadow: 0 0 1px var(--bg), 0 0 2px var(--bg), 0 0 6px var(--bg), 0 0 12px var(--bg), 0 0 20px var(--bg);
}

/* And a soft pool of the page colour behind the text block, so the rings thin out where it sits. */
.hero-backdrop .hero::before {
    content: "";
    position: absolute;
    inset: 4% -8%;
    z-index: -1;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--bg) 85%, transparent) 60%, transparent);
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
}

.hero-backdrop.is-drawn .hero::before { opacity: 1; }

/* The hero rises into place at first paint. CSS rather than anime.js, which loads after the page,
   and transform-only: the headline is painted (and counts as loaded) from the first frame. */
.hero-line { display: inline-block; animation: hero-line .9s var(--ease-out) both; }
.hero-line.accent { animation-delay: .08s; }
.hero .badge { animation: hero-rise .7s var(--ease-out) both; }
.hero-lead { animation: hero-rise .8s var(--ease-out) .12s both; }
.hero .cta-row { animation: hero-rise .8s var(--ease-out) .18s both; }
.hero .stats { animation: hero-rise .8s var(--ease-out) .24s both; }

@keyframes hero-line {
    from { transform: translateY(0.3em); filter: blur(6px); }
}

@keyframes hero-rise {
    from { transform: translateY(14px); }
}

.hero-lead {
    font-size: clamp(1rem, 1.7vw, 1.24rem);
    line-height: 1.6;
    color: var(--muted);
    max-width: 600px;
    margin: 0 auto 2rem;
    text-wrap: pretty;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    max-width: 520px;
    margin: 0 auto 2.5rem;
}

.btn {
    flex: 1 1 220px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 52px;
    padding: 0 1.6rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.02rem;
    white-space: nowrap;
    transition: transform .2s, filter .2s, border-color .2s;
}

.btn svg { width: 1em; height: 1em; }

.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.35); }
.btn--secondary { background: var(--surface); border: 1px solid var(--line2); color: var(--ink2); }

.btn--primary:hover { filter: brightness(0.93); transform: translateY(-2px); }
.btn--secondary:hover { border-color: var(--ink2); transform: translateY(-2px); }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1.4rem 1rem;
    max-width: 640px;
    margin: 0 auto;
}

.stat-value { font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.1rem); color: var(--ink); }

.stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-top: 0.25rem;
}

/* ---------- Sections ---------- */

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

.section { max-width: 1120px; margin: 0 auto; padding: clamp(2.75rem, 6vw, 5rem) var(--gutter) 0; }

.eyebrow {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-text);
    margin: 0 0 0.6rem;
}

.h2 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(1.55rem, 3.3vw, 2.4rem);
    letter-spacing: -0.02em;
    margin: 0 0 1.6rem;
    color: var(--ink);
    text-wrap: balance;
}

.trust {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem 1.5rem;
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.trust li {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--body);
    font-weight: 500;
}

.trust svg { color: var(--accent-text); flex-shrink: 0; }

/* ---------- Latest posters ---------- */

/* Filled from /latest.php by site.js; without JavaScript there is nothing to show. */
html:not(.js) .latest { display: none; }

.rail-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}

.rail-head .h2 { margin: 0; }

.rail-more { font-size: 0.92rem; font-weight: 700; }

.rail {
    display: grid;
    grid-auto-flow: column;
    /* Six across the content width on a desktop, never narrower than 140px. */
    grid-auto-columns: max(140px, calc((100% - 5 * 0.9rem) / 6));
    gap: 0.9rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 0.4rem;
    scroll-padding-left: var(--gutter);
    /* The arrows and dragging (site.js) replace the scrollbar. */
    scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }

.rail.is-dragging,
.rail.is-gliding { scroll-snap-type: none; }

.rail.is-dragging,
.rail.is-dragging * { cursor: grabbing; }

@media (pointer: fine) {
    .rail { cursor: grab; -webkit-user-select: none; user-select: none; }
}

.rail-wrap { position: relative; }

/* Centred on the content edge, at the height of the posters' middle (the captions take ~3rem). */
.rail-arrow {
    position: absolute;
    z-index: 2;
    top: calc((100% - 3rem) / 2);
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line2);
    background: var(--surface);
    color: var(--ink2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%);
    transition: opacity .2s, border-color .2s;
}

.rail-arrow[hidden] { display: none; }
.rail-arrow--prev { left: 0; }
.rail-arrow--next { left: 100%; }
.rail-arrow:hover { border-color: var(--ink2); }
.rail-arrow:disabled { opacity: 0; pointer-events: none; }

.poster { scroll-snap-align: start; min-width: 0; }

.poster a { display: block; color: var(--ink); }

.poster-art {
    display: block;
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: repeating-linear-gradient(45deg, var(--poster1), var(--poster1) 9px, var(--poster2) 9px, var(--poster2) 18px);
}

.poster-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

.poster-title,
.poster-meta { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.poster-title { margin-top: 0.55rem; font-weight: 600; font-size: 0.9rem; }
.poster-meta { margin-top: 0.1rem; font-size: 0.76rem; color: var(--faint); }

.poster--loading .poster-title {
    width: 70%;
    height: 0.9rem;
    border-radius: 4px;
    background: var(--poster1);
}

/* The main site's library line, as its home page prints it. */
.library {
    margin-top: 1.6rem;
    padding: 1.1rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.library-caption {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 0 0 0.75rem;
}

.library-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }

.library-stats > div { padding: 0 1.25rem; border-left: 1px solid var(--line); }
.library-stats > div:first-child { padding-left: 0; border-left: 0; }

.library-stats dt {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 0.3rem;
}

.library-stats dd {
    margin: 0;
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(1.3rem, 2.6vw, 1.75rem);
    letter-spacing: -0.02em;
    color: var(--ink);
    white-space: nowrap;
}

.library-stats .library-total dd { color: var(--accent-text); }

.library[aria-busy] .library-stats dd { color: var(--line2); }

/* ---------- Cards ---------- */

.card-grid { display: grid; gap: 0.9rem; }
.card-grid--steps { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card-grid--highlights { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow);
}

.card h3 { font-family: var(--display); font-weight: 700; font-size: 1.08rem; margin: 0 0 0.4rem; color: var(--ink); }
.card p { font-size: 0.95rem; line-height: 1.6; color: var(--muted); margin: 0; }

.step {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 1rem;
    align-items: start;
}

.step-num {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff;
    background: var(--accent);
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-row: span 2;
}

.step h3 { font-size: 1.12rem; margin: 0.35rem 0 0.4rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.chips + .chips { margin-top: 0.6rem; }

.chip {
    border: 1px solid var(--line2);
    background: var(--surface);
    color: var(--body);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 500;
}

.chip--accent { border-color: var(--accent-line); background: var(--accent-tint); color: var(--accent-text); font-weight: 600; }

/* ---------- Long read ---------- */

.article { max-width: 820px; margin: 0 auto; padding: clamp(3.25rem, 7vw, 6rem) var(--gutter) 0; }

.toc {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.1rem 1.25rem;
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.toc-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 0 0 0.75rem;
}

.toc-links { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.toc-links a {
    display: block;
    border: 1px solid var(--line2);
    color: var(--ink2);
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 600;
}

.toc-links a:hover { border-color: var(--accent); }

.chapter { scroll-margin-top: 84px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.chapter:last-child { margin-bottom: 0; }

.chapter .h2 { margin-bottom: 1.2rem; }
.chapter .h2--tight { margin-bottom: 0.6rem; }

.prose {
    font-size: 1.03rem;
    line-height: 1.8;
    color: var(--body);
    margin: 0 0 1rem;
    text-wrap: pretty;
}

.prose--muted { color: var(--muted); }
.accent-name { color: var(--accent-text); font-weight: 600; }

.chapter h3 { font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin: 1.4rem 0 0.9rem; color: var(--ink); }

.panels { display: flex; flex-direction: column; gap: 0.8rem; }
.panels + h3 { margin-top: 1.6rem; }
.panels--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem; }
.panel h4 { font-family: var(--display); font-weight: 700; font-size: 1.04rem; margin: 0 0 0.4rem; color: var(--ink); }
.panel p { font-size: 0.97rem; line-height: 1.7; color: var(--muted); margin: 0; }
.panels--grid .panel p { font-size: 0.95rem; line-height: 1.65; }

.reasons { border-top: 1px solid var(--line); margin: 1.3rem 0 1.6rem; }
.reason { border-bottom: 1px solid var(--line); }

.reason summary,
.faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
    padding: 0.9rem 0;
    font-weight: 700;
}

.reason summary { font-family: var(--display); }

.reason h3 {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    margin: 0;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--ink);
}

.reason-num { font-family: var(--mono); font-size: 0.75rem; font-weight: 500; color: var(--faint); }

.reason-body { padding: 0 0 1.1rem 2.1rem; }
.reason-body p { font-size: 0.99rem; line-height: 1.75; color: var(--body); margin: 0 0 0.7rem; text-wrap: pretty; }

.chev { color: var(--accent-text); font-size: 1.35rem; line-height: 1; transition: transform .25s; flex-shrink: 0; }
details[open] > summary .chev { transform: rotate(45deg); }

/* ---------- FAQ ---------- */

.faq-section { scroll-margin-top: 84px; max-width: 820px; margin: 0 auto; padding: clamp(3.25rem, 7vw, 6rem) var(--gutter) 0; }
.faq-section .h2 { margin-bottom: 1.4rem; }

.faq {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 1.2rem;
    margin-bottom: 0.6rem;
}

.faq h3 { margin: 0; font-weight: 700; font-size: 1.03rem; color: var(--ink); }
.faq p { font-size: 0.97rem; line-height: 1.7; color: var(--muted); margin: 0 0 1.1rem; }

/* ---------- Closing band ---------- */

.band-wrap { max-width: 1120px; margin: clamp(3.25rem, 7vw, 6rem) auto 0; padding: 0 var(--gutter); }

.band {
    border-radius: 22px;
    background: var(--band);
    border: 1px solid var(--bandline);
    padding: clamp(2rem, 5vw, 3.6rem) clamp(1.4rem, 4vw, 3rem);
    text-align: center;
}

.band h2 {
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(1.7rem, 4vw, 2.8rem);
    letter-spacing: -0.02em;
    margin: 0 0 0.8rem;
    color: var(--bandink);
}

.band p { font-size: 1.03rem; color: var(--bandmuted); margin: 0 auto 1.7rem; max-width: 480px; }

.band .cta-row { max-width: 480px; margin: 0 auto; }
.band .btn { flex-basis: 200px; font-size: 1rem; }
.band .btn--primary { box-shadow: none; }
.band .btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.28); color: var(--bandink); }
.btn--ghost:hover { border-color: var(--bandink); transform: translateY(-2px); }

/* ---------- Footer ---------- */

.site-footer { max-width: 1120px; margin: 0 auto; padding: clamp(2.75rem, 6vw, 4.5rem) var(--gutter) 3rem; }

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 1.8rem;
}

.footer-inner p { font-size: 0.85rem; color: var(--faint); margin: 0; }

/* ---------- Back to top: a floating button, or a bottom bar on phones ---------- */

.to-top {
    position: fixed;
    bottom: 1.6rem;
    right: 1.6rem;
    z-index: 90;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s, visibility .25s, transform .25s;
}

.mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: none;
    gap: 0.5rem;
    align-items: center;
    padding: 0.65rem 0.9rem calc(0.65rem + env(safe-area-inset-bottom));
    background: var(--headerbg);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    visibility: hidden;
    transform: translateY(100%);
    transition: visibility .25s, transform .25s;
}

.mobile-bar a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}

.mobile-bar .bar-primary { background: var(--accent); color: #fff; }
.mobile-bar .bar-secondary { background: var(--surface); border: 1px solid var(--line2); color: var(--ink2); }

.mobile-bar button {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid var(--line2);
    background: var(--surface);
    color: var(--ink2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.is-scrolled .to-top { opacity: 1; visibility: visible; transform: none; }
.is-scrolled .mobile-bar { visibility: visible; transform: none; }

/* ---------- VPN dialog ---------- */

.vpn-dialog {
    width: calc(100% - 2 * clamp(0.75rem, 2vw, 2rem));
    max-width: 620px;
    max-height: 90vh;
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    overflow: visible;
}

.vpn-dialog::backdrop {
    background: rgba(10, 8, 6, 0.6);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.dialog-panel {
    max-height: 90vh;
    overflow-y: auto;
    padding: clamp(1.3rem, 3vw, 2.4rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
}

.vpn-dialog[open] .dialog-panel { animation: dialog-in .25s ease; }

/* motion.js springs it in instead. */
.motion .vpn-dialog[open] .dialog-panel { animation: none; }

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}

.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }

.dialog-head h2 {
    font-family: var(--display);
    font-size: clamp(1.15rem, 2.5vw, 1.5rem);
    font-weight: 800;
    margin: 0;
    color: var(--ink);
}

.dialog-close {
    background: var(--soft);
    border: 1px solid var(--line);
    color: var(--muted);
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s;
}

.dialog-close:hover { transform: rotate(90deg); }

.dialog-body { color: var(--body); line-height: 1.65; font-size: clamp(0.92rem, 1.5vw, 1rem); }
.dialog-body p { margin: 0 0 1rem; }

.notice {
    background: var(--accent-tint);
    border: 1px solid var(--accent-line-soft);
    padding: 0.9rem 1rem;
    margin: 0 0 1.2rem;
    border-radius: 12px;
}

.dialog-body .notice-title { margin: 0 0 0.35rem; font-weight: 700; color: var(--accent-text); }
.dialog-body .notice p:last-child { margin: 0; }

.dialog-body .vpn-label { margin: 0 0 0.8rem; font-weight: 700; color: var(--ink); }

.vpn-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.7rem;
    margin: 0 0 1.2rem;
}

.vpn-option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    background: var(--soft2);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--ink);
    transition: border-color .25s;
}

.vpn-option:hover { border-color: var(--ink2); }
.vpn-option svg { color: var(--accent-text); flex-shrink: 0; }
.vpn-option span { display: flex; flex-direction: column; }
.vpn-option strong { font-size: 0.96rem; }
.vpn-option small { font-size: 0.78rem; color: var(--faint); }

.dialog-body .dialog-tip { margin: 0; font-size: 0.88rem; color: var(--faint); }

/* ---------- Breakpoints ---------- */

/* On desktops the hero's vertical spacing follows the window's height, so the hero and the checklist
   under it fit the first screen of a 1080p display at 125% scaling (about 1536x730) and of 768p
   laptops (about 1366x657), and sit higher on a 1080p display at 100% (about 1920x937). */
@media (min-width: 1024px) {
    .hero { padding-top: clamp(2.25rem, 6.5vh, 6.5rem); padding-bottom: clamp(1.75rem, 4.5vh, 4rem); }
    .badge { margin-bottom: clamp(1rem, 2.2vh, 1.5rem); }
    .hero-lead { margin-bottom: clamp(1.5rem, 3vh, 2rem); }
    .hero .cta-row { margin-bottom: clamp(1.75rem, 3.5vh, 2.5rem); }
}

@media (max-width: 639.98px) {
    .rail-arrow { width: 38px; height: 38px; }

    .library-stats { grid-template-columns: repeat(2, 1fr); gap: 1rem 0; }
    .library-stats > div:nth-child(odd) { padding-left: 0; border-left: 0; }

    .to-top { display: none; }
    .mobile-bar { display: flex; }
    .site-footer { padding-bottom: calc(3rem + 76px); }

    /* The dialog becomes a bottom sheet. */
    .vpn-dialog { width: 100%; max-width: 100%; margin: auto 0 0; }
    .dialog-panel { border-radius: 20px 20px 0 0; }
}

@media (max-width: 419.98px) {
    .header-telegram-icon { display: flex; }
    .header-telegram-text { display: none; }
}

/* Below 360px the header runs out of room: its Telegram icon gives way (Telegram stays in the hero
   and the bottom bar) and the wordmark shrinks a little. */
@media (max-width: 359.98px) {
    .header-telegram-icon { display: none; }
    .brand-name { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after { transition: none !important; animation: none !important; }

    .btn:hover { transform: none; }
}
