/* The legal pages of Spirit Flow (privacy, terms, delete-account) as a hanging parchment SCROLL over the blurred home
   (9Winter 2026-10-06: the frame of concept A, the lettering of concept C).
   Frame: a top and a bottom wooden roller (scroll_top / scroll_bottom, they stay in view on a tall enough screen),
   the paper between them (scroll_mid, tiled), the wax seal that closes, a Spirit looking over the roller.
   Lettering: Sriracha (brush hand) for headings, Itim (a print hand) for the text, both Latin + Vietnamese subsets
   (legal/fonts, SIL OFL, licences beside them). Pictures and their numbers: tools/legal_scroll_art.py.
   Every length of the frame is a fraction of its width --w (1u = 1 percent of it), so the pieces always meet. */
@font-face {
    font-family: "Sriracha";
    src: url(fonts/Sriracha-Regular.woff2) format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Itim";
    src: url(fonts/Itim-Regular.woff2) format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
:root {
    --w: min(1000px, 106vw);
    --u: calc(var(--w) / 100);
    --ink: #38230f;
    --ink-soft: #5b4026;
    --navy: #1b2b5e;
    --link: #1c3c8c;
    --rule: #9a6b2c;
    --wash: rgba(205, 152, 84, 0.34);
    --paper: #f8e3b6;
    --night: #1a1410;
    --hand: "Itim", "Segoe Print", "Bradley Hand", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
    --brush: "Sriracha", "Itim", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    /* numbers of the pictures, in u (tools/legal_scroll_art.py prints them as fractions of the width) */
    --head: 3.2;               /* room above the top cap for the Spirit looking over the roller */
    --top-h: 20.17;
    --top-roller-top: 4.36;
    --top-roller-mid: 7;
    --top-clear: 11.6;         /* below this the top cap is open in the middle */
    --bottom-h: 17.17;
    --bottom-roller-top: 10.03;
    --bottom-roller-mid: 12.6;
    --bottom-roller-end: 15.23;
}
@media (max-width: 360px) { :root { --w: 112vw; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--u) * (var(--top-clear) - var(--top-roller-top)) + 14px); }
body {
    margin: 0;
    padding: clamp(6px, 2vh, 28px) 0 clamp(10px, 3vh, 36px);
    overflow-x: hidden;
    color: var(--ink);
    font: 400 1.125rem/1.6 var(--hand);
    background: var(--night);
}
/* the home page, blurred, behind everything (one small picture, already blurred and dimmed) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #2a1d14 url(home_wide.webp) center / cover no-repeat;
}
@media (max-aspect-ratio: 4/5) { body::before { background-image: url(home_tall.webp); } }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.16em; }
a:hover { color: #0f2466; }
a:focus-visible, summary:focus-visible { outline: 3px solid #1c3c8c; outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999rem; top: 0; background: var(--paper); color: var(--ink); padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- the frame ---------- */
/* the frame is a little wider than a narrow screen (the roller ends run off both sides): .scroll-view cuts what is outside,
   without becoming a scrolling box (the rollers must stay sticky to the page) */
