/* Figtree (SIL OFL), self-hosted variable font for the sans reading choice */
@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('../fonts/figtree-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('../fonts/figtree-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Why: iOS Safari/Chrome (WebKit) rescales text on fixed-position elements
       when the URL bar collapses/expands during scroll, lagging behind the
       viewport resize. Pinning to 100% disables that autosizing pass so the
       sticky reading header resizes deterministically with the viewport. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

:root {
    --radius-control: 8px; /* buttons, inputs-as-buttons, switches */
    /* Design system ("quiet library", redesign 2026-10-12 — see
       docs/superpowers/specs/2026-10-12-site-redesign-design.md). New
       selectors use these; the legacy names below alias onto them until
       their call sites are migrated. */
    --paper: #F6F1E7;
    --paper-deep: #EFE7D8;
    --surface: #FBF8F1;
    --ink: #2B2622;
    --ink-muted: #6B5F55;
    --rule: #E8DFCF;
    --rule-strong: #D6CAB5;
    --accent: #8A2E2E;
    --accent-hover: #742525;
    --on-accent: #FFFFFF;
    --accent-bright: #B23A3A; /* accent on the dark hero band */
    --font-serif: 'New York', 'Iowan Old Style', Baskerville, 'Hoefler Text', Georgia, 'Times New Roman', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --level-easy-bg: #E3EBDD;
    --level-easy-fg: #3E5A36;
    --level-moderate-bg: #F3E6CC;
    --level-moderate-fg: #7A5A1E;
    --level-challenging-bg: #F1DEDA;
    --level-challenging-fg: #7A2828;

    /* Legacy tokens, re-pointed at the design system. */
    --primary-color: var(--ink);
    --secondary-color: var(--accent);
    --accent-color: #e74c3c;
    --background-color: var(--paper-deep);
    --card-background: var(--surface);
    --text-color: var(--ink);
    --text-light: var(--ink-muted);
    --text-muted: #8C8178;
    --border-color: var(--rule-strong);
    --border-light: var(--rule);
    --secondary-color-hover: var(--accent-hover);
    --sticky-header-accent: #333333;
    --sticky-header-border: #666666;
    --reading-theme-dark-bg: #1a1a1a;
    --reading-theme-dark-text: #e0e0e0;
    --reading-font-serif: -apple-system-ui-serif, ui-serif, 'New York', 'Iowan Old Style', Georgia, serif;
    --skeleton-base: #f0f0f0;
    --skeleton-highlight: #e8e8e8;
    --text-outline: #000;
    --text-dark: #333;
    --text-secondary: #666;
    --cta-gradient-start: #667eea;
    --cta-gradient-end: #764ba2;
    --reading-theme-dark-accent: #5cb3e0;
    --reading-theme-dark-border: #444;
    --sticky-header-muted: #999999;
    --sticky-header-active: #444444;
    --hero-accent: var(--accent);
    --error-bg-light: #fee;
    --section-bg-light: var(--surface);
    --cover-placeholder-bg: var(--rule);
    --admin-modal-bg: #f5f5f5;
    --border-subtle: #ddd;
    --book-author-text: var(--ink-muted);
    --success-gradient-start: #48bb78;
    --success-gradient-end: #38a169;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: var(--font-sans);
    background-color: var(--paper);
    color: var(--text-color);
    line-height: 1.6;
    /* Why: 100vh on iOS WebKit resolves to the LARGE viewport (toolbar fully
       collapsed), taller than what's actually visible when the toolbar is
       showing. That makes body/html genuinely scrollable by the difference,
       and since nothing prevents native touch-scroll on the reading page,
       iOS can rubber-band into that slack and rest a few px off 0 instead of
       snapping back — shifting content up under the fixed sticky header.
       100svh (small viewport height) is never taller than what's visible. */
    min-height: 100svh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}
