/* Base: design tokens, type, shared components (buttons, chips, links), header and player. */

@font-face {
    font-family: "Mona Sans";
    src: url("../resources/fonts/mona-sans-latin.woff2") format("woff2");
    font-weight: 200 900;
    font-stretch: 75% 125%;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Colour */
    --ink: #07111f;
    --ink-deep: #040b14;
    --ink-raised: #0e1b2c;
    --ink-glass: rgba(12, 25, 42, 0.78);
    --paper: #eef3f9;
    --paper-soft: #c9d4e2;
    --mist: #93a4ba;
    --blue: #6aa8ff;
    --aqua: #6ee7d8;
    --lime: #b9f36a;
    --amber: #f4c66f;
    --violet: #b89cff;
    --rose: #ff8a7a;
    --line: rgba(166, 194, 226, 0.14);
    --line-strong: rgba(166, 194, 226, 0.28);

    /* Type */
    --font: "Mona Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-math: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Noto Sans Math", math, serif;
    --text-sm: clamp(0.82rem, 0.79rem + 0.12vw, 0.9rem);
    --text-base: clamp(0.94rem, 0.89rem + 0.22vw, 1.06rem);
    --text-lead: clamp(1.02rem, 0.92rem + 0.42vw, 1.28rem);
    --text-h3: clamp(1.02rem, 0.94rem + 0.36vw, 1.28rem);
    --text-title: clamp(2rem, min(4.4vw, 7.6vh), 3.96rem);

    /* Layout */
    --shell: 76rem;
    --gutter: clamp(1rem, 4vw, 3rem);
    --header-height: 4.25rem;
    --player-height: 3.75rem;
    --radius-sm: 0.7rem;
    --radius: 1.15rem;
    --radius-lg: 1.75rem;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* The layout is sized in rem, so this one value scales the whole site: 16px on
   common screens, up to 22px on large monitors and down to 13px on screens that
   are very short (a phone held sideways). Tuned so it stays 16px at 1440 x 900. */
html {
    background: var(--ink);
    font-size: clamp(
        81.25%,
        min(
            max(100%, min(0.682vw + 0.284rem, 1.111vh + 0.375rem)),
            max(0.732vh + 0.634rem, 1.111vh + 0.375rem)
        ),
        137.5%
    );
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 20rem;
    overflow-x: hidden;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: 420;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--aqua);
    color: var(--ink-deep);
}

img,
svg,
video {
    display: block;
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

h1,
h2,
h3 {
    color: var(--paper);
    font-weight: 700;
    line-height: 1.08;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

:focus-visible {
    outline: 2px solid var(--aqua);
    outline-offset: 3px;
    border-radius: 0.35rem;
}

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

/* These buttons need JavaScript. */
html:not(.js) [data-watch-open],
html:not(.js) [data-replay] {
    display: none;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.icon .fill,
.icon--logo {
    fill: currentColor;
    stroke: none;
}

.icon--small {
    width: 0.95em;
    height: 0.95em;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.7rem 1rem;
    transform: translateY(-160%);
    border-radius: 0.5rem;
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Shared text pieces */

.chapter-title {
    --stretch: 112%;
    width: fit-content;
    max-width: 100%;
    font-size: var(--text-title);
    font-stretch: var(--stretch);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1;
}

.lead {
    color: var(--paper-soft);
    font-size: var(--text-lead);
    line-height: 1.5;
}

.kicker {
    color: var(--mist);
    font-size: var(--text-lead);
    font-weight: 500;
    line-height: 1.4;
}

/* Buttons and links */

.button {
    display: inline-flex;
    min-height: 3.1rem;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.7rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, translate 180ms ease;
}

.button:hover {
    translate: 0 -2px;
}

.button--primary {
    background: var(--paper);
    color: var(--ink-deep);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.button--primary:hover {
    background: var(--aqua);
}

.button--ghost {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--paper-soft);
}

.button--ghost:hover {
    border-color: rgba(106, 168, 255, 0.6);
    color: var(--paper);
}

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

.link {
    display: inline-flex;
    min-height: 2.6rem;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid rgba(110, 231, 216, 0.3);
    border-radius: 999px;
    background: rgba(110, 231, 216, 0.07);
    color: var(--aqua);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.link:hover {
    border-color: rgba(110, 231, 216, 0.6);
    background: rgba(110, 231, 216, 0.15);
}

.link img {
    width: 1.1rem;
    height: 1.1rem;
    object-fit: contain;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chips li {
    padding: 0.32rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--paper-soft);
    font-size: var(--text-sm);
    font-weight: 520;
    line-height: 1.3;
}

/* Header */

.topbar {
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: var(--header-height);
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0 var(--gutter);
    padding-top: env(safe-area-inset-top, 0px);
    background: linear-gradient(to bottom, rgba(7, 17, 31, 0.92), rgba(7, 17, 31, 0.62) 60%, transparent);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand__mark {
    position: relative;
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
}

.brand__initials {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    border: 1px solid rgba(110, 231, 216, 0.42);
    border-radius: 0.7rem;
    background: linear-gradient(145deg, rgba(110, 231, 216, 0.14), rgba(106, 168, 255, 0.05));
    color: var(--aqua);
    font-size: 0.72rem;
    font-stretch: 110%;
    letter-spacing: 0.04em;
}

.brand__avatar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 30%;
    opacity: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.topbar__nav {
    display: flex;
    gap: clamp(1rem, 2.2vw, 2rem);
}

.topbar__nav a {
    position: relative;
    padding-block: 0.6rem;
    color: var(--mist);
    font-size: 0.88rem;
    font-weight: 600;
    transition: color 160ms ease;
}

.topbar__nav a::after {
    position: absolute;
    right: 0;
    bottom: 0.3rem;
    left: 0;
    height: 1px;
    transform: scaleX(0);
    background: var(--aqua);
    content: "";
    transition: transform 180ms ease;
}

.topbar__nav a:hover,
.topbar__nav a[aria-current] {
    color: var(--paper);
}

.topbar__nav a[aria-current]::after {
    transform: scaleX(1);
}

.topbar__cta {
    display: inline-flex;
    min-height: 2.6rem;
    align-items: center;
    padding: 0 1.05rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--paper-soft);
    font-size: 0.88rem;
    font-weight: 650;
    transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.topbar__cta:hover {
    border-color: rgba(110, 231, 216, 0.55);
    background: rgba(110, 231, 216, 0.07);
    color: var(--aqua);
}

/* Player: only shown in film mode, see film.css */

.player {
    display: none;
}

/* Video dialog */

.watch {
    width: min(100% - 2rem, 70rem);
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--paper);
}

.watch::backdrop {
    background: rgba(2, 6, 12, 0.86);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.watch__frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #000;
    box-shadow: var(--shadow);
}

.watch__video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.watch__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(4, 11, 20, 0.75);
    cursor: pointer;
}

.watch__close .icon {
    width: 1.3rem;
    height: 1.3rem;
}

@media (max-width: 52rem) {
    .topbar__nav {
        display: none;
    }
}

@media (max-width: 30rem) {
    .brand__name {
        font-size: 0.95rem;
    }
}
