/*
    app.css — the app's one stylesheet (F19, FR-17).

    Hand-written, no build step and no framework. The values are the landing repository's
    `src/assets/tokens.css`; the components are the parts of its `site.css` the app uses —
    header, footer, the plain page with one message, the form box, the search list, the
    reading page — as drawn for these pages in specs/2026-10-03/0-app-pages/draft.html.
    Provenance and hashes: static/README.md.

    `core/email_theme.py` is the emails' home of the same colours; tests/test_palette.py
    fails when a colour the two share differs. A colour changes in both, or in neither.
*/

/* --- Tokens (sumthepod-landing tokens.css, commit 56e82ee) --- */
:root {
    --ground: #1b1816;
    --ground-raised: #262220;
    --ground-field: #1f1b19;
    --line: #3b3531;
    --line-soft: #2e2926;

    --ink: #f4eee2;
    --ink-body: #d2cabb;
    --ink-muted: #ada496;

    --accent: #cfe3a3;
    --accent-ink: #1b1816;
    --accent-pale: rgba(207, 227, 163, 0.14);

    --font-head: "Archivo", "Archivo Fallback", "Arial Narrow", sans-serif;
    --font-body: "Archivo", "Archivo Body Fallback", Arial, sans-serif;
    --font-mono: "SF Mono", Menlo, Consolas, monospace;
    --head-weight: 900;
    --head-stretch: 62%;
    --head-tracking: -0.01em;
    --head-word-spacing: 0.08em;
    --body-size: 17px;
    --body-leading: 1.5;
    --text-s: 14px;
    --text-l: 18px;

    --radius-s: 6px;
    --radius-m: 14px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 72px;
    --gutter: 16px;
    --measure: 40rem;
    --shadow: 0 16px 32px rgba(0, 0, 0, 0.55);
}

/* --- Fonts: served by the app, with metric-matched fallbacks so nothing shifts --- */
@font-face {
    font-family: "Archivo";
    src: url("fonts/archivo.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
}
@font-face {
    font-family: "Archivo Fallback";
    src: local("Arial Narrow Bold"), local("ArialNarrow-Bold"), local("Arial Narrow");
    size-adjust: 87.1%;
    ascent-override: 87.8%;
    descent-override: 21%;
    line-gap-override: 0%;
}
@font-face {
    font-family: "Archivo Body Fallback";
    src: local("Arial"), local("ArialMT");
    size-adjust: 98.2%;
    ascent-override: 87.8%;
    descent-override: 21%;
    line-gap-override: 0%;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--ground);
    /* A faint warm grain, tiled, no gradient. */
    background-image: 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.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.96 0 0 0 0 0.92 0 0 0 0 0.84 0.07 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    color: var(--ink-body);
    font-family: var(--font-body);
    font-size: var(--body-size);
    line-height: var(--body-leading);
}
h1, h2, h3 { margin: 0; color: var(--ink); }
p { margin: 0; }
a { color: var(--accent); }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.app-header, main, .site-footer {
    width: min(100% - 2 * var(--gutter), var(--measure));
    margin-inline: auto;
}
/* The reading page is wider (spec 7.1), and its header and footer with it. */
.wide .app-header, .wide main, .wide .site-footer { width: min(100% - 2 * var(--gutter), 50rem); }
main { flex: 1 0 auto; padding-block: var(--space-7) var(--space-8); }

