/* StoryPlays — the site, the family's space and the studio.
   The book is the interface: anything that holds a story is paper with a
   spine; everything around it stays quiet. Reader styles: reader.css. */

@font-face { font-family: 'Andika'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/andika-400.woff2') format('woff2'); }
@font-face { font-family: 'Andika'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/andika-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Andika'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/andika-700.woff2') format('woff2'); }
@font-face { font-family: 'Corben'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/corben-400.woff2') format('woff2'); }
@font-face { font-family: 'Corben'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/corben-700.woff2') format('woff2'); }

:root {
    --night: #1d2b4f;
    --night-deep: #141f3b;
    --night-soft: #2f416c;
    --moon: #f7e3a1;
    --moon-deep: #e9c96a;
    --paper: #fdf8ee;
    --paper-edge: #ece2cc;
    --mist: #eef1f8;
    --mist-line: #d8deeb;
    --ink: #1f2433;
    --ink-soft: #565d72;
    --lily: #ef8fa6;
    --lily-deep: #c9566f;
    --reed: #4f7d68;
    --white: #ffffff;
    --focus: #e39a2d;

    --title: 'Corben', Georgia, serif;
    --text: 'Andika', 'Trebuchet MS', system-ui, sans-serif;

    --page: min(1160px, calc(100% - 32px));
    --book-shadow: 0 1px 0 rgb(20 31 59 / 0.08), 0 22px 44px -22px rgb(20 31 59 / 0.55);
}

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

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

body {
    margin: 0;
    background: var(--mist);
    color: var(--ink);
    font: 400 1.125rem/1.55 var(--text);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-family: var(--title); font-weight: 400; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(2.375rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.875rem, 3.4vw, 2.375rem); }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.3125rem; }
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 0.75em; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

[x-cloak] { display: none !important; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--moon); color: var(--night); padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 12px; }

.wrap { width: var(--page); margin-inline: auto; }
.measure { max-width: 34em; }
.muted { color: var(--ink-soft); }
.small { font-size: 1rem; }
.tiny { font-size: 0.875rem; }

/* ─── Wordmark ─────────────────────────────────────────────── */

.wordmark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--title); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.01em; text-decoration: none; color: inherit; }
.wordmark svg { width: 32px; height: 32px; flex: none; }