@supports (overflow: clip) {
    body { overflow-x: visible; }
    .scroll-view { overflow-x: clip; }
}
.scroll { position: relative; width: var(--w); margin: 0 0 0 calc(50% - var(--w) / 2); }
.scroll-top, .scroll-bottom { position: relative; z-index: 3; pointer-events: none; filter: drop-shadow(0 calc(var(--u) * 0.7) calc(var(--u) * 0.9) rgba(10, 5, 0, 0.5)); }
.scroll-top {
    height: calc(var(--u) * (var(--head) + var(--top-h)));
    margin-bottom: calc(var(--u) * (var(--top-roller-mid) - var(--top-h)));
    background: url(scroll_top.webp) center bottom / 100% auto no-repeat;
}
.scroll-bottom {
    height: calc(var(--u) * var(--bottom-h));
    margin-top: calc(var(--u) * -1 * var(--bottom-roller-mid));
    background: url(scroll_bottom.webp) center top / 100% auto no-repeat;
}
@media (min-height: 560px) {
    /* the rollers stay in view: each stops with its outer edge just past the edge of the screen, so the paper is never seen beyond a roller */
    .scroll-top { position: sticky; top: calc(var(--u) * -1 * (var(--head) + var(--top-roller-top) + 0.3)); }
    .scroll-bottom { position: sticky; bottom: calc(var(--u) * -1 * (var(--bottom-h) - var(--bottom-roller-end) + 0.5)); }
}
/* the Spirit looking over the top roller (it belongs to the page, not to the roller: it is left behind when the roller stays) */
.scroll > .peek {
    position: absolute;
    z-index: 4;
    left: 21%;
    top: calc(var(--u) * (var(--head) + 5.3 - 7.5));
    width: 11.5%;
    aspect-ratio: 220 / 143;
    pointer-events: none;
    background: url(spirit_peek.webp) center / contain no-repeat;
}
/* the wax seal: Close */
.scroll-top .seal {
    position: absolute;
    right: 9.5%;
    top: calc(var(--u) * (var(--head) + var(--top-roller-mid) + 1.5));
    width: max(13%, 62px);
    aspect-ratio: 184 / 144;
    min-height: 44px;
    transform: translateY(-50%);
    pointer-events: auto;
    background: url(seal.webp) center / contain no-repeat;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
}
.scroll-top .seal:hover, .scroll-top .seal:active { background-image: url(seal_down.webp); }
.scroll-top .seal:active { transform: translateY(-50%) scale(0.96); }
.scroll-top .seal span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the paper: tiled between the rollers, a soft shadow on the room behind it */
.scroll-paper {
    position: relative;
    z-index: 1;
    /* the sides keep the words clear of the leaves on the bottom roller (they reach 18.7u in from each side, the roller stays in view); the foot
       keeps the last line below the top of those leaves (11.1u above the end of the paper) */
    padding: calc(var(--u) * (var(--top-clear) - var(--top-roller-mid) + 3.2)) calc(var(--u) * 19.4) calc(var(--u) * 12.6);
}
.scroll-paper::before, .scroll-paper::after { content: ""; position: absolute; top: 0; bottom: 0; }
.scroll-paper::before { z-index: -2; left: 10.5%; right: 10.5%; box-shadow: 0 0 calc(var(--u) * 4.5) calc(var(--u) * 0.6) rgba(8, 4, 0, 0.6); }
.scroll-paper::after { z-index: -1; left: 0; right: 0; background: url(scroll_mid.webp) center top / 100% auto repeat-y; }

/* ---------- the words ---------- */
main.legal { position: relative; }
/* language and sibling-page links, as small paper tags */
.legal nav.lang { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 0 0 1.4rem; padding-right: 0; font-size: 0.95em; }
.legal nav.lang a {
    color: var(--ink);
    text-decoration: none;
    padding: 5px 14px 4px;
    border: 1.5px solid var(--rule);
    border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
    background: rgba(255, 249, 230, 0.55);
}
.legal nav.lang a:hover { background: rgba(255, 252, 240, 0.9); border-color: var(--navy); color: var(--navy); }

.legal section.doc + section.doc { margin-top: 3.4rem; padding-top: calc(clamp(96px, var(--u) * 15, 150px) + 1rem); background: url(bunch_top.webp) center top / clamp(110px, calc(var(--u) * 17), 170px) auto no-repeat; }

