/* UpSink site. Tokens from projects/upsink/DESIGN.md ("Dusk Field Plates"): Material roles
   light + dark (surface, onSurface, onSurfaceVariant, primary, surfaceContainer, outline), the
   scene colours skyTop/skyHorizon for the hero sky and waterTop/waterMid/waterDeep/surfaceSheen
   for the water bands. Alegreya (display, variable wght 400-900, lining figures) over Alegreya Sans
   (body 400/700). Firefly yellow is the player's action layer in the app and is not used here. */

@font-face {
    font-family: "Alegreya";
    src: url("/upsink/fonts/alegreya-var.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Alegreya Sans";
    src: url("/upsink/fonts/alegreya-sans-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Alegreya Sans";
    src: url("/upsink/fonts/alegreya-sans-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;
    --bg: #F4EDF2;            /* surface */
    --ink: #1E1B26;           /* onSurface */
    --muted: #4C4656;         /* onSurfaceVariant */
    --link: #0D5D5A;          /* primary */
    --on-link: #FFFFFF;       /* onPrimary */
    --card: #E9DFE8;          /* surfaceContainer */
    --chip: #E3D8E2;          /* surfaceContainerHigh */
    --outline: #776F82;       /* outline */
    --rim: #5A2D51;           /* rimLine */
    --sky-top: #CBB8DB;
    --sky-horizon: #F0C3A6;
    --water-top: #1E6F6A;
    --water-mid: #17605F;
    --water-deep: #0D4248;
    --sheen: #D8F2EB;
    --floater: #E8D49B;       /* tier1-fill, paper creatures are the same in both themes */
    --sinker: #5E5768;        /* tier2-fill */
    --keyline: #1E1B26;       /* floaterInk */
    --moon: #F4EEE4;          /* moonEdge */
    --display: "Alegreya", Georgia, serif;
    --body: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #13121C;
        --ink: #ECE4EE;
        --muted: #C9C0CE;
        --link: #7FD6CC;
        --on-link: #003733;
        --card: #201F2B;
        --chip: #2A2936;
        --outline: #948C9C;
        --rim: #E7A9C8;
        --sky-top: #15132A;
        --sky-horizon: #3A2846;
        --water-top: #22766F;
        --water-mid: #135052;
        --water-deep: #082C32;
        --sheen: #9FE3D8;
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 1.0625rem/1.6 var(--body);
    overflow-wrap: anywhere;
}

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

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--display); font-variant-numeric: lining-nums; line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-weight: 800; font-size: clamp(2.1rem, 6vw, 3.4rem); }
h2 { font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.1rem); }
h3 { font-weight: 700; font-size: 1.3rem; margin: 0 0 0.3em; }
p { margin: 0 0 1em; }

.wrap { max-width: 70rem; margin: 0 auto; padding: 0 1rem; }

.skip-link {
    position: absolute; left: 1rem; top: -4rem;
    background: var(--link); color: var(--on-link);
    padding: 0.75rem 1rem; border-radius: 12px; z-index: 10;
}
.skip-link:focus { top: 1rem; }
.skip-link:focus-visible { outline-color: var(--ink); }

/* Header */
.topbar .wrap {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.25rem 1.5rem; padding-block: 0.5rem;
}
.brand {
    display: flex; align-items: center; gap: 0.6rem; min-height: 48px;
    color: var(--ink); text-decoration: none;
}
.brand img { border-radius: 12px; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 1.6rem; line-height: 1.1; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0 0.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 0.75rem;
    color: var(--ink); font-weight: 700; text-decoration: none; border-radius: 12px;
}
.site-nav a:hover { background: var(--chip); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }

/* Sections */
main { display: block; }
.section { padding: 2.5rem 0; }
.section + .section { border-top: 1px solid var(--outline); }
.section.water-section, .section.water-section + .section, .section.closing { border-top: 0; }
.answer { font-size: 1.15rem; max-width: 42rem; }
.detail, .prose p, .prose ul { max-width: 42rem; }

/* Hero: the dusk sky over a waterline (skyTop -> skyHorizon, ink onSurface) */
.hero {
    background: linear-gradient(180deg, var(--sky-top), var(--sky-horizon));
    color: var(--ink);
    padding-top: 2rem;
}
.hero a:not(.play-badge) { color: var(--ink); }
.hero-grid { display: grid; gap: 2rem; align-items: center; padding-bottom: 2rem; }
@media (min-width: 56rem) { .hero-grid { grid-template-columns: 1fr 22rem; } }
.hero-grid > * { min-width: 0; }
.hero-inner .wrap { padding-bottom: 1.5rem; }
.kicker { font-weight: 700; margin-bottom: 0.5rem; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.5rem; }
.cta-note { margin: 0; font-weight: 700; }
.play-badge { display: inline-block; min-height: 48px; border-radius: 8px; }
.play-badge img { width: 188px; height: 56px; }
.hero-shot { display: block; max-width: 22rem; margin: 0 auto; }