/* ─── Buttons ──────────────────────────────────────────────── */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 48px; padding: 0 22px; border-radius: 12px; border: 2px solid transparent;
    background: var(--night); color: var(--paper); font-weight: 700; font-size: 1.0625rem;
    text-decoration: none; white-space: nowrap; transition: transform 0.12s ease, background-color 0.12s ease;
}
.button:hover { background: var(--night-soft); text-decoration: none; }
.button:active { transform: translateY(1px); }
.button[disabled], .button.is-disabled { opacity: 0.5; pointer-events: none; }
.button--moon { background: var(--moon); color: var(--night); }
.button--moon:hover { background: #fbecbb; }
.button--line { background: transparent; color: inherit; border-color: currentColor; }
.button--line:hover { background: rgb(255 255 255 / 0.08); }
.on-light .button--line:hover, .panel .button--line:hover { background: rgb(29 43 79 / 0.06); }
.button--small { min-height: 40px; padding: 0 16px; font-size: 1rem; border-radius: 10px; }
.button--wide { width: 100%; }
.button svg { width: 20px; height: 20px; }

.link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 0.18em; font-weight: 700; }
.link-button--danger { color: var(--lily-deep); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ─── Site header and footer ───────────────────────────────── */

.site-header { color: var(--paper); background: var(--night); position: relative; z-index: 5; }
.site-header .wrap { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.site-nav { display: flex; gap: 24px; margin-right: auto; }
.site-nav a { text-decoration: none; color: rgb(253 248 238 / 0.82); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--paper); text-decoration: underline; }
.site-header .actions { gap: 10px; }
.site-header .signin { color: var(--paper); text-decoration: none; padding: 0 8px; }

.menu-toggle { display: none; margin-left: auto; background: none; border: 2px solid rgb(253 248 238 / 0.5); border-radius: 10px; color: var(--paper); min-height: 42px; padding: 0 14px; font-weight: 700; }

@media (max-width: 860px) {
    .menu-toggle { display: inline-flex; align-items: center; }
    .site-header .wrap { flex-wrap: wrap; gap: 12px; padding-block: 14px; }
    .site-nav, .site-header .actions { display: none; width: 100%; }
    .site-header.is-open .site-nav { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
    .site-header.is-open .site-nav a { padding: 10px 0; font-size: 1.25rem; }
    .site-header.is-open .actions { display: flex; padding-bottom: 8px; }
}

.site-footer { background: var(--night-deep); color: rgb(253 248 238 / 0.78); padding: 56px 0 40px; margin-top: 0; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.site-footer .wordmark { color: var(--paper); }
.site-footer h4 { font-size: 1.0625rem; font-family: var(--text); font-weight: 700; color: var(--paper); margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: var(--paper); }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid rgb(253 248 238 / 0.14); padding-top: 22px; font-size: 0.9375rem; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr 1fr; } .site-footer .wrap > :first-child { grid-column: 1 / -1; } }

/* ─── End-paper night: the dark ground of the hero and page tops ─ */

.night {
    background-color: var(--night);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23f7e3a1' fill-opacity='.09'%3E%3Cpath d='M28 18a9 9 0 1 0 9 12 7 7 0 1 1-9-12z'/%3E%3Ccircle cx='88' cy='30' r='1.6'/%3E%3Ccircle cx='70' cy='78' r='1.2'/%3E%3Ccircle cx='16' cy='92' r='1.4'/%3E%3Cpath d='M92 88a8 8 0 1 0 8 10.5 6 6 0 1 1-8-10.5z'/%3E%3Ccircle cx='50' cy='50' r='.9'/%3E%3C/g%3E%3C/svg%3E");
    color: var(--paper);
}
.page-top { padding: 56px 0 64px; }
.page-top p { color: rgb(253 248 238 / 0.82); margin-top: 14px; max-width: 36em; }

/* ─── Home hero: the open book lying across night and day ──── */

.hero { padding: 48px 0 0; position: relative; }
.hero::after { content: ''; position: absolute; inset: auto 0 0 0; height: 30%; background: var(--mist); z-index: 0; }
.hero-copy { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 40px; align-items: end; }
.hero-copy h1 { max-width: 12em; }
.hero-copy p { color: rgb(253 248 238 / 0.85); font-size: 1.25rem; max-width: 30em; }
.hero-copy .actions { margin-top: 26px; }
.hero-book { position: relative; z-index: 1; margin-top: 44px; }
@media (max-width: 860px) { .hero-copy { grid-template-columns: 1fr; gap: 18px; } .hero::after { height: 22%; } }

/* ─── The open book (shared by the hero and the reader) ───── */

.open-book {
    position: relative; display: grid; grid-template-columns: 1fr 1fr; border-radius: 10px 10px 8px 8px;
    box-shadow: 0 30px 60px -28px rgb(10 16 32 / 0.7), 0 2px 0 var(--paper-edge);
    background: var(--paper); overflow: hidden; aspect-ratio: 3 / 2; max-height: 74vh;
}
.open-book::after { /* the spine */
    content: ''; position: absolute; inset: 0 auto 0 50%; width: 64px; transform: translateX(-50%); pointer-events: none;
    background: linear-gradient(90deg, transparent, rgb(31 36 51 / 0.16) 44%, rgb(31 36 51 / 0.28) 50%, rgb(255 255 255 / 0.12) 52%, transparent);
}

.unfinished { display: grid; place-items: center; text-align: center; padding: 48px; color: var(--ink-soft); }

/* ─── Sections ─────────────────────────────────────────────── */

.section { padding: 88px 0; }
.section--tight { padding: 56px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 36px; flex-wrap: wrap; }
.section-head p { color: var(--ink-soft); margin-top: 10px; max-width: 34em; }
.on-paper { background: var(--paper); }
.on-white { background: var(--white); }

/* A clear example for each part of the reading experience. */
.section-heading { max-width: 720px; margin: 0 auto 48px; text-align: center; }
.section-heading h2 { line-height: 1.25; }
.section-heading > p:last-child { margin-top: 18px; color: var(--ink-soft); }
.section-heading .eyebrow, .section-head .eyebrow { margin: 0 0 14px; color: var(--reed); }
.story-features { background: #faf8f1; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.story-feature { min-width: 0; }
.story-feature h3 { font-size: 1.25rem; line-height: 1.3; margin: 24px 0 12px; }
.story-feature > p { font-size: 1rem; color: var(--ink-soft); line-height: 1.7; max-width: 32em; }
.feature-preview { height: 240px; border: 1px solid rgb(59 76 50 / .09); border-radius: 16px; position: relative; overflow: hidden; display: grid; place-items: center; padding-bottom: 30px; }
.feature-caption { position: absolute; inset: auto 16px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .8rem; color: #445b4b; }
.feature-caption svg { width: 17px; height: 17px; flex: none; }
.feature-preview--picture { background: #eee2bd; }
.feature-preview--picture > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 61%; }
.feature-preview--picture .feature-caption { inset: auto 24px 16px; padding: 7px 10px; background: rgb(255 252 239 / .94); border-radius: 30px; }
.feature-preview--words { background: #f3e9ce; }
.feature-paper-line { color: #35483b; font-size: clamp(1.35rem, 2.2vw, 1.8rem); line-height: 1.65; transform: rotate(-3deg); padding: 22px 24px; background: #fffcf4; border-radius: 3px 12px 12px 3px; box-shadow: 3px 4px 0 #e2d8bc, 0 12px 24px -14px #968968; }
.feature-paper-line mark { background: #f3d87c; border-radius: 5px; padding: 0 4px; color: inherit; }
.feature-preview--pages { background: #e9eee2; }
.little-book { position: relative; width: 180px; height: 120px; display: flex; padding: 6px 6px 10px; background: #536a4b; border-radius: 6px 6px 10px 10px; transform: rotate(-8deg); box-shadow: 0 16px 25px -15px #4c5745; }
.little-book > span { width: 50%; background: linear-gradient(90deg, #fdf8ed, #f4ecd9 85%, #d4c7aa); border-radius: 3px 9px 8px 3px; box-shadow: 0 2px #ded3b9, 0 4px #f4ecd9; }
.little-book > span + span { transform: rotate(180deg); }
.little-book > i { position: absolute; width: 42%; height: 90%; left: 50%; top: 4%; background: linear-gradient(90deg, #c6b89b, #fdf7e5 20%, #fff9ee); transform: skewY(-12deg) scaleX(.74); transform-origin: left center; border-radius: 2px 10px 5px 2px; box-shadow: 13px 8px 16px -10px rgb(53 58 41 / .4); }
@media (max-width: 760px) {
    .section-heading { margin-bottom: 32px; }
    .feature-grid { grid-template-columns: 1fr; gap: 36px; max-width: 480px; margin: auto; }
    .feature-preview { height: 220px; }
    .story-feature h3 { margin-top: 20px; }
}

/* ─── Books, covers and the shelf ──────────────────────────── */

.cover {
    position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 3px 7px 7px 3px; overflow: hidden;
    background: var(--night); box-shadow: var(--book-shadow);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::before { /* spine */
    content: ''; position: absolute; inset: 0 auto 0 0; width: 9%; z-index: 1;
    background: linear-gradient(90deg, rgb(0 0 0 / 0.32), rgb(0 0 0 / 0.08) 55%, rgb(255 255 255 / 0.14) 70%, transparent);
}
.cover-title {
    position: absolute; inset: 0 0 auto 0; z-index: 1; padding: 9% 10% 0 14%; color: var(--paper);
    font-family: var(--title); font-weight: 700; font-size: clamp(1rem, 1.7vw, 1.375rem); line-height: 1.1; text-shadow: 0 2px 12px rgb(10 16 32 / 0.55);
}
.cover--large .cover-title { font-size: clamp(1.5rem, 3.2vw, 2.25rem); }
.cover-placeholder { width: 100%; height: 100%; background: linear-gradient(160deg, var(--night-soft), var(--night-deep)); }

.sticker {
    position: absolute; z-index: 2; right: -10px; bottom: 12px; width: 66px; height: 66px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; text-align: center; transform: rotate(-9deg);
    background: var(--lily); color: var(--night-deep); font-family: var(--title); font-weight: 700; font-size: 1rem; line-height: 1;
    box-shadow: 0 6px 14px -6px rgb(20 31 59 / 0.6);
}
.sticker--moon { background: var(--moon); }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 40px 28px; position: relative; padding-bottom: 26px; }
.shelf-ledge { position: relative; }
.shelf-ledge::after {
    content: ''; display: block; height: 14px; margin-top: -2px; border-radius: 3px;
    background: linear-gradient(var(--paper-edge), #ddd0b3); box-shadow: 0 10px 18px -10px rgb(20 31 59 / 0.5);
}
.book-card { position: relative; display: grid; gap: 12px; text-decoration: none; }
.book-card h3 { font-size: 1.1875rem; line-height: 1.2; }
.book-card .meta { color: var(--ink-soft); font-size: 0.9375rem; }
.book-card:hover .cover { transform: translateY(-3px); }
.book-card .cover { transition: transform 0.18s ease; }

.coming { display: grid; align-content: center; gap: 8px; aspect-ratio: 3 / 4; border: 2px dashed var(--mist-line); border-radius: 3px 7px 7px 3px; padding: 18px; color: var(--ink-soft); }
.coming strong { font-family: var(--title); color: var(--ink); font-weight: 400; font-size: 1.125rem; }

/* Spread dots: one per spread, filled as far as the family has read */
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--mist-line); }
.dots span.is-read { background: var(--reed); }

/* ─── Book page (catalogue detail) ─────────────────────────── */

.book-hero { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 56px; align-items: start; }
.book-hero .cover { max-width: 380px; }
.book-hero .subtitle { font-size: 1.3125rem; color: rgb(253 248 238 / 0.85); margin-top: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; color: rgb(253 248 238 / 0.85); }
.buy-box { margin-top: 28px; padding: 24px; border-radius: 20px; background: rgb(255 255 255 / 0.06); border: 1px solid rgb(253 248 238 / 0.16); display: grid; gap: 16px; max-width: 520px; }
.buy-box .price { font-family: var(--title); font-size: 2rem; }
.buy-box .or { color: rgb(253 248 238 / 0.7); font-size: 1rem; }
.characters { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 20px; }
.characters div { padding: 18px 20px; background: var(--white); border-radius: 16px; border: 1px solid var(--mist-line); }
.characters strong { display: block; font-family: var(--title); font-weight: 400; font-size: 1.25rem; margin-bottom: 4px; }
@media (max-width: 860px) { .book-hero { grid-template-columns: 1fr; gap: 28px; } .book-hero .cover { max-width: 260px; } }

/* ─── Pricing ──────────────────────────────────────────────── */

.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
.plan { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; padding: 30px 28px; border-radius: 20px; background: var(--white); border: 1px solid var(--mist-line); }
.plan h3 { font-size: 1.375rem; }
.plan .amount { font-family: var(--title); font-size: 2.375rem; line-height: 1; }
.plan .amount small { font-family: var(--text); font-size: 1rem; color: var(--ink-soft); }
.plan ul { margin: 0; padding-left: 1.1em; color: var(--ink-soft); display: grid; gap: 6px; }
.plan--featured { background: var(--night); color: var(--paper); border-color: var(--night); }
.plan--featured ul, .plan--featured .amount small { color: rgb(253 248 238 / 0.8); }
.plan .sticker { top: -18px; bottom: auto; right: 18px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }

.faq { display: grid; gap: 12px; max-width: 760px; }
.faq details { background: var(--white); border: 1px solid var(--mist-line); border-radius: 16px; padding: 18px 22px; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--title); font-size: 1.5rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin-top: 10px; color: var(--ink-soft); }

/* ─── iPhone Duo ───────────────────────────────────────────── */

.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.duo-device {
    position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border-radius: 34px;
    background: #10162a; box-shadow: 0 40px 70px -34px rgb(10 16 32 / 0.8), inset 0 0 0 2px #2a3352; aspect-ratio: 1.42;
}
.duo-device > div { border-radius: 24px; overflow: hidden; position: relative; }
.duo-device .duo-scene img { width: 100%; height: 100%; object-fit: cover; }
.duo-device .duo-page { background: var(--paper); color: var(--ink); padding: 9% 9%; display: flex; flex-direction: column; justify-content: center; font-size: clamp(0.8125rem, 1.4vw, 1.0625rem); line-height: 1.6; }
.duo-device .duo-page mark { background: var(--moon); color: inherit; border-radius: 0.2em; box-shadow: 0 0 0 0.1em var(--moon); }
.duo-device::after { content: ''; position: absolute; inset: 12px auto 12px 50%; width: 10px; transform: translateX(-50%); background: linear-gradient(90deg, #0a0f1f, #1d2440, #0a0f1f); border-radius: 4px; }
@media (max-width: 860px) { .duo { grid-template-columns: 1fr; gap: 32px; } }

/* ─── Prose pages (privacy, terms) ─────────────────────────── */

.prose { max-width: 42em; }
.prose h2 { font-size: 1.75rem; margin: 40px 0 12px; }
.prose p, .prose ul { color: var(--ink); }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; margin: 12px 0; }

/* ─── Auth ─────────────────────────────────────────────────── */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; overflow: hidden; }
.auth-art .art { position: absolute; inset: 0; }
.auth-art .art img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.auth-art > :not(.art) { position: relative; z-index: 1; }
.auth-art blockquote { margin: 0; font-family: var(--title); font-size: 1.75rem; line-height: 1.25; max-width: 14em; text-shadow: 0 2px 18px rgb(10 16 32 / 0.6); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--mist); }
.auth-form > div { width: min(420px, 100%); }
.auth-form h1 { font-size: 2.375rem; margin-bottom: 8px; }
.auth-form .lede { color: var(--ink-soft); margin-bottom: 26px; }
.auth-form .switch { margin-top: 22px; color: var(--ink-soft); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { min-height: 220px; padding: 24px; } .auth-art blockquote { font-size: 1.375rem; } }

/* ─── Forms ────────────────────────────────────────────────── */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-weight: 700; font-size: 1rem; }
.field small { color: var(--ink-soft); font-size: 0.9375rem; }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
    width: 100%; min-height: 50px; padding: 11px 14px; border-radius: 12px; border: 2px solid var(--mist-line); background: var(--white);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--night); box-shadow: 0 0 0 3px rgb(227 154 45 / 0.45); }
.field.has-error input, .field.has-error textarea { border-color: var(--lily-deep); }
.error { color: var(--lily-deep); font-size: 0.9375rem; font-weight: 700; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; font-size: 1rem; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--night); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.choice { display: flex; flex-wrap: wrap; gap: 10px; }
.choice label { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 2px solid var(--mist-line); border-radius: 12px; background: var(--white); font-weight: 700; font-size: 1rem; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--night); background: var(--mist); }
.choice input { accent-color: var(--night); }

/* ─── Messages ─────────────────────────────────────────────── */

.flash { padding: 14px 18px; border-radius: 14px; font-weight: 700; margin-bottom: 22px; display: flex; gap: 12px; align-items: start; }
.flash--status { background: #e1efe7; color: #234a39; }
.flash--notice { background: #fdeccf; color: #6d4510; }
.flash--error { background: #fbe1e7; color: #7c2238; }
.flash ul { margin: 0; padding-left: 1.1em; }

/* ─── The family's space and the studio ────────────────────── */

.app-header { background: var(--white); border-bottom: 1px solid var(--mist-line); }
.app-header .wrap { display: flex; align-items: center; gap: 28px; min-height: 72px; flex-wrap: wrap; }
.app-nav { display: flex; gap: 6px; margin-right: auto; flex-wrap: wrap; }
.app-nav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: 1rem; }
.app-nav a:hover { color: var(--ink); background: var(--mist); }
.app-nav a[aria-current="page"] { background: var(--night); color: var(--paper); }
.app-header .who { display: flex; align-items: center; gap: 14px; font-size: 1rem; }
.app-header form { margin: 0; }
.studio-badge { font-family: var(--title); font-size: 0.875rem; padding: 3px 10px; border-radius: 999px; background: var(--lily); color: var(--night-deep); }
@media (max-width: 760px) { .app-header .wrap { gap: 10px; padding-block: 12px; } .app-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; } }

.app-main { padding: 40px 0 88px; }
.app-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.app-title p { color: var(--ink-soft); margin-top: 8px; }

.panel { background: var(--white); border: 1px solid var(--mist-line); border-radius: 20px; padding: 28px; }
.panel + .panel { margin-top: 22px; }
.panel h2 { font-size: 1.625rem; margin-bottom: 6px; }
.panel h3 { font-size: 1.3125rem; margin-bottom: 4px; }
.panel > p.muted { margin-bottom: 18px; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel-grid > .panel + .panel { margin-top: 0; }
.stack > * + * { margin-top: 22px; }
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }

/* The bookplate: whose library this is */
.bookplate {
    position: relative; padding: 30px 34px; border-radius: 20px; background: var(--paper);
    border: 2px solid var(--paper-edge); box-shadow: inset 0 0 0 6px var(--paper), inset 0 0 0 7px var(--moon-deep);
    display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
}
.bookplate .belongs { font-family: var(--title); font-size: 1rem; color: var(--ink-soft); }
.bookplate h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin-top: 4px; }
.bookplate .plan-line { margin-top: 8px; color: var(--ink-soft); }

/* Continue reading */
.continue { display: grid; grid-template-columns: 110px 1fr; gap: 22px; align-items: center; }
.continue .cover { width: 110px; }
.continue h3 { margin-bottom: 6px; }
.continue .dots { margin: 10px 0 14px; }

.shelf-item { display: grid; gap: 10px; position: relative; }
.shelf-item .cover.is-locked img { filter: grayscale(0.7) brightness(0.7); }
.shelf-item .label { font-size: 0.9375rem; color: var(--ink-soft); }
.lock {
    position: absolute; z-index: 2; inset: auto 10px 10px auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
    background: rgb(20 31 59 / 0.82); color: var(--paper); font-size: 0.875rem; font-weight: 700;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.filters button { border: 2px solid var(--mist-line); background: var(--white); border-radius: 999px; padding: 7px 16px; font-weight: 700; font-size: 1rem; color: var(--ink-soft); }
.filters button[aria-pressed="true"] { background: var(--night); border-color: var(--night); color: var(--paper); }

.empty { text-align: center; padding: 48px 24px; }
.empty h3 { margin-bottom: 8px; }
.empty p { color: var(--ink-soft); margin: 0 auto 20px; max-width: 30em; }

/* Plan summary */
.plan-summary { display: flex; justify-content: space-between; gap: 18px; align-items: start; flex-wrap: wrap; }
.plan-summary .state { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: #e1efe7; color: #234a39; font-weight: 700; font-size: 0.9375rem; }
.plan-summary .state--ending { background: #fdeccf; color: #6d4510; }
.plan-summary .state--trial { background: #fff4cf; color: #6b5310; }

/* Tables (purchases, studio) */
.table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.table th { text-align: left; font-weight: 700; color: var(--ink-soft); font-size: 0.9375rem; padding: 0 12px 10px 0; border-bottom: 2px solid var(--mist-line); }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--mist-line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.thumb { width: 44px; aspect-ratio: 3 / 4; border-radius: 2px 4px 4px 2px; object-fit: cover; background: var(--night); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.875rem; font-weight: 700; background: var(--mist); color: var(--ink-soft); white-space: nowrap; }
.pill--published, .pill--ready, .pill--succeeded { background: #e1efe7; color: #234a39; }
.pill--draft, .pill--queued, .pill--pending { background: var(--mist); color: var(--ink-soft); }
.pill--running { background: #fff4cf; color: #6b5310; }
.pill--failed, .pill--cancelled, .pill--archived { background: #fbe1e7; color: #7c2238; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--white); border: 1px solid var(--mist-line); border-radius: 16px; padding: 18px 20px; }
.stat strong { display: block; font-family: var(--title); font-size: 2rem; line-height: 1.1; }
.stat span { color: var(--ink-soft); font-size: 0.9375rem; }

.meter { height: 10px; border-radius: 999px; background: var(--mist); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--reed); border-radius: inherit; transition: width 0.4s ease; }

.steps-list { display: grid; gap: 4px; }
.step-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--mist-line); font-size: 1rem; }
.step-row:last-child { border-bottom: 0; }
.step-row .err { grid-column: 1 / -1; color: var(--lily-deep); font-size: 0.9375rem; }

.spread-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--mist-line); }
.spread-row:last-child { border-bottom: 0; }
.spread-row img { width: 90px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; background: var(--night); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ─── Promises to grown-ups ────────────────────────────────── */

.promises { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 56px; margin: 0; }
.promises dt { font-family: var(--title); font-size: 1.3125rem; margin-bottom: 6px; }
.promises dd { margin: 0; color: var(--ink-soft); max-width: 30em; }
@media (max-width: 760px) { .promises { grid-template-columns: 1fr; } }

/* Messages from actions on the page */
.toasts { position: fixed; z-index: 60; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toasts .flash { margin: 0; box-shadow: 0 14px 30px -14px rgb(20 31 59 / 0.5); }

/* The free story opens across the landing-page hero. */
.storybook-hero { background: #f3ead6; color: #203b36; padding: 32px 0 40px; border-bottom: 1px solid #dbd3bd; }
.storybook-intro { text-align: center; max-width: 900px; margin: 0 auto 28px; }
.storybook-intro .eyebrow { color: #566c50; margin-bottom: 12px; }
.storybook-intro h1 { font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.15; letter-spacing: -.025em; }
.storybook-intro > p:last-child { margin-top: 14px; font-size: 1.15rem; color: #526257; }
.storybook-reader { scroll-margin-top: 20px; }
.storybook-binding {
    position: relative; isolation: isolate; padding: 12px 13px 27px; margin: 0 4px 30px;
    border: 1px solid #324934; border-radius: 13px 13px 20px 20px;
    background: linear-gradient(90deg, #53694a, #66805a 46%, #314c38 50%, #66805a 54%, #53694a);
    box-shadow: inset 0 1px 0 #9da98a, inset 0 -5px 0 #354c36, 0 4px 0 #2f4431,
        0 24px 32px -14px rgb(41 45 29 / .35), 0 40px 65px -30px rgb(41 45 29 / .3);
}
.storybook-binding::before {
    content: ''; position: absolute; inset: 5px; border: 1px solid rgb(220 209 157 / .35);
    border-radius: 9px 9px 15px 15px; pointer-events: none;
}
.storybook-binding::after {
    content: ''; position: absolute; z-index: -1; right: 15%; bottom: -24px; width: 28px; height: 55px;
    background: linear-gradient(90deg, #a4553d, #cc8864 45%, #b56a4c);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); pointer-events: none;
}
.storybook-leaves {
    position: absolute; top: 15px; bottom: 13px; width: calc(50% - 13px); pointer-events: none;
    background: repeating-linear-gradient(0deg, #e1d5b7 0 1px, #faf2dd 1px 3px, #d4c6a5 3px 4px);
    border: 1px solid #c6b793; box-shadow: 0 3px 3px rgb(35 36 22 / .15);
}
.storybook-leaves--left { left: 13px; border-radius: 7px 22px 18px 7px / 7px 12px 15px 7px; transform: rotate(-.5deg); transform-origin: right bottom; }
.storybook-leaves--right { right: 13px; border-radius: 22px 7px 7px 18px / 12px 7px 7px 15px; transform: rotate(.5deg); transform-origin: left bottom; }
.storybook-reader .open-book { z-index: 1; aspect-ratio: 1.85; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.storybook-reader .open-book::before {
    content: ''; position: absolute; z-index: 4; left: 50%; top: 7px; bottom: 0; width: 1px;
    background: rgb(85 66 38 / .22); pointer-events: none;
}
.storybook-reader .open-book::after {
    z-index: 3; top: 0; bottom: -9px; width: clamp(36px, 6vw, 80px); border-radius: 0 0 50% 50%;
    background: linear-gradient(90deg, transparent, rgb(99 78 43 / .05) 20%, rgb(85 65 36 / .2) 44%,
        rgb(65 49 28 / .3) 49%, rgb(255 250 228 / .45) 52%, rgb(105 80 44 / .12) 58%, transparent);
}
.storybook-reader .scene { background: #efe4c7; border-radius: 7px 26px 21px 7px / 7px 13px 15px 7px; }
.storybook-reader .scene::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    box-shadow: inset 2px 0 4px rgb(255 248 226 / .5), inset -15px 0 22px -18px rgb(90 65 27 / .3);
}
.storybook-reader .scene img, .storybook-reader .scene video { object-fit: contain; }
.storybook-reader .words {
    padding: clamp(20px, 3vw, 42px); gap: 18px; justify-content: space-between;
    border-radius: 26px 7px 7px 21px / 13px 7px 7px 15px;
    background-image: linear-gradient(90deg, #e9dfc6, #fbf5e5 9%, #fffbf1 40%, #fbf5e5 94%, #ede3cc);
    box-shadow: inset -1px 0 2px rgb(120 97 59 / .15);
}
.storybook-reader .words .text { font-size: clamp(1.15rem, 2.1vw, 1.8rem); line-height: 1.55; }
.storybook-reader .folio { display: none; }
.storybook-reader .page-controls { margin-top: auto; padding-top: 16px; border-top: 1px solid #dcd4c1; }
.storybook-page-meta { display: flex; justify-content: space-between; gap: 10px; color: #66705e; font-size: .8rem; }
.storybook-reader .reader-controls { margin-top: 14px; gap: 12px; flex-wrap: nowrap; }
.storybook-reader .play-button { background: #284e40; color: #fff9e9; min-height: 52px; font-size: 1rem; padding: 0 20px; gap: 8px; }
.storybook-reader .play-button:hover { background: #193c30; }
.storybook-reader .round-button { width: 42px; height: 42px; background: #eee6d4; }
.storybook-auto { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 4px; border: 0; background: transparent; color: #526257; font: inherit; font-size: .8rem; cursor: pointer; }
.storybook-auto svg { width: 17px; height: 17px; }
.storybook-auto[aria-pressed="true"] { color: #284e40; }
.storybook-reader .reader-note { margin: 16px 0 0; color: #526257; }
.storybook-footnote { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-top: 16px; color: #526257; font-size: .875rem; }
.storybook-footnote a { text-underline-offset: 4px; }
.story-together { max-width: 780px; text-align: center; }
.story-together > p:not(.eyebrow) { margin: 24px auto 0; max-width: 38em; color: rgb(253 248 238 / .85); font-size: 1.2rem; }
.story-together .actions { justify-content: center; margin-top: 28px; }
@media (max-width: 860px) {
    .storybook-reader .open-book { aspect-ratio: auto; min-height: 460px; }
    .storybook-reader .words .text { font-size: 1.15rem; }
}
@media (max-width: 640px) {
    .storybook-hero { padding-top: 24px; }
    .storybook-intro > p:last-child { font-size: 1rem; }
    .storybook-footnote { justify-content: center; text-align: center; }
    .storybook-binding { padding: 8px 8px 19px; margin-inline: 0; }
    .storybook-leaves { left: 8px; right: 8px; bottom: 10px; width: auto; transform: none; border-radius: 7px; }
    .storybook-leaves--right, .storybook-reader .open-book::before { display: none; }
    .storybook-reader .scene { border-radius: 7px 7px 0 0; }
    .storybook-reader .words { border-radius: 0 0 7px 7px; }
}

/* The marketing pages share the book's warm paper and woodland palette. */
.marketing-site { --night: #24483c; --night-deep: #18372e; --night-soft: #365f4e; --ink: #293e35; --ink-soft: #5b685f; --reed: #59784e; --mist: #f4f3eb; --mist-line: #dedfd2; --lily: #e4bd8e; background: #f8f7f0; }
.marketing-site .site-header { background: #fbf8ee; color: var(--ink); border-bottom: 1px solid #e6e3d6; }
.marketing-site .site-header .wrap { min-height: 82px; }
.marketing-site .site-nav { margin-left: 24px; gap: 28px; font-size: .9375rem; }
.marketing-site .site-nav a, .marketing-site .site-header .signin { color: #526357; }
.marketing-site .site-nav a:hover, .marketing-site .site-nav a[aria-current="page"] { color: #24483c; }
.marketing-site .site-header .button { background: #284e40; color: #fff9eb; border-radius: 999px; }
.marketing-site .menu-toggle { color: var(--ink); border-color: #c5cebf; }
.marketing-site .section { padding-block: 80px; }
.marketing-site .night { background-image: none; }
.marketing-site .page-top { background: #e9eddf; color: var(--ink); padding-block: 64px; border-bottom: 1px solid #d8dfcd; }
.marketing-site .page-top p, .marketing-site .page-top .subtitle, .marketing-site .page-top .facts { color: var(--ink-soft); }
.marketing-site .page-top .buy-box { background: #fbf8ef; border-color: #d8dece; }
.marketing-site .page-top .buy-box .or { color: var(--ink-soft); }
.marketing-site .page-top .button--moon { background: #284e40; color: #fff9eb; }
.marketing-site .storybook-hero { padding-top: 44px; background: radial-gradient(ellipse at 50% 38%, #fbf6e7, #f1e8d2 75%); }
.marketing-site .storybook-intro { margin-bottom: 30px; }
.marketing-site .storybook-intro .eyebrow { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; }
.marketing-site .storybook-intro > p:not(.eyebrow) { margin-top: 16px; color: var(--ink-soft); font-size: 1.075rem; }
.story-start { border: 0; padding: 0 12px; min-height: 44px; background: transparent; display: inline-flex; gap: 7px; align-items: center; margin-top: 18px; color: #4e6a49; font-size: .85rem; text-decoration: none; }
.story-start svg { width: 15px; height: 15px; }
.marketing-site .storybook-footnote { padding-top: 8px; }
.marketing-site .story-together { max-width: 750px; }
.marketing-site .story-together .eyebrow { color: #c9d3b7; margin-bottom: 18px; }
.marketing-site .home-library { border-top: 1px solid #e4dfd2; }
.marketing-site .shelf { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 40px; }
.marketing-site .book-card { max-width: 270px; }
.marketing-site .coming { max-width: 270px; background: #f1efe4; border: 1px solid #dadccd; padding: 28px; }
.marketing-site .plans { gap: 24px; }
.marketing-site .plan { padding: 32px 26px 26px; border-radius: 16px; grid-template-rows: auto auto 1fr auto; }
.marketing-site .plan .amount { padding-block: 8px 14px; }
.marketing-site .plan ul { font-size: .9375rem; line-height: 1.65; gap: 12px; padding-left: 1.1em; margin-bottom: 14px; }
.marketing-site .plan .sticker { position: absolute; top: -13px; right: 24px; width: fit-content; height: auto; padding: 5px 12px; font: 700 .75rem/1.4 var(--text); letter-spacing: .02em; border-radius: 50px; transform: none; box-shadow: none; margin-bottom: 2px; }
.marketing-site .plan--featured { grid-template-rows: auto auto 1fr auto; }
.marketing-site .site-footer { padding-block: 64px 32px; }
.marketing-site .promises > div { border-top: 1px solid #dce2d4; padding-top: 22px; }
@media (max-width: 860px) { .marketing-site .site-nav { margin-left: 0; gap: 4px; } }
@media (max-width: 760px) {
    .marketing-site .section { padding-block: 52px; }
    .marketing-site .page-top { padding-block: 40px; }
    .marketing-site .storybook-hero { padding-top: 28px; }
    .marketing-site .storybook-intro h1 { font-size: 2rem; }
    .marketing-site .storybook-intro > p:not(.eyebrow) { font-size: 1rem; }
    .marketing-site .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 18px; }
    .marketing-site .coming { grid-column: 1 / -1; max-width: none; aspect-ratio: auto; padding: 24px; }
    .marketing-site .book-card h3 { font-size: 1rem; }
    .marketing-site .plan { padding: 28px 24px; }
    .marketing-site .storybook-footnote { gap: 14px; }
}
.marketing-site .cover .sticker { right: 10px; bottom: 12px; width: 60px; height: 60px; font-size: .9rem; transform: rotate(-6deg); }
.marketing-site .cover::after { content: ''; position: absolute; inset: 0 0 auto; height: 58%; background: linear-gradient(rgb(19 42 31 / .6), transparent); pointer-events: none; }