/* --- Header --- */
.app-header {
    display: grid;
    /* The mark takes what is left; the links and the language switch (F25) follow it. */
    grid-template-columns: 1fr;
    grid-auto-flow: column;
    grid-auto-columns: auto;
    align-items: center;
    column-gap: var(--space-4);
    padding-block: var(--space-3);
    min-height: 68px;
}
.logo {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-head);
    font-weight: var(--head-weight);
    font-stretch: var(--head-stretch);
    font-size: var(--text-l);
    line-height: 1;
    letter-spacing: 0.005em;
    color: var(--ink);
    text-decoration: none;
    min-height: 44px;
}
.logo-mark { height: 1.15em; width: auto; color: var(--accent); flex: 0 0 auto; }
.app-nav { display: flex; align-items: center; gap: var(--space-4); font-size: var(--text-s); white-space: nowrap; }
.app-nav a { color: var(--ink-body); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.app-nav a:hover { color: var(--ink); }
.app-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

/* The language switch (F25, FR-3): a <details> opening a form of two buttons. No script. */
.lang { position: relative; font-size: var(--text-s); }
.lang summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding-inline: 4px;
    color: var(--ink-body);
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: var(--radius-s);
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { color: var(--ink); }
.lang .globe { width: 18px; height: 18px; }
.lang .chev { width: 12px; height: 12px; transition: transform 120ms; }
.lang[open] .chev { transform: rotate(180deg); }
.lang form {
    position: absolute;
    right: 0;
    top: calc(100% - 2px);
    z-index: 2;
    min-width: 9.5rem;
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: grid;
}
.lang button {
    all: unset;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px 12px;
    min-height: 44px;
    box-sizing: border-box;
    border-radius: var(--radius-s);
    color: var(--ink-body);
    font-size: 15px;
}
.lang button:hover, .lang button:focus-visible { background: var(--accent-pale); color: var(--ink); }
.lang button:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.lang button[aria-current="true"] { color: var(--accent); font-weight: 700; }
.lang button[aria-current="true"]::after { content: "\2713"; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .lang .chev { transition: none; } }

/* --- Headline and lead --- */
main h1 {
    margin: 0 0 var(--space-5);
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: var(--head-weight);
    font-stretch: var(--head-stretch);
    letter-spacing: var(--head-tracking);
    word-spacing: var(--head-word-spacing);
    font-size: clamp(2.5rem, 1.6rem + 3.5vw, 3.75rem);
    line-height: 0.95;
    text-wrap: balance;
}
.lead { color: var(--ink); }
.answer-more { color: var(--ink-body); margin-top: var(--space-4); }
.small { font-size: var(--text-s); color: var(--ink-muted); }

/* --- The one box: a field and its button --- */
.add {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding: var(--space-4) var(--space-4) 20px;
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}
@media (min-width: 34rem) { .add { grid-template-columns: minmax(0, 1fr) auto; padding-bottom: var(--space-4); } }
.add.narrow { grid-template-columns: minmax(0, 1fr); max-width: 26rem; padding-bottom: 20px; }
.add input {
    width: 100%;
    min-height: 48px;
    font: inherit;
    font-size: var(--body-size);
    color: var(--ink);
    background: var(--ground);
    border: 0;
    border-radius: var(--radius-s);
    padding: 0.8rem 0.9rem;
}
.add input:focus-visible { outline-offset: 0; }
.add input::placeholder { color: var(--ink-muted); opacity: 1; }
.button, .add button {
    font: inherit;
    font-weight: 700;
    color: var(--accent-ink);
    background: var(--accent);
    border: 0;
    border-radius: var(--radius-s);
    padding: 0.85rem 1.25rem;
    min-height: 48px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.button:hover, .add button:hover { filter: brightness(1.06); }
button[aria-busy="true"] { cursor: progress; opacity: 0.7; }
.answer-link { margin-top: var(--space-6); }
.legal { font-size: var(--text-s); color: var(--ink-muted); margin-top: var(--space-4); max-width: 26rem; }
.legal a { color: var(--ink-body); }

/* --- The search inside the box --- */
.field-search { position: relative; min-width: 0; }
.field-cover { position: absolute; left: 0.7rem; top: 0.72rem; width: 28px; height: 28px; border-radius: 4px; pointer-events: none; }
.field-search.has-cover input { padding-left: 2.9rem; }
.results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 100%;
    margin: var(--space-2) 0 0;
    padding: var(--space-2);
    list-style: none;
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    box-shadow: var(--shadow);
}
.results li {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: var(--space-3);
    align-items: center;
    min-height: 44px;
    padding: var(--space-2);
    border-radius: 4px;
    cursor: pointer;
}
.results li img, .results li .no-cover { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 4px; }
.results li:hover, .results li[aria-selected="true"] { background: var(--ground); }
.result-name { color: var(--ink); line-height: 1.25; }
.result-by { color: var(--ink-muted); font-size: var(--text-s); line-height: 1.25; }
.hint { font-size: var(--text-s); color: var(--ink-muted); margin-top: var(--space-4); }

/* --- What the page says after something happened --- */
.notice {
    font-size: var(--text-s);
    color: var(--ink);
    line-height: 1.4;
    margin-top: var(--space-4);
    padding-left: var(--space-3);
    border-left: 2px solid var(--accent);
}
.notice.email-off { margin: 0 0 var(--space-5); }
.notice form { display: inline; }
.full { margin-top: var(--space-6); color: var(--ink); }

/* --- Matches offered without script --- */
.matches { list-style: none; margin: var(--space-4) 0 0; padding: 0; border-top: 1px solid var(--line); }
.matches li {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    column-gap: var(--space-3);
    align-items: center;
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--line-soft);
}
.matches img, .matches .no-cover { width: 40px; height: 40px; border-radius: 4px; }
.matches .p-text { display: grid; }

/* --- The list of podcasts --- */
.list-head { margin-top: var(--space-7); padding-bottom: var(--space-2); border-bottom: 1px solid var(--line); font-size: var(--text-s); color: var(--ink-muted); }
.empty { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); max-width: 30rem; }
.podcasts { list-style: none; margin: 0; padding: 0; }
.podcasts li {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    column-gap: var(--space-4);
    align-items: center;
    padding-block: var(--space-4);
    border-bottom: 1px solid var(--line-soft);
}
.podcasts img { width: 56px; height: 56px; border-radius: 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45); }
.no-cover { width: 56px; height: 56px; border-radius: 8px; background: var(--ground-raised); border: 1px solid var(--line); }
.p-text { min-width: 0; display: grid; gap: 2px; }
.p-name { color: var(--ink); font-size: var(--text-l); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.p-by { color: var(--ink-muted); font-size: var(--text-s); line-height: 1.3; overflow-wrap: anywhere; }
.p-act { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; }
.linkish {
    font: inherit;
    font-size: var(--text-s);
    color: var(--ink-body);
    background: none;
    border: 0;
    padding: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.linkish:hover { color: var(--ink); }
.notice .linkish { min-height: 0; color: var(--ink); }
.confirm { grid-column: 1 / -1; margin-top: var(--space-3); display: grid; gap: 2px; font-size: var(--text-s); line-height: 1.4; color: var(--ink); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 0 20px; }
.confirm-actions form { display: inline; }

/* --- A new account's first visit: what happens next --- */
.steps { list-style: none; margin: var(--space-7) 0 0; padding: 0; border-top: 1px solid var(--line); counter-reset: step; }
.steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    column-gap: var(--space-2);
    align-items: baseline;
    padding-block: var(--space-4);
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink-body);
}
.steps li::before {
    content: counter(step);
    font-family: var(--font-head);
    font-weight: var(--head-weight);
    font-stretch: var(--head-stretch);
    font-size: 28px;
    line-height: 1;
    color: var(--ink-muted);
}

/* --- The account page: sections under hairlines, nothing red --- */
.address { color: var(--ink); overflow-wrap: anywhere; }
.sections { margin-top: var(--space-6); border-top: 1px solid var(--line); }
.section { padding-block: var(--space-5); border-bottom: 1px solid var(--line-soft); display: grid; gap: var(--space-2); }
.section h2 { margin: 0; font-family: var(--font-body); font-size: var(--text-l); font-weight: 700; line-height: 1.3; color: var(--ink); }
.section-actions { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); }
.section-actions form { display: inline; }
.quiet {
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--accent);
    background: transparent;
    border: 0;
    box-shadow: inset 0 0 0 1.5px var(--accent);
    border-radius: var(--radius-s);
    padding: 0.6rem 0.9rem;
    min-height: 44px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.plain-links { list-style: none; margin: 0; padding: 0; display: grid; }
.plain-links a {
    font: inherit;
    color: var(--ink-body);
    padding: 10px 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.plain-links a:hover { color: var(--ink); }
.delete-form { display: grid; gap: var(--space-2); margin-top: var(--space-2); max-width: 24rem; }
.delete-form label { font-size: var(--text-s); color: var(--ink-body); }
.delete-form input {
    width: 100%;
    min-height: 48px;
    font: inherit;
    font-size: var(--body-size);
    color: var(--ink);
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    padding: 0.7rem 0.8rem;
}
.usage-number { color: var(--ink); }
progress.meter {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: 4px;
    background: var(--line);
    color: var(--accent);
    overflow: hidden;
}
progress.meter::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 4px; }

/* --- The reading page --- */
.read-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-6); }
/* Beside the cover only when there is one: without it the title would sit in its column. */
@media (min-width: 40rem) { .read-head.has-cover { grid-template-columns: 15rem minmax(0, 1fr); column-gap: var(--space-6); align-items: center; } }
.read-cover { width: min(100%, 15rem); height: auto; aspect-ratio: 1; border-radius: 10px; box-shadow: var(--shadow); }
.read-words { display: grid; gap: var(--space-2); min-width: 0; }
.read-show { font-size: var(--text-s); color: var(--ink-body); }
.read-meta { font-size: var(--text-s); color: var(--ink-muted); }
main .read-head h1 { font-size: clamp(2.25rem, 1.5rem + 3vw, 3.25rem); margin: 0; overflow-wrap: anywhere; }
.read-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.pill {
    font: inherit;
    font-size: var(--text-s);
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
    background: var(--accent-pale);
    border: 0;
    border-radius: 999px;
    padding: 0.65rem 1rem;
    min-height: 44px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.read-body { color: var(--ink-body); overflow-wrap: break-word; }
.read-body p { margin: 0 0 var(--space-4); }
.read-body > p:first-child { font-size: var(--text-l); color: var(--ink); }
.read-body h2, .read-body h3 {
    font-family: var(--font-head);
    font-weight: var(--head-weight);
    font-stretch: var(--head-stretch);
    letter-spacing: var(--head-tracking);
    word-spacing: var(--head-word-spacing);
    font-size: 1.75rem;
    line-height: 1;
    color: var(--ink);
    margin: var(--space-7) 0 var(--space-4);
}
.read-body ul, .read-body ol { margin: 0 0 var(--space-4); padding: 0 0 0 1.3rem; }
.read-body li { margin: 0 0 var(--space-4); padding-left: 4px; }
.read-body li::marker { color: var(--ink-muted); }
.read-body strong { color: var(--ink); font-weight: 700; }
.read-body a { color: var(--accent); }
.stp-chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-s);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    background: var(--accent-pale);
    border-radius: 4px;
    padding: 2px 7px;
    margin-right: 4px;
    vertical-align: 1px;
    white-space: nowrap;
}
.read-manage { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); font-size: var(--text-s); }
.read-manage a { color: var(--accent); }
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 40;
    background: var(--ink);
    color: var(--ground);
    font-size: var(--text-s);
    font-weight: 700;
    line-height: 1;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* --- The legal pages: plain prose in the shell --- */
.prose { color: var(--ink-body); }
.prose h2 { font-size: var(--text-l); font-weight: 700; margin: var(--space-6) 0 var(--space-3); }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--space-3); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: var(--space-2); }
.prose code { font-family: var(--font-mono); font-size: var(--text-s); background: var(--ground-raised); padding: 0 4px; border-radius: 4px; }
.prose a { color: var(--accent); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--text-s); }
.prose th, .prose td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--line-soft); vertical-align: top; }

/* --- Footer --- */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3) var(--space-5);
    padding-block: var(--space-6) var(--space-7);
    border-top: 1px solid var(--line);
    font-size: var(--text-s);
    color: var(--ink-muted);
}
.footer-mark { font-family: var(--font-head); font-weight: var(--head-weight); font-stretch: var(--head-stretch); font-size: var(--text-l); color: var(--ink-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-5); }
.footer-links a { color: var(--ink-muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a:hover { color: var(--ink); }