/* Waterline under the hero: sheen line over teal water (decorative) */
.waterline {
    height: 1.25rem;
    background: linear-gradient(180deg, var(--water-top), var(--water-deep));
    border-top: 2px solid var(--sheen);
}

/* Framed marketing shots get a 1 px border (guide: framed shots) */
.phone { border: 1px solid var(--outline); border-radius: 16px; }

/* Ladder strip: words carry the way; notches echo the app's float/sink marks */
.ladder {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10.5rem, 100%), 1fr)); gap: 0.5rem;
    list-style: none; margin: 1rem 0 1.25rem; padding: 0; max-width: 60rem;
}
.tier {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem;
    background: var(--card); color: var(--ink); border-radius: 12px; padding: 0.5rem 0.75rem;
    font-weight: 700;
}
.tier .no { font-variant-numeric: lining-nums tabular-nums; font-weight: 700; color: var(--muted); min-width: 1.4em; }
.way, .way-tag { font-weight: 400; color: var(--muted); }
.way::before, .way-tag::before {
    content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.3em;
    border-radius: 50%; vertical-align: -0.05em; border: 2px solid var(--keyline);
}
.float .way::before, .way-tag.float::before { background: var(--floater); }
.sink .way::before, .way-tag.sink::before { background: var(--sinker); border-color: var(--moon); box-shadow: 0 0 0 1px var(--keyline); }

/* Cards */
.cards { display: grid; gap: 1rem; list-style: none; margin: 1.25rem 0 0; padding: 0; }
@media (min-width: 48rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .cards { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--card); color: var(--ink); border-radius: 16px; padding: 1.25rem; }
.card p:last-child { margin: 0; }

/* Water bands (waterTop -> waterDeep, white / surfaceSheen text) */
.band {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    border-radius: 20px; padding: 1.5rem;
}
.band h2 { margin: 0; }
.band.stack { display: block; }
.band.stack h2 { margin-bottom: 0.6em; }
.band.stack p:last-child { margin: 0; }
.water {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, #1E6F6A, #17605F 60%, #0D4248);
    color: #FFFFFF;
}
.water a:not(.play-badge) { color: #FFFFFF; text-decoration-thickness: 2px; }
.water :focus-visible { outline-color: #FFFFFF; }
/* surfaceSheen line along the top of the water (decorative) */
.water::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: #D8F2EB; }
@media (prefers-color-scheme: dark) {
    .water { background: linear-gradient(180deg, #22766F, #135052 60%, #082C32); }
    .water::before { background: #9FE3D8; }
}

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 48rem) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery > li { min-width: 0; }
.shot { margin: 0; }
.shot figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 0.5rem; }

/* Question links */
.qlinks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; max-width: 42rem; }
.qlinks a {
    display: flex; align-items: center; min-height: 48px; padding: 0.5rem 1rem;
    background: var(--card); color: var(--ink); border-radius: 12px;
    font-weight: 700; text-decoration: none;
}
.qlinks a:hover { text-decoration: underline; }
.hero .qlinks a { background: var(--bg); color: var(--ink); }
.toc { margin-top: 1rem; }

/* Breadcrumb */
.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 0.5rem; padding: 0; font-size: 0.95rem; }
.crumbs li + li::before { content: "›"; padding: 0 0.5rem; }
.crumbs li { display: inline-flex; align-items: center; min-height: 48px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 48px; }

/* Tables: stack into cards at 600 px and below */
table { border-collapse: collapse; width: 100%; max-width: 48rem; margin: 1rem 0 1.5rem; }
caption { text-align: left; color: var(--muted); padding-bottom: 0.5rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--outline); }
thead th { border-bottom: 2px solid var(--rim); font-family: var(--display); font-size: 1.05rem; }
td.num { font-variant-numeric: lining-nums tabular-nums; }
@media (max-width: 37.5rem) {
    caption { display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    tbody, tr, td { display: block; }
    tr { background: var(--card); color: var(--ink); border-radius: 12px; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; }
    td { border: 0; padding: 0.25rem 0; }
    td::before { content: attr(data-label) ": "; font-weight: 700; }
}

.limits { max-width: 46rem; padding-left: 1.25rem; }
.limits li { margin-bottom: 0.75rem; }

.faq > section { padding: 1.5rem 0; border-top: 1px solid var(--outline); }
.faq > section:first-child { border-top: 0; }

/* Footer */
.footer { border-top: 1px solid var(--outline); padding: 2rem 0; margin-top: 1rem; font-size: 0.95rem; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-top p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; list-style: none; margin: 1rem 0; padding: 0; gap: 0 1rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 48px; }
.fine { color: var(--muted); }
.fine p { margin: 0 0 0.5rem; }
.fine a { display: inline-block; padding-block: 0.6rem; }

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