/* KataLog: a ring binder of apps.
   Palette, type and radii follow .github/design.md; materials (metal, tape) derive from it. */

:root {
    --bg: #F5F7FB;
    --paper: #FEFEFE;
    --paper-edge: #D9DEE7;
    --ink: #111827;
    --ink-soft: #6B7280;
    --primary: #2D6CB5;
    --accent: #34C759;
    --accent-ink: #1E8E3E;
    --warn: #B45309;
    --danger: #B91C1C;
    --rule: color-mix(in srgb, var(--ink) 12%, transparent);
    --hole: #1B2333;

    --cover: color-mix(in oklab, var(--primary) 58%, #0B1220);
    --cover-deep: color-mix(in oklab, var(--primary) 38%, #0B1220);
    --cover-ink: #FFFFFF;
    --cover-ink-soft: color-mix(in srgb, #FFFFFF 72%, transparent);

    --metal-hi: #FBFCFD;
    --metal-mid: #C3C9D2;
    --metal-lo: #7C8491;
    --metal-edge: #3E4551;
    --tape: #14171D;
    --tape-ink: #F3F4F6;

    --radius: 8px;
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lift: 0 18px 40px rgba(17, 24, 39, 0.22), 0 4px 10px rgba(17, 24, 39, 0.12);

    --font: Inter, system-ui, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

    --flip: 900ms;
    --ease: cubic-bezier(0.645, 0.045, 0.355, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121214;
        --paper: #20242C;
        --paper-edge: #0E1014;
        --ink: #FFFFFF;
        --ink-soft: #A0A6B1;
        --primary: #60A5FA;
        --accent: #4ADE80;
        --accent-ink: #4ADE80;
        --warn: #FBBF24;
        --danger: #F87171;
        --hole: #07080A;

        --cover: color-mix(in oklab, var(--primary) 22%, #0B0D12);
        --cover-deep: color-mix(in oklab, var(--primary) 12%, #0B0D12);

        --metal-hi: #E8EBF0;
        --metal-mid: #9EA6B2;
        --metal-lo: #5B6370;
        --metal-edge: #1C2028;
        --tape: #050608;

        --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lift: 0 22px 50px rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.4);
    }
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background:
        radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--paper) 70%, transparent), transparent 70%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

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

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

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

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- Tones: one per family, reused by tabs, stamps and labels ---------- */

.tone--contents { --tone: var(--ink-soft); --tone-ink: var(--ink-soft); }
.tone--devlife  { --tone: var(--primary); --tone-ink: var(--primary); }
.tone--solo     { --tone: var(--accent); --tone-ink: var(--accent-ink); }
.tone--oss      { --tone: var(--ink); --tone-ink: var(--ink); }
.tone--soon     { --tone: var(--ink-soft); --tone-ink: var(--ink-soft); }

/* ---------- Desk ---------- */

.desk {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 24px;
}

/* On a narrow screen the links drop under the brand rather than squeezing it */
.topbar__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: auto;
}

.topbar__link {
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink-soft);
    padding: 6px 12px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    transition: color 150ms, border-color 150ms;
}

.topbar__link:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Embossed label-maker tape */
.label {
    display: inline-block;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--tape-ink);
    background: linear-gradient(180deg, color-mix(in srgb, var(--tape) 88%, #FFFFFF), var(--tape) 45%);
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.35);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.28);
}

/* The brand keeps its own capitals: KataLog, Mafyou IT */
.label--brand {
    white-space: nowrap;
    text-transform: none;
    font-size: 15px;
    padding: 7px 10px 7px 14px;
}

.label--tape {
    font-size: 0.7em;
    padding: 0.5em 0.6em 0.5em 0.9em;
    transform: rotate(-2deg);
}

.button {
    display: inline-flex;
    align-items: center;
    font-size: 0.82em;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    color: var(--paper);
    background: var(--ink);
    padding: 0.72em 1.05em;
    border-radius: var(--radius);
    transition: background-color 150ms, transform 150ms;
}

.button:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

.button--ghost {
    color: var(--ink);
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--ink);
}

.button--ghost:hover {
    color: var(--primary);
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--primary);
}

/* Ink stamp */
.stamp {
    display: inline-block;
    flex: none;
    font-family: var(--mono);
    font-size: 0.66em;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--tone-ink);
    padding: 0.42em 0.7em 0.38em 0.86em;
    border: 0.16em solid currentColor;
    border-radius: 0.5em;
    outline: 0.07em solid currentColor;
    outline-offset: 0.16em;
    opacity: 0.86;
    transform: rotate(-7deg);
}

/* ---------- Section tabs, bar version (stacked layout) ---------- */

.tabbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rule);
}

.tabbar__tab {
    flex: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: var(--tone-ink);
    padding: 7px 14px;
    background: var(--paper);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 3px solid var(--tone);
    box-shadow: var(--shadow-card);
}

/* ---------- Binder, stacked layout: small screens and no-script ---------- */

.binder {
    flex: 1;
    width: 100%;
    max-width: 608px;
    margin: 0 auto;
    padding: 20px 16px 48px 28px;
}

.binder__board,
.binder__stack,
.mech,
.turn,
.controls,
.panel--back,
.panel__hint,
.tab {
    display: none;
}

.panel--front {
    position: relative;
    isolation: isolate;
    margin: 0 0 32px -12px;
    padding: 32px 24px 0;
    overflow: hidden;
    color: var(--cover-ink);
    background: linear-gradient(160deg, var(--cover), var(--cover-deep));
    border-radius: 14px;
    box-shadow: var(--shadow-lift);
}

.panel--front::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px dashed color-mix(in srgb, var(--cover-ink) 28%, transparent);
    border-radius: 9px;
    pointer-events: none;
}

.panel__title {
    margin-top: 0.5em;
    font-size: 3.4em;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.045em;
}

.panel__tagline {
    margin-top: 0.7em;
    font-size: 1.12em;
    font-weight: 600;
}

.panel__lead {
    margin-top: 0.3em;
    font-size: 0.94em;
    color: var(--cover-ink-soft);
}

.pocket {
    position: relative;
    margin: 2.2em -24px 0;
    padding: 0 24px;
}