.legal h1 {
    margin: 0 0 1.3rem;
    font: 400 clamp(1.9rem, calc(var(--u) * 5.4), 3.25rem)/1.15 var(--brush);
    color: var(--navy);
    text-align: center;
    text-wrap: balance;
    -webkit-text-stroke: 0.024em currentColor;      /* the brush a little fuller, as in the concept's title */
}
.legal h1::after {
    content: "";
    display: block;
    width: min(84%, 430px);
    aspect-ratio: 480 / 73;
    margin: 0.12em auto 0;
    background: url(underline.webp) center / contain no-repeat;
}
.legal h2 {
    position: relative;
    margin: 4.3rem 0 0.6rem;
    padding: 0.22em 0.5em 0.2em 1.75em;
    font: 400 1.56rem/1.3 var(--brush);
    color: var(--navy);
    -webkit-text-stroke: 0.016em currentColor;
    /* the leaf, and a dry brush of wash under the words */
    background:
        url(leaf.webp) 0.1em 0.2em / 1.35em auto no-repeat,
        linear-gradient(90deg, var(--wash), var(--wash) min(60%, 15em), transparent min(100%, 27em)) 0.9em 0 / 100% 100% no-repeat;
    border-radius: 255px 20px 225px 20px / 20px 225px 20px 255px;
}
/* the small ink rule between two sections */
.legal h2::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -2.35rem;
    width: min(60%, 260px);
    aspect-ratio: 300 / 40;
    transform: translate(-50%, -50%);
    background: url(divider.webp) center / contain no-repeat;
}
.legal h2:first-of-type { margin-top: 2rem; }
.legal h2:first-of-type::before { content: none; }
.legal h3 { font: 400 1.22rem/1.35 var(--brush); color: var(--navy); margin: 1.4rem 0 0.3rem; }
.legal p, .legal ul, .legal ol { margin: 0.7rem 0; }
.legal ul, .legal ol { padding-left: 1.4rem; }
.legal li { margin: 0.3rem 0; }
.legal ul > li::marker { color: #a2581b; }
.legal .muted, .muted { color: var(--ink-soft); font-size: 0.95em; }
.legal a { overflow-wrap: anywhere; }
.legal code { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 0.82em; padding: 1px 5px; border-radius: 4px; background: rgba(190, 140, 70, 0.25); overflow-wrap: anywhere; }
.legal strong { color: #26150a; font-weight: 400; -webkit-text-stroke: 0.035em currentColor; }

/* contents: a hand-ruled box (it folds, and needs no script) */
.legal details.toc {
    margin: 0 0 1.5rem;
    padding: 0.6rem 1.1rem 0.8rem;
    border: 2px solid var(--rule);
    border-radius: 14px 255px 16px 225px / 225px 16px 255px 14px;
    background: rgba(255, 249, 230, 0.4);
    box-shadow: inset 0 0 0 4px rgba(255, 249, 230, 0.5), inset 0 0 0 5px rgba(154, 107, 44, 0.35);
}
.legal details.toc summary { cursor: pointer; font: 400 1.3rem/1.4 var(--brush); color: var(--navy); padding: 2px 0; }
.legal details.toc ol { list-style: none; margin: 0.35rem 0 0; padding: 0; columns: 2 15rem; column-gap: 1.8rem; font-size: 0.97em; }
.legal details.toc li { margin: 0; padding: 0.16rem 0; break-inside: avoid; }
.legal details.toc a { color: var(--ink); text-decoration-color: rgba(154, 107, 44, 0.7); }
.legal details.toc a:hover { color: var(--navy); }

/* tables, ruled by hand; they scroll sideways inside the paper on a narrow screen */
.legal table { display: block; overflow-x: auto; width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.94em; line-height: 1.5; }
.legal th, .legal td { min-width: 9.2rem; padding: 0.45rem 0.65rem; text-align: left; vertical-align: top; border: 1.5px solid rgba(138, 94, 38, 0.8); }
.legal th { font: 400 1.08em/1.35 var(--brush); color: var(--navy); background: var(--wash); border-bottom-width: 2.5px; }
.legal tr:nth-child(odd) td { background: rgba(255, 249, 230, 0.35); }

/* ---------- the foot of the scroll: the site's links, two corners of leaves and Spirits ---------- */
.scroll-footer { position: relative; margin-top: 3rem; padding: 1.2rem 0 calc(clamp(64px, var(--u) * 13, 132px) * 0.62); text-align: center; border-top: 2px solid rgba(154, 107, 44, 0.55); }
.scroll-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 1.15rem; }
.scroll-footer nav a { padding: 0.5rem 0.1rem; color: var(--ink); }
.scroll-footer nav a[aria-current="page"] { color: var(--navy); text-decoration-thickness: 0.14em; }
.scroll-footer p { margin: 0.5rem 0 0; font-size: 0.92em; color: var(--ink-soft); }
.scroll-footer::before, .scroll-footer::after {
    content: "";
    position: absolute;
    bottom: calc(var(--u) * -1.6);
    width: clamp(64px, calc(var(--u) * 13), 132px);
    aspect-ratio: 248 / 212;
    pointer-events: none;
    background: url(bunch_green.webp) center / contain no-repeat;
}
.scroll-footer::before { left: calc(var(--u) * -3.4); }
.scroll-footer::after { right: calc(var(--u) * -3.4); background-image: url(bunch_blue.webp); }

@media (max-width: 600px) {
    body { font-size: 1rem; padding-top: 4px; }
    /* on a phone only the top roller stays in view; the bottom one waits at the end of the document and costs no reading height */
    .scroll-bottom { position: relative; bottom: auto; }
    .scroll-paper { padding-left: calc(var(--u) * 14.6); padding-right: calc(var(--u) * 14.6); }
    .legal h2 { font-size: 1.28rem; margin-top: 3.9rem; }
    .legal nav.lang { gap: 6px 7px; margin-bottom: 1.1rem; font-size: 0.86em; }
    .legal nav.lang a { padding: 5px 10px 4px; }
    .legal details.toc { padding: 0.5rem 0.8rem 0.7rem; }
    /* a table becomes a list of small ruled cards: nothing scrolls sideways */
    .legal table, .legal tbody, .legal tr, .legal td { display: block; overflow: visible; }
    .legal th, .legal td { min-width: 0; border: 0; padding: 0; }
    .legal tr { margin: 0 0 0.7rem; padding: 0.5rem 0.7rem 0.55rem; border: 1.5px solid rgba(138, 94, 38, 0.8); border-radius: 12px 225px 14px 255px / 255px 14px 225px 12px; background: rgba(255, 249, 230, 0.35); }
    .legal tr:nth-child(odd) td { background: none; }
    .legal tr:first-child { padding: 0.3rem 0.7rem; background: var(--wash); }
    .legal th { display: inline; background: none; font-size: 1.02em; }
    .legal th + th::before { content: "\00a0\00b7 "; color: var(--rule); }
    .legal td:first-child { font: 400 1.12em/1.35 var(--brush); color: var(--navy); margin-bottom: 0.2rem; }
    .legal td + td + td { margin-top: 0.35rem; padding-left: 0.7rem; border-left: 2.5px solid rgba(154, 107, 44, 0.6); color: var(--ink-soft); }
}

@media print {
    body { background: #fff; color: #000; font: 11pt/1.45 Georgia, "Times New Roman", serif; padding: 0; overflow: visible; }
    body::before, .skip, .scroll-top, .scroll-bottom, .scroll-paper::before, .scroll-paper::after, .scroll-footer nav, .scroll-footer::before, .scroll-footer::after,
    .legal nav.lang, .legal details.toc, .legal h1::after, .legal h2::before { display: none; }
    .scroll { width: auto; margin: 0; }
    .scroll-paper { padding: 0; }
    .legal h1, .legal h2, .legal h3, .legal th { font-family: Georgia, "Times New Roman", serif; font-weight: 700; color: #000; -webkit-text-stroke: 0; }
    .legal h1 { font-size: 20pt; text-align: left; border-bottom: 2pt solid #000; padding-bottom: 4pt; }
    .legal h2 { font-size: 13pt; margin: 16pt 0 4pt; padding: 0; background: none; border-radius: 0; break-after: avoid; }
    .legal strong { font-weight: 700; -webkit-text-stroke: 0; color: #000; }
    .legal th { background: #eee; }
    .legal table { display: table; overflow: visible; }
    .legal th, .legal td { min-width: 0; border: 1pt solid #000; }
    .legal tr:nth-child(odd) td, .legal code { background: none; }
    .legal a, .legal .muted, .muted, .scroll-footer p { color: #000; }
    .legal section.doc + section.doc { break-before: page; margin-top: 0; padding-top: 0; background: none; }
    .scroll-footer { border: 0; padding: 12pt 0 0; margin: 0; text-align: left; }
    tr, li { break-inside: avoid; }
}