/* The pocket's front lip hides the bottom of the card */
.pocket::after {
    content: "";
    position: absolute;
    inset: 64% 0 0;
    background: linear-gradient(175deg, color-mix(in oklab, var(--cover) 90%, #FFFFFF), var(--cover-deep));
    clip-path: polygon(0 34%, 100% 0, 100% 100%, 0 100%);
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    width: min(100%, 17em);
    padding: 1.1em 1.2em 3.2em;
    color: #111827;
    text-decoration: none;
    background: #FEFEFE;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transform: rotate(-3deg);
    transition: transform 300ms var(--ease);
}

.card:hover {
    transform: rotate(-1.5deg) translateY(-0.6em);
}

.card__logo {
    width: 6.4em;
    height: auto;
    margin-left: -0.3em;
}

.card__motto {
    font-size: 0.86em;
    font-weight: 600;
}

.card__site {
    font-family: var(--mono);
    font-size: 0.72em;
    color: #2D6CB5;
}

/* ---------- Sheets ---------- */

.leaf {
    display: contents;
}

.sheet {
    --hole-x: 1.08em;
    --holes: radial-gradient(circle at center, var(--hole) 0 0.37em, color-mix(in srgb, var(--ink) 24%, transparent) 0.38em 0.45em, transparent 0.47em);
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 28px;
    padding: 1.5em 1.5em 1.4em 2.9em;
    color: var(--ink);
    background:
        var(--holes) left top / calc(var(--hole-x) * 2) 25% repeat-y,
        linear-gradient(90deg, color-mix(in srgb, var(--ink) 9%, transparent), transparent 14%),
        var(--paper);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--paper-edge), 0 3px 0 -1px var(--paper), 0 4px 0 -1px var(--paper-edge), var(--shadow-lift);
}

/* Stacked layout: a ring goes through each hole and loops around the edge of the sheet.
   The mask hides the half that passes behind the paper. */
.sheet::before {
    --overhang: 0.9em;
    content: "";
    position: absolute;
    inset: 0 auto 0 calc(var(--overhang) * -1);
    width: calc(var(--overhang) + var(--hole-x) + 0.34em);
    background:
        radial-gradient(50% 0.56em at 50% 50%,
            transparent 52%,
            var(--metal-edge) 55%,
            var(--metal-hi) 68%,
            var(--metal-mid) 83%,
            var(--metal-lo) 93%,
            var(--metal-edge) 98%,
            transparent 100%) left top / 100% 25% repeat-y;
    -webkit-mask:
        linear-gradient(90deg, #000 var(--overhang), transparent var(--overhang)),
        linear-gradient(180deg, #000 50%, transparent 50%) left top / 100% 25% repeat-y;
    mask:
        linear-gradient(90deg, #000 var(--overhang), transparent var(--overhang)),
        linear-gradient(180deg, #000 50%, transparent 50%) left top / 100% 25% repeat-y;
    filter: drop-shadow(0 0.12em 0.12em rgba(8, 12, 22, 0.35));
    pointer-events: none;
}

.sheet__head {
    display: flex;
    justify-content: space-between;
    gap: 1em;
    padding-bottom: 0.75em;
    margin-bottom: 1.25em;
    font-family: var(--mono);
    font-size: 0.64em;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--rule);
}

.sheet__family {
    color: var(--tone-ink);
}

.sheet__title {
    font-size: 2.2em;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.sheet__lead {
    margin-top: 0.5em;
    font-size: 0.9em;
    color: var(--ink-soft);
}

.sheet__folio {
    position: absolute;
    bottom: 0.9em;
    right: 1.4em;
    font-family: var(--mono);
    font-size: 0.64em;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    display: none;
}

.sheet__colophon {
    margin-top: auto;
    padding-top: 2em;
    font-size: 0.8em;
    color: var(--ink-soft);
}

/* ---------- App sheet ---------- */

.app__identity {
    display: flex;
    align-items: center;
    gap: 1em;
}

.app__icon {
    flex: none;
    width: 4.5em;
    height: 4.5em;
    object-fit: cover;
    border-radius: 22%;
    box-shadow: 0 0.35em 0.9em rgba(17, 24, 39, 0.22), 0 0 0 1px var(--rule);
}

.app__titles {
    flex: 1;
    min-width: 0;
}

.app__category {
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--primary);
}

.app__name {
    font-size: 1.9em;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.app__tagline {
    margin-top: 1.05em;
    font-size: 1.12em;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.app__desc {
    margin-top: 0.55em;
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.app__features {
    display: grid;
    gap: 0.38em;
    margin-top: 0.95em;
    font-size: 0.88em;
    font-weight: 500;
    line-height: 1.35;
}

.app__features li {
    position: relative;
    padding-left: 1.6em;
}

.app__features li::before {
    content: "";
    position: absolute;
    left: 0.1em;
    top: 0.28em;
    width: 0.52em;
    height: 0.28em;
    border-left: 0.16em solid var(--accent-ink);
    border-bottom: 0.16em solid var(--accent-ink);
    transform: rotate(-45deg);
}

@media (max-width: 560px) {
    .app__identity .stamp {
        display: none;
    }
}

/* Screenshots: prints fanned out and taped on the sheet */
.app__shots {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5em 0 1.3em;
    container-type: inline-size;
}

.shot {
    position: relative;
    flex: none;
    height: min(15em, 58cqw);
    aspect-ratio: 9 / 16;
    padding: 0.28em;
    margin: 0 -0.35em;
    background: #FFFFFF;
    border: 0;
    border-radius: 0.5em;
    box-shadow: 0 0.5em 1.2em rgba(17, 24, 39, 0.25), 0 0 0 1px rgba(17, 24, 39, 0.08);
    cursor: zoom-in;
    transition: transform 320ms var(--ease), box-shadow 320ms;
}

.shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 0.3em;
}

/* Strip of tape holding the print */
.shot::before {
    content: "";
    position: absolute;
    top: -0.55em;
    left: 50%;
    width: 3.2em;
    height: 1.05em;
    background: color-mix(in srgb, var(--accent) 42%, transparent);
    border-left: 1px dashed rgba(255, 255, 255, 0.5);
    border-right: 1px dashed rgba(255, 255, 255, 0.5);
    transform: translateX(-50%) rotate(-3deg);
    z-index: 1;
}

.shot--1 { transform: rotate(-4deg) translateY(0.3em); }
.shot--2 { transform: translateY(-0.35em); z-index: 1; }
.shot--3 { transform: rotate(4deg) translateY(0.3em); }
.shot--1::before { background: color-mix(in srgb, var(--primary) 38%, transparent); }
.shot--3::before { background: color-mix(in srgb, var(--primary) 38%, transparent); transform: translateX(-50%) rotate(4deg); }

button.shot:hover,
button.shot:focus-visible {
    transform: translateY(-0.7em) scale(1.04);
    box-shadow: 0 1em 2em rgba(17, 24, 39, 0.35), 0 0 0 1px rgba(17, 24, 39, 0.08);
    z-index: 2;
}

.app__shots--icon .shot {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 5;
    padding: 1.4em 1.4em 2.6em;
    margin: 0;
    cursor: default;
    transform: rotate(-3deg);
}

.app__shots--icon .shot img {
    height: auto;
    border-radius: 22%;
}

.app__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6em 1em;
    margin-top: auto;
}

.app__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.app__links .button + .button {
    color: var(--ink);
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--ink);
}

.app__links .button + .button:hover {
    color: var(--primary);
    box-shadow: inset 0 0 0 1.5px var(--primary);
}

.app__more {
    align-self: center;
    font-size: 0.8em;
    font-weight: 700;
    color: var(--primary);
    text-underline-offset: 0.2em;
}

.app__soon,
.app__platforms {
    font-family: var(--mono);
    font-size: 0.66em;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

/* ---------- Contents sheet ---------- */

.toc {
    margin-top: 1.25em;
}

.toc__family {
    font-family: var(--mono);
    font-size: 0.66em;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tone-ink);
}

.toc__list {
    margin-top: 0.3em;
}

.toc__row {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.26em 0;
    text-decoration: none;
    border-radius: 4px;
}

.toc__icon {
    flex: none;
    width: 1.5em;
    height: 1.5em;
    border-radius: 24%;
    box-shadow: 0 0 0 1px var(--rule);
    transition: transform 200ms var(--ease);
}

/* A name too long for a narrow sheet wraps rather than push the page number off the paper:
   it leaves room for the icon, the dots and the number */
.toc__name {
    flex: none;
    max-width: calc(100% - 6.2em);
    font-size: 0.96em;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.toc__category {
    font-size: 0.76em;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc__dots {
    flex: 1;
    min-width: 1em;
    height: 0.9em;
    border-bottom: 1.5px dotted color-mix(in srgb, var(--ink) 30%, transparent);
}

.toc__page {
    font-family: var(--mono);
    font-size: 0.8em;
    font-weight: 600;
    color: var(--ink-soft);
}

.toc__row:hover .toc__name,
.toc__row:hover .toc__page {
    color: var(--primary);
}

.toc__row:hover .toc__icon {
    transform: scale(1.18) rotate(-4deg);
}

/* ---------- Guide sheet ---------- */

.guide {
    display: grid;
    gap: 1.5em;
    margin-top: 1.8em;
}

.guide__entry {
    display: grid;
    grid-template-columns: 6.6em 1fr;
    align-items: start;
    gap: 1.1em;
}

.guide__entry .stamp {
    justify-self: start;
    margin-top: 0.5em;
}

.guide__entry--note {
    align-items: center;
    padding-top: 1.4em;
    border-top: 1px solid var(--rule);
}

.guide__entry--note .stamp {
    margin-top: 0;
}

.guide__name {
    font-size: 1.12em;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.guide__text {
    margin-top: 0.25em;
    font-size: 0.86em;
    line-height: 1.5;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.guide__link {
    display: inline-block;
    margin-top: 0.5em;
    font-size: 0.86em;
    font-weight: 700;
    color: var(--primary);
    text-underline-offset: 0.2em;
}

/* ---------- Contact sheet ---------- */

.contact {
    margin-top: 1.8em;
    border-top: 1px solid var(--rule);
}

.contact__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.2em 1em;
    padding: 0.95em 0;
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    transition: padding-left 200ms var(--ease);
}

.contact__name {
    font-size: 1.05em;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.contact__url {
    font-family: var(--mono);
    font-size: 0.74em;
    color: var(--ink-soft);
}

.contact__row:hover {
    padding-left: 0.5em;
}

.contact__row:hover .contact__name,
.contact__row:hover .contact__url {
    color: var(--primary);
}

/* ---------- Lightbox ---------- */

.lightbox {
    max-width: none;
    max-height: none;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 24px;
    background: transparent;
    border: 0;
    cursor: zoom-out;
}

.lightbox[open] {
    display: grid;
    place-items: center;
}

.lightbox::backdrop {
    background: rgba(8, 10, 16, 0.82);
    backdrop-filter: blur(6px);
}

.lightbox__image {
    max-width: 100%;
    max-height: calc(100dvh - 48px);
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lightbox__close {
    position: fixed;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.14);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.lightbox__close svg,
.controls__turn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Error page ---------- */

.desk--lost {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.lost {
    display: grid;
    justify-items: start;
    gap: 16px;
    max-width: 420px;
    padding: 32px;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
}

.lost__title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.lost__text,
.lost__request {
    color: var(--ink-soft);
}

.lost__request {
    font-size: 14px;
}

/* ====================================================================
   Welcome: a word about Mafyou IT next to the closed binder.
   ==================================================================== */

.welcome {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 34em) auto;
    align-items: center;
    justify-content: center;
    gap: 48px 96px;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 72px;
}

.welcome__title {
    margin-top: 0.55em;
    font-size: clamp(2.4em, 6vw, 4em);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.045em;
    text-wrap: balance;
}

.welcome__lead {
    margin-top: 0.9em;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    text-wrap: pretty;
}

.welcome__body {
    margin-top: 0.8em;
    font-size: 1.05em;
    line-height: 1.6;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.welcome__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 36px;
    margin: 1.8em 0 2em;
}

.welcome__facts dt {
    font-size: 2em;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--primary);
}

.welcome__facts dd {
    margin: 0.3em 0 0;
    font-family: var(--mono);
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.button--big {
    font-size: 1.05em;
    padding: 1em 1.6em;
}

/* The closed binder: a box seen slightly from the side, spine on the left, sheets showing on the right */
.closed {
    --w: min(340px, 62vw);
    --h: calc(var(--w) * 1.36);
    --d: calc(var(--w) * 0.17);
    display: block;
    width: var(--w);
    height: var(--h);
    margin: 0 calc(var(--d) * 0.6);
    color: var(--cover-ink);
    text-decoration: none;
    perspective: 1800px;
}

.closed__body {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(24deg);
    transition: transform 500ms var(--ease);
}

.closed:hover .closed__body,
.closed:focus-visible .closed__body {
    transform: rotateY(17deg);
}

.closed__spine,
.closed__pages,
.closed__sheet,
.closed__cover {
    position: absolute;
    top: 0;
    height: 100%;
}

.closed__spine {
    left: calc(50% - var(--d) / 2);
    width: var(--d);
    background:
        radial-gradient(circle at 50% 78%, rgba(0, 0, 0, 0.55) 0 calc(var(--d) * 0.2), rgba(255, 255, 255, 0.25) calc(var(--d) * 0.2) calc(var(--d) * 0.25), transparent calc(var(--d) * 0.27)),
        linear-gradient(90deg, var(--cover-deep), var(--cover) 45%, var(--cover-deep));
    border-radius: 4px;
    transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
}

/* The edge of the sheets, between the two covers */
.closed__pages {
    left: calc(50% - var(--d) / 2 + 4px);
    width: calc(var(--d) - 8px);
    top: 6px;
    height: calc(100% - 12px);
    background: repeating-linear-gradient(90deg, var(--paper) 0 2px, var(--paper-edge) 2px 3px);
    transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 8px));
}

/* First sheet, seen when the cover opens */
.closed__sheet {
    left: 6px;
    right: 8px;
    top: 6px;
    height: calc(100% - 12px);
    background:
        radial-gradient(circle at center, var(--hole) 0 5px, transparent 6px) left top / 28px 25% repeat-y,
        var(--paper);
    border-radius: 2px;
    transform: translateZ(calc(var(--d) / 2 - 3px));
}

/* The cover board turns on its hinge: its front carries the title, its inside is plain lining */
.closed__cover {
    left: 0;
    width: 100%;
    transform-style: preserve-3d;
    transform-origin: left center;
    transform: translateZ(calc(var(--d) / 2));
    transition: transform 700ms var(--ease);
}

.closed__front,
.closed__inside {
    position: absolute;
    inset: 0;
    border-radius: 4px 12px 12px 4px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.closed__front {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 13% 10% 10% 14%;
    background: linear-gradient(160deg, var(--cover), var(--cover-deep));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.closed__inside {
    background: linear-gradient(200deg, color-mix(in oklab, var(--cover) 82%, #FFFFFF), var(--cover));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    transform: rotateY(180deg);
}

/* Stitching, and the hinge crease along the spine */
.closed__front::before {
    content: "";
    position: absolute;
    inset: 9px;
    border: 1px dashed color-mix(in srgb, var(--cover-ink) 28%, transparent);
    border-radius: 2px 8px 8px 2px;
}

.closed__front::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 7%;
    width: 2px;
    background: rgba(0, 0, 0, 0.28);
    box-shadow: 2px 0 0 rgba(255, 255, 255, 0.08);
}

.closed.is-opening .closed__cover {
    transform: translateZ(calc(var(--d) / 2)) rotateY(-128deg);
}

.closed.is-opening .closed__body {
    transform: rotateY(8deg);
}

.closed__title {
    margin-top: 0.5em;
    font-size: calc(var(--w) * 0.17);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.045em;
}

.closed__tagline {
    margin-top: 0.7em;
    font-size: calc(var(--w) * 0.047);
    font-weight: 600;
    color: var(--cover-ink-soft);
}

.closed__logo {
    width: 38%;
    height: auto;
    margin-top: auto;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transform: rotate(-3deg);
}

/* Shadow of the binder on the desk */
.closed::after {
    content: "";
    display: block;
    width: 108%;
    height: 26px;
    margin: 14px 0 0 -2%;
    background: radial-gradient(closest-side, rgba(11, 18, 32, 0.32), transparent);
}

@media (max-width: 860px) {
    .welcome {
        grid-template-columns: minmax(0, 34em);
        justify-items: center;
        padding-top: 16px;
    }

    .closed {
        order: -1;
        --w: min(230px, 54vw);
        margin-bottom: 12px;
    }
}

/* ====================================================================
   Forms and member area: a sheet to fill in.
   ==================================================================== */

.dossier.dossier--form {
    max-width: 580px;
}

.form {
    gap: 0;
}

.field {
    display: grid;
    gap: 0.35em;
    margin-top: 1.3em;
}

.field__label {
    font-family: var(--mono);
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

/* Written on the line, like on a paper form */
.field__input {
    width: 100%;
    padding: 0.55em 0.1em;
    font: inherit;
    font-size: 1.05em;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-bottom: 2px solid color-mix(in srgb, var(--ink) 28%, transparent);
    border-radius: 0;
    transition: border-color 150ms;
}

/* A list or a long text is written in a framed box rather than on a ruled line */
select.field__input,
textarea.field__input {
    padding: 0.6em 0.7em;
    border: 2px solid color-mix(in srgb, var(--ink) 28%, transparent);
    border-radius: var(--radius);
}

textarea.field__input {
    min-height: 9em;
    line-height: 1.5;
    resize: vertical;
}

select.field__input option {
    color: var(--ink);
    background: var(--paper);
}

.field__input:focus-visible {
    outline: none;
    border-bottom-color: var(--primary);
}

.field__hint {
    font-size: 0.8em;
    color: var(--ink-soft);
}

.field__error {
    font-size: 0.82em;
    font-weight: 600;
    color: var(--danger);
}

.field__error:empty {
    display: none;
}

/* The error already states the rule: no need to read it twice */
.field__hint:has(+ .field__error:not(:empty)) {
    display: none;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 0.7em;
    margin-top: 1.4em;
    font-size: 0.92em;
    line-height: 1.4;
    cursor: pointer;
}

.check input {
    flex: none;
    width: 1.15em;
    height: 1.15em;
    margin: 0.12em 0 0;
    accent-color: var(--primary);
}

.check a,
.form__foot a,
.form__link {
    color: var(--primary);
    font-weight: 600;
    text-underline-offset: 0.2em;
}

.form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8em 1.4em;
    margin-top: 1.8em;
}

.form__actions .button {
    border: 0;
    cursor: pointer;
}

.form__link {
    font-size: 0.9em;
}

.form__foot {
    margin-top: 1.8em;
    padding-top: 1.2em;
    font-size: 0.92em;
    color: var(--ink-soft);
    border-top: 1px dashed var(--rule);
}

.notice {
    margin-top: 1.2em;
    padding: 0.8em 1em;
    font-size: 0.92em;
    font-weight: 600;
    border-left: 4px solid var(--tone-c);
    background: color-mix(in srgb, var(--tone-c) 10%, transparent);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.notice--ok    { --tone-c: var(--accent-ink); }
.notice--error { --tone-c: var(--danger); }

/* The sheets of the member area borrow the layout of an app sheet: title and stamp, then the actions at the foot */
.app__identity .sheet__title {
    flex: 1;
}

.member__foot {
    margin-top: 1.6em;
}

.member__foot .button {
    border: 0;
    cursor: pointer;
}

/* On the home of the member area, an app the member uses shows the figure of its week where the page number was */
.toc__page--figure {
    flex: none;
    font-weight: 800;
    white-space: nowrap;
    color: var(--ink);
}

/* ---------- Stats sheets: a few typed figures, then the last days as a strip of bars ---------- */

.figures,
.trend {
    margin: 1.9em 0 0;
}

.figures__title {
    font-family: var(--mono);
    font-size: 0.64em;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.figures__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9em, 1fr));
    gap: 1em 1.6em;
    margin: 0.7em 0 0;
}

/* The number first, its name underneath */
.figure {
    display: flex;
    flex-direction: column-reverse;
}

.figure dt {
    font-size: 0.8em;
    color: var(--ink-soft);
}

.figure dd {
    display: flex;
    align-items: baseline;
    gap: 0.5em;
    margin: 0;
    font-size: 1.9em;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.figure__change {
    font-family: var(--mono);
    font-size: 0.36em;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
}

.figure__change--up {
    color: var(--accent-ink);
}

.trend__bars {
    display: block;
    width: 100%;
    height: 4.2em;
    margin-top: 0.9em;
    border-bottom: 1px solid var(--rule);
}

.trend__bar {
    fill: var(--primary);
}

.trend__bar--empty {
    fill: var(--rule);
}

.trend__days {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5em;
    font-family: var(--mono);
    font-size: 0.64em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

/* A ledger: the series one subject is followed on, a line each (name, curve, latest value, how many entries) */
.ledgers {
    display: grid;
    gap: 1.6em;
    margin-top: 1.9em;
}

.ledger__title {
    display: flex;
    align-items: baseline;
    gap: 0.7em;
    margin: 0;
    padding-bottom: 0.4em;
    font-size: 1.05em;
    font-weight: 800;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--rule);
}

.ledger__note,
.ledger__meta,
.index__meta {
    font-family: var(--mono);
    font-size: 0.64em;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

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

.ledger__line {
    display: grid;
    grid-template-columns: minmax(7em, 1.2fr) minmax(4em, 1fr) minmax(8.5em, auto) minmax(10.5em, auto);
    grid-template-areas: "label curve value meta";
    align-items: center;
    gap: 0 1.3em;
    padding: 0.5em 0;
    border-bottom: 1px dashed var(--rule);
}

.ledger__label {
    grid-area: label;
    font-size: 0.9em;
}

.ledger__curve {
    grid-area: curve;
    display: block;
    width: 100%;
    height: 1.75em;
}

.ledger__curve polyline {
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.ledger__value {
    grid-area: value;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.55em;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ledger__value .figure__change {
    font-size: 0.68em;
}

.ledger__meta {
    grid-area: meta;
    text-align: right;
    white-space: nowrap;
}

/* On a phone a line of a ledger folds in two: name and value, then curve and count */
@media (max-width: 560px) {
    .ledger__line {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "label value"
            "curve meta";
        gap: 0.15em 1em;
    }
}

/* An index: a short list under the figures (themes played, pages filled, messages kept), a line each */
.index {
    margin-top: 1.9em;
}

.index__lines {
    margin: 0.5em 0 0;
    padding: 0;
    list-style: none;
}

.index__line {
    display: flex;
    align-items: baseline;
    gap: 0.15em 1.3em;
    padding: 0.5em 0;
    border-bottom: 1px dashed var(--rule);
}

.index__label {
    flex: 1;
    font-size: 0.9em;
}

.index__value {
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.index__meta {
    text-align: right;
    white-space: nowrap;
}

/* Beside a number the small print keeps one width, so the numbers of an index line up */
.index__value + .index__meta {
    min-width: 16em;
}

/* On a phone a line of an index folds in two: what it is and its number, then the small print */
@media (max-width: 560px) {
    .index__line {
        flex-wrap: wrap;
    }

    .index__meta {
        flex-basis: 100%;
        text-align: left;
    }
}

/* On a phone the figures become the lines of a ledger: the name on the left, the number on the right */
@media (max-width: 560px) {
    .dossier .app__icon {
        width: 3.4em;
        height: 3.4em;
    }

    .dossier .app__name {
        font-size: 1.45em;
    }

    .figures__list {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 0.3em;
    }

    .figure {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 1em;
        padding: 0.55em 0;
        border-bottom: 1px dashed var(--rule);
    }

    .figure dd {
        flex: none;
        flex-direction: row-reverse;
        font-size: 1.3em;
    }

    .figure__change {
        font-size: 0.52em;
    }
}

.topbar__link--strong {
    color: var(--paper);
    background: var(--ink);
    border-color: var(--ink);
}

.topbar__link--strong:hover {
    color: var(--paper);
    background: var(--primary);
    border-color: var(--primary);
}

/* ====================================================================
   Dossier: the long pages around the binder (promo of an app, privacy policy).
   Loose sheets, bound by the same rings, between two cover cards.
   ==================================================================== */

.dossier {
    flex: 1;
    width: 100%;
    max-width: 940px;
    margin: 0 auto;
    padding: 20px 16px 64px 28px;
}

.dossier .sheet {
    scroll-margin-top: 16px;
}

@media (min-width: 760px) {
    .dossier .sheet {
        padding: 2.2em 2.6em 2.4em 3.8em;
    }
}

/* A card in the material of the cover: opens a policy, closes a promo */
.cover-card {
    position: relative;
    margin: 0 0 28px -12px;
    padding: 2.4em 2em 2.2em;
    color: var(--cover-ink);
    background: linear-gradient(160deg, var(--cover), var(--cover-deep));
    border-radius: 14px;
    box-shadow: var(--shadow-lift);
}

.cover-card::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px dashed color-mix(in srgb, var(--cover-ink) 28%, transparent);
    border-radius: 9px;
    pointer-events: none;
}

.cover-card__title {
    margin-top: 0.5em;
    font-size: clamp(1.7em, 4.4vw, 2.5em);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.cover-card__text {
    max-width: 40em;
    margin-top: 0.6em;
    color: var(--cover-ink-soft);
}

.cover-card .app__links {
    position: relative;
    margin-top: 1.5em;
}

.cover-card .button {
    color: #111827;
    background: #FFFFFF;
}

.cover-card .app__links .button + .button {
    color: #FFFFFF;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.7);
}

.cover-card .app__soon {
    color: var(--cover-ink);
}

.cover-card__links {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em 1.6em;
    margin-top: 1.5em;
    font-size: 0.9em;
}

.cover-card__links a {
    color: var(--cover-ink-soft);
    text-underline-offset: 0.25em;
}

.cover-card__links a:hover {
    color: var(--cover-ink);
}

.cover-card__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em 2.6em;
    margin: 1.3em 0 0;
}

.cover-card__facts dt {
    font-family: var(--mono);
    font-size: 0.66em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cover-ink-soft);
}

.cover-card__facts dd {
    margin: 0.1em 0 0;
    font-weight: 700;
}

/* ---------- Promo of an app ---------- */

.promo__name {
    flex: 1;
    font-size: 1.2em;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.promo__title {
    margin-top: 0.7em;
    font-size: clamp(2em, 5.4vw, 3.1em);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

.promo__subtitle {
    max-width: 38em;
    margin-top: 0.6em;
    font-size: 1.12em;
    line-height: 1.45;
    color: var(--ink-soft);
    text-wrap: pretty;
}

/* The idea of the app, as a margin note */
.promo__concept {
    max-width: 44em;
    margin: 1.5em 0;
    padding: 1em 1.2em;
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.promo__concept-title {
    margin-bottom: 0.2em;
    font-weight: 700;
}

.promo__notice {
    margin-top: 0.9em;
    font-size: 0.86em;
    color: var(--ink-soft);
}

/* Every screenshot, as a strip of taped prints to scroll through */
.promo__shots {
    display: flex;
    gap: 1.3em;
    margin: 2.2em -0.4em 0;
    padding: 1.3em 1em 1.6em;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.promo__shots .shot {
    height: 21em;
    margin: 0;
    scroll-snap-align: center;
}

.promo__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5em, 1fr));
    gap: 1em;
    margin-bottom: 2.4em;
    counter-reset: stat;
}

/* Index cards, numbered in the corner */
.promo__stat {
    padding: 1em 1.1em 1.2em;
    font-size: 0.9em;
    line-height: 1.45;
    color: var(--ink-soft);
    background: color-mix(in srgb, var(--primary) 6%, var(--paper));
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    counter-increment: stat;
}

.promo__stat::before {
    content: counter(stat, decimal-leading-zero);
    font-family: var(--mono);
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--primary);
}

.promo__stat-title {
    margin: 0.25em 0 0.2em;
    font-size: 1.16em;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.promo__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17em, 1fr));
    gap: 1.2em;
    margin-top: 1.6em;
}

.promo__card {
    padding: 1.3em 1.4em 1.4em;
    background: color-mix(in srgb, var(--ink) 2%, var(--paper));
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}

.promo__card h3 {
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.promo__card .app__features {
    margin-top: 0.75em;
}

.promo__steps {
    display: grid;
    gap: 0.7em;
    margin-top: 0.9em;
    font-size: 0.9em;
    line-height: 1.4;
    counter-reset: step;
}

.promo__steps li {
    position: relative;
    padding-left: 2.5em;
    counter-increment: step;
}

.promo__steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: -0.15em;
    display: grid;
    place-items: center;
    width: 1.9em;
    height: 1.9em;
    font-family: var(--mono);
    font-size: 0.86em;
    font-weight: 700;
    color: var(--paper);
    background: var(--ink);
    border-radius: 50%;
}

.promo__mid {
    margin-top: 2em;
    padding-top: 1.3em;
    font-weight: 600;
    text-align: center;
    border-top: 1px dashed var(--rule);
}

.promo__audience {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17em, 1fr));
    align-items: center;
    gap: 1.4em 2.6em;
    margin-bottom: 2em;
}

/* ---------- Document: the vocabulary of the privacy policies ---------- */

.tone-info   { --tone-c: var(--primary); }
.tone-ok     { --tone-c: var(--accent-ink); }
.tone-warn   { --tone-c: var(--warn); }
.tone-danger { --tone-c: var(--danger); }

.doc h2 {
    margin-bottom: 0.7em;
    font-size: 1.6em;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.doc h3 {
    margin: 1.2em 0 0.4em;
    font-size: 1.12em;
    font-weight: 700;
}

.doc h4 {
    margin: 0 0 0.4em;
    font-size: 1em;
    font-weight: 700;
}

.doc p {
    margin: 0.55em 0;
    line-height: 1.6;
}

.doc ul,
.doc ol {
    margin: 0.5em 0;
    padding-left: 1.3em;
    line-height: 1.6;
    list-style: revert;
}

.doc li + li {
    margin-top: 0.25em;
}

.doc a:not(.button) {
    color: var(--primary);
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
}

.doc code {
    padding: 0.1em 0.35em;
    font-family: var(--mono);
    font-size: 0.88em;
    background: color-mix(in srgb, var(--ink) 7%, transparent);
    border-radius: 4px;
}

.doc .doc-plain {
    padding-left: 0;
    list-style: none;
}

.doc-lead {
    font-size: 1.08em;
}

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

.doc-center {
    text-align: center;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
    gap: 1em;
    margin: 1em 0;
}

.doc-grid > * > :first-child,
.doc-card__body > :first-child,
.doc-note > :first-child {
    margin-top: 0;
}

.doc-grid > * > :last-child,
.doc-card__body > :last-child,
.doc-note > :last-child {
    margin-bottom: 0;
}

.doc-card {
    margin: 1em 0;
    overflow: hidden;
    background: color-mix(in srgb, var(--ink) 2%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--tone-c, var(--ink)) 28%, transparent);
    border-radius: var(--radius);
}

.doc-grid .doc-card {
    margin: 0;
}

.doc-card__head {
    padding: 0.7em 1.1em;
    background: color-mix(in srgb, var(--tone-c, var(--ink)) 11%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--tone-c, var(--ink)) 22%, transparent);
}

.doc-card__head > * {
    margin: 0;
}

.doc-card__body {
    padding: 0.95em 1.1em;
}

.doc-note {
    margin: 1em 0;
    padding: 0.9em 1.1em;
    background: color-mix(in srgb, var(--tone-c, var(--ink-soft)) 9%, transparent);
    border-left: 4px solid var(--tone-c, var(--ink-soft));
    border-radius: 0 var(--radius) var(--radius) 0;
}

.doc-table-wrap {
    margin: 1em 0;
    overflow-x: auto;
}

.doc-table {
    width: 100%;
    font-size: 0.9em;
    border-collapse: collapse;
}

.doc-table th,
.doc-table td {
    padding: 0.55em 0.7em;
    text-align: left;
    vertical-align: top;
    border: 1px solid var(--rule);
}

.doc-table th {
    font-weight: 700;
    background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.doc-table tr[class^="tone-"] {
    background: color-mix(in srgb, var(--tone-c) 8%, transparent);
}

.doc-rule {
    margin-top: 2em;
    padding-top: 1.4em;
    border-top: 1px solid var(--rule);
}

.doc .button {
    margin: 0.3em 0.4em 0 0;
}

/* Contents of the policy */
.doc-toc ol {
    margin: 0;
    columns: 2 15em;
    column-gap: 2.4em;
    font-weight: 600;
}

/* ====================================================================
   Open binder: two pages side by side, leaves turning around the rings.
   Needs room and script; otherwise the stacked layout above applies.
   ==================================================================== */

@media (min-width: 1024px) and (min-height: 640px) and (scripting: enabled) {
    html {
        scroll-padding-top: 0;
    }

    .tabbar {
        display: none;
    }

    .topbar {
        padding: 14px 28px 0;
    }

    .binder {
        /* --u is one hundredth of a page width: every size below scales with the binder */
        --page-h-max: clamp(520px, calc(100vh - 168px), 900px);
        --page-w: min(calc(var(--page-h-max) * 0.715), calc((100vw - 170px) / 2));
        --page-h: calc(var(--page-w) / 0.715);
        --u: calc(var(--page-w) / 100);
        --gutter: calc(var(--u) * 8);
        --rim-x: calc(var(--u) * 5.6);
        --rim-y: calc(var(--u) * 2.8);

        position: relative;
        flex: none;
        width: calc(var(--page-w) * 2 + var(--gutter) + var(--rim-x) * 2);
        max-width: none;
        height: calc(var(--page-h) + var(--rim-y) * 2);
        margin: auto;
        padding: 0;
    }

    .binder__board,
    .binder__stack,
    .mech,
    .turn,
    .panel--back,
    .panel__hint,
    .tab {
        display: block;
    }

    .controls {
        display: flex;
    }

    /* Cover boards and spine */
    .binder__board {
        position: absolute;
        inset: 0;
        background:
            linear-gradient(90deg,
                transparent calc(50% - var(--u) * 7.5),
                rgba(0, 0, 0, 0.28) calc(50% - var(--u) * 7.2),
                rgba(0, 0, 0, 0.1) calc(50% - var(--u) * 6.4),
                rgba(0, 0, 0, 0.16) 50%,
                rgba(0, 0, 0, 0.1) calc(50% + var(--u) * 6.4),
                rgba(0, 0, 0, 0.28) calc(50% + var(--u) * 7.2),
                transparent calc(50% + var(--u) * 7.5)),
            linear-gradient(160deg, var(--cover), var(--cover-deep));
        border-radius: calc(var(--u) * 2.4);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.16),
            inset 0 0 0 1px rgba(0, 0, 0, 0.25),
            0 calc(var(--u) * 5) calc(var(--u) * 10) rgba(11, 18, 32, 0.32),
            0 calc(var(--u) * 1) calc(var(--u) * 2.4) rgba(11, 18, 32, 0.25);
    }

    /* Fine grain of the cover material */
    .binder__board::after {
        content: "";
        position: absolute;
        inset: 0;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
        border-radius: inherit;
        mix-blend-mode: overlay;
        opacity: 0.5;
    }

    /* Stitching along the edge of the cover */
    .binder__board::before {
        content: "";
        position: absolute;
        inset: calc(var(--u) * 1.1);
        border: 1px dashed color-mix(in srgb, var(--cover-ink) 26%, transparent);
        border-radius: calc(var(--u) * 1.6);
    }

    .binder__well {
        position: absolute;
        inset: var(--rim-y) var(--rim-x);
    }

    /* Inside covers */
    .panel {
        position: absolute;
        top: 0;
        width: var(--page-w);
        height: var(--page-h);
        font-size: calc(var(--u) * 3.05);
        color: var(--cover-ink);
    }

    .panel--front {
        left: 0;
        margin: 0;
        padding: 4.2em 2.4em 0 3em;
        overflow: hidden;
        background: none;
        border-radius: 0;
        box-shadow: none;
    }

    .panel--front::before {
        content: none;
    }

    .panel__title {
        font-size: 4.6em;
    }

    .panel__hint {
        position: absolute;
        left: 3em;
        right: 2.4em;
        bottom: 2.2em;
        font-family: var(--mono);
        font-size: 0.64em;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--cover-ink-soft);
        z-index: 1;
    }

    .pocket {
        position: absolute;
        inset: auto 0 0 0;
        height: 46%;
        margin: 0;
        padding: 0 0 0 3em;
    }

    .pocket::after {
        inset: 38% 0 0;
    }

    .card {
        font-size: 1.08em;
    }

    .panel--back {
        right: 0;
        display: grid;
        place-items: center;
    }

    .panel__note {
        font-family: var(--mono);
        font-size: 0.7em;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: var(--cover-ink-soft);
    }

    /* Edges of the sheets waiting on each side */
    .binder__stack {
        position: absolute;
        top: calc(var(--u) * 0.5);
        height: var(--page-h);
        width: calc(var(--count, 0) * var(--u) * 0.34);
        background: repeating-linear-gradient(90deg, var(--paper) 0 calc(var(--u) * 0.2), var(--paper-edge) calc(var(--u) * 0.2) calc(var(--u) * 0.34));
        box-shadow: 0 calc(var(--u) * 1) calc(var(--u) * 2) rgba(11, 18, 32, 0.3);
        transition: width var(--flip) var(--ease);
    }

    .binder__stack--left {
        right: calc(50% + var(--gutter) / 2 + var(--page-w));
        border-radius: 2px 0 0 2px;
    }

    .binder__stack--right {
        left: calc(50% + var(--gutter) / 2 + var(--page-w));
        border-radius: 0 2px 2px 0;
    }

    /* Leaves */
    .binder__leaves {
        position: absolute;
        inset: 0;
        perspective: calc(var(--u) * 520);
        perspective-origin: 50% 35%;
    }

    .leaf {
        --i: 0;
        display: block;
        position: absolute;
        top: 0;
        left: calc(50% + var(--gutter) / 2);
        width: var(--page-w);
        height: var(--page-h);
        z-index: calc(100 - var(--i));
        transform-origin: calc(var(--gutter) / -2) 50%;
        transform-style: preserve-3d;
        pointer-events: none;
    }

    .leaf.is-flipped {
        z-index: calc(var(--i) + 1);
        transform: rotateY(-180deg);
    }

    .leaf:nth-child(2)  { --i: 1; }
    .leaf:nth-child(3)  { --i: 2; }
    .leaf:nth-child(4)  { --i: 3; }
    .leaf:nth-child(5)  { --i: 4; }
    .leaf:nth-child(6)  { --i: 5; }
    .leaf:nth-child(7)  { --i: 6; }
    .leaf:nth-child(8)  { --i: 7; }
    .leaf:nth-child(9)  { --i: 8; }
    .leaf:nth-child(10) { --i: 9; }
    .leaf:nth-child(11) { --i: 10; }
    .leaf:nth-child(12) { --i: 11; }
    .leaf:nth-child(13) { --i: 12; }
    .leaf:nth-child(14) { --i: 13; }
    .leaf:nth-child(15) { --i: 14; }
    .leaf:nth-child(16) { --i: 15; }

    /* The leaf swaps stacks halfway through its turn, when it stands edge-on */
    .is-ready .leaf {
        transition:
            transform var(--flip) var(--ease) var(--delay, 0ms),
            z-index 0s linear calc(var(--delay, 0ms) + var(--flip) / 2);
    }

    .binder .sheet {
        position: absolute;
        inset: 0;
        margin: 0;
        padding: 1.55em 1.7em 2.5em 3.1em;
        font-size: calc(var(--u) * 3.05);
        overflow: hidden;
        border-radius: calc(var(--u) * 0.5);
        box-shadow: none;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        pointer-events: auto;
    }

    .binder .sheet--back {
        padding: 1.55em 3.1em 2.5em 1.7em;
        background-position: right top, 0 0;
        background-image:
            var(--holes),
            linear-gradient(270deg, color-mix(in srgb, var(--ink) 9%, transparent), transparent 14%);
        transform: rotateY(180deg);
    }

    .binder .sheet::before {
        content: none;
    }

    /* Shadow sweeping the sheet while it turns */
    .binder .sheet::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg, rgba(8, 12, 22, 0.5), rgba(8, 12, 22, 0.08));
        opacity: 0;
        pointer-events: none;
    }

    .binder .sheet--back::after {
        background: linear-gradient(270deg, rgba(8, 12, 22, 0.5), rgba(8, 12, 22, 0.08));
    }

    .is-ready .leaf .sheet::after {
        animation: turn-shade-back var(--flip) var(--ease) var(--delay, 0ms);
    }

    .is-ready .leaf.is-flipped .sheet::after {
        animation-name: turn-shade;
    }

    .binder .sheet__folio {
        display: block;
    }

    .binder .sheet--back .sheet__folio {
        right: auto;
        left: 1.4em;
    }

    .binder .app__shots {
        flex: 1;
        min-height: 0;
    }

    .binder .shot {
        height: min(100%, 58cqw);
    }

    /* Index tabs */
    .tab {
        position: absolute;
        left: calc(100% - 1px);
        top: calc(6% + var(--slot, 0) * 17%);
        width: calc(var(--u) * 4.4);
        height: 15%;
        display: grid;
        place-items: center;
        writing-mode: vertical-rl;
        font-size: calc(var(--u) * 1.7);
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        text-decoration: none;
        white-space: nowrap;
        color: var(--paper);
        background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 82%, #000000), var(--tone) 30%);
        border-radius: 0 calc(var(--u) * 1.2) calc(var(--u) * 1.2) 0;
        box-shadow: calc(var(--u) * 0.3) calc(var(--u) * 0.4) calc(var(--u) * 1) rgba(11, 18, 32, 0.28);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        pointer-events: auto;
        transition: width 180ms var(--ease);
    }

    .tab:hover {
        width: calc(var(--u) * 5.4);
    }

    /* Seen once the leaf is turned: mirrored so that it reads, and still sticks out of the outer edge */
    .tab--back {
        background: linear-gradient(270deg, color-mix(in srgb, var(--tone) 82%, #000000), var(--tone) 30%);
        border-radius: calc(var(--u) * 1.2) 0 0 calc(var(--u) * 1.2);
        transform: rotateY(180deg);
    }

    .tab--slot1 { --slot: 1; }
    .tab--slot2 { --slot: 2; }
    .tab--slot3 { --slot: 3; }

    /* Ring mechanism */
    .mech {
        position: absolute;
        inset: 0;
        z-index: 200;
        pointer-events: none;
    }

    .mech__defs {
        position: absolute;
    }

    .mech__bar {
        position: absolute;
        top: 3.5%;
        bottom: 3.5%;
        left: 50%;
        width: calc(var(--u) * 4.2);
        margin-left: calc(var(--u) * -2.1);
        background: linear-gradient(90deg, var(--metal-edge), var(--metal-lo) 10%, var(--metal-hi) 34%, var(--metal-mid) 58%, var(--metal-lo) 88%, var(--metal-edge));
        border-radius: calc(var(--u) * 2.1);
        box-shadow: 0 calc(var(--u) * 0.6) calc(var(--u) * 1.4) rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    }

    /* Rivets at both ends of the bar */
    .mech__bar::before,
    .mech__bar::after {
        content: "";
        position: absolute;
        left: 50%;
        width: calc(var(--u) * 1.7);
        height: calc(var(--u) * 1.7);
        margin-left: calc(var(--u) * -0.85);
        background: radial-gradient(circle at 35% 30%, var(--metal-hi), var(--metal-lo) 70%, var(--metal-edge));
        border-radius: 50%;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    }

    .mech__bar::before { top: calc(var(--u) * 1.6); }
    .mech__bar::after { bottom: calc(var(--u) * 1.6); }

    /* Each ring runs from a hole of the left page to its twin on the right page */
    .ring {
        position: absolute;
        left: 50%;
        width: calc(var(--u) * 17.38);
        aspect-ratio: 150 / 84;
        overflow: visible;
        /* 66 / 84: the ends of the ring sit on the line of the holes */
        transform: translate(-50%, -78.571%);
    }

    .ring--1 { top: 12.5%; }
    .ring--2 { top: 37.5%; }
    .ring--3 { top: 62.5%; }
    .ring--4 { top: 87.5%; }

    .ring path {
        fill: none;
        stroke-linecap: round;
    }

    .ring__shadow {
        stroke: rgba(8, 12, 22, 0.4);
        stroke-width: 10.5;
    }

    .ring__mount {
        fill: var(--metal-lo);
        stroke: var(--metal-edge);
        stroke-width: 1;
    }

    .ring__edge {
        stroke: var(--metal-edge);
        stroke-width: 13;
    }

    .ring__tube {
        stroke-width: 10.5;
    }

    .ring__shine {
        stroke: #FFFFFF;
        stroke-width: 2;
        opacity: 0.85;
    }

    .metal--hi  { stop-color: var(--metal-hi); }
    .metal--mid { stop-color: var(--metal-mid); }
    .metal--lo  { stop-color: var(--metal-lo); }

    /* Page edges: click to turn, hover to lift the corner */
    .turn {
        position: absolute;
        top: 0;
        z-index: 150;
        width: calc(var(--u) * 7);
        height: var(--page-h);
        padding: 0;
        background: none;
        border: 0;
        cursor: pointer;
    }

    .turn--prev { left: 0; }
    .turn--next { right: 0; }

    .turn:disabled {
        display: none;
    }

    .is-ready .binder__well:has(.turn--next:hover) .leaf:nth-child(1 of :not(.is-flipped)) {
        transform: rotateY(-12deg);
        transition-duration: 420ms, 0s;
    }

    .is-ready .binder__well:has(.turn--prev:hover) .leaf:nth-last-child(1 of .is-flipped) {
        transform: rotateY(-168deg);
        transition-duration: 420ms, 0s;
    }

    /* Page controls under the binder */
    .controls {
        align-items: center;
        justify-content: center;
        gap: 18px;
        padding: 14px 24px 18px;
    }

    .controls__turn {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        color: var(--ink);
        background: var(--paper);
        border: 1px solid var(--rule);
        border-radius: 50%;
        box-shadow: var(--shadow-card);
        cursor: pointer;
        transition: color 150ms, transform 150ms, opacity 150ms;
    }

    .controls__turn:hover {
        color: var(--primary);
        transform: scale(1.08);
    }

    .controls__turn:disabled {
        opacity: 0.35;
        cursor: default;
        transform: none;
    }

    .controls__home {
        font-size: 14px;
        font-weight: 600;
        color: var(--ink-soft);
        text-underline-offset: 4px;
    }

    .controls__home:hover {
        color: var(--primary);
    }

    .controls__folio {
        min-width: 116px;
        font-family: var(--mono);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-align: center;
        color: var(--ink);
    }

    .controls__total {
        color: var(--ink-soft);
    }
}

@keyframes turn-shade {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes turn-shade-back {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --flip: 1ms;
    }

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}
