/*
 * BBR Originals stylesheet. Hand-written, no framework, no inline styles (the Content-Security-Policy
 * forbids them). Colours follow the brand brief: #00D2FF primary cyan, #0066FF deep blue,
 * #000511 deep background, #040D21 midnight, #FFFFFF text. Gradients are used sparingly.
 */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --cyan: #00d2ff;
  --blue: #0066ff;
  --bg: #ffffff;
  --midnight: #f3f7fc;
  --surface: #f4f7fc;
  --surface-2: #e9f0fa;
  --link: #0052cc;
  --text: #0b1a33;
  --text-soft: #33415c;     /* about 9:1 on --bg */
  --text-muted: #56617a;    /* about 6:1 on --bg */
  --line: rgba(11, 26, 51, 0.16);
  --danger: #9b1c1c;
  --warn-bg: #fff4d6;
  --warn-text: #6b4300;
  --ok: #1f6b4f;
  --focus: #0066ff;
  --radius: 10px;
  --max: 72rem;
  --measure: 40rem;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-story: "Source Serif 4", Georgia, "Times New Roman", serif;
  --story-size: 1.125rem;   /* 18px, default */
  --story-line: 1.72;
  --gradient-hero: radial-gradient(120% 80% at 0% 0%, rgba(0, 102, 255, 0.28), transparent 60%),
    linear-gradient(180deg, var(--midnight), var(--bg));
}

/* Text size steps set by the reader's controls (0 smaller, 1 default, 2 larger, 3 largest). */
html[data-story-size="0"] { --story-size: 1.0625rem; }
html[data-story-size="1"] { --story-size: 1.125rem; }
html[data-story-size="2"] { --story-size: 1.25rem; }
html[data-story-size="3"] { --story-size: 1.375rem; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; outline: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: #003d99; }
h1, h2, h3, h4 { font-family: var(--font-ui); line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); font-weight: 750; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
pre { overflow-x: auto; padding: 1rem; background: var(--surface); border-radius: var(--radius); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.small { font-size: 0.875rem; }
.container { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }
.narrow { max-width: var(--measure); }
.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.6rem 1rem;
  background: var(--cyan); color: #00121f; font-weight: 700; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 1.5rem; }
.section-title { margin: 0; }
.section-intro, .page-intro-text, .page-intro { color: var(--text-soft); max-width: 46rem; }
.section-link { font-weight: 700; white-space: nowrap; }
.eyebrow { display: block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--link); margin-bottom: 0.6rem; }
.lede { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--text-soft); max-width: 42rem; }
.meta, .byline, .pagination-status { color: var(--text-muted); font-size: 0.9rem; }
.meta-sep { margin: 0 0.4rem; opacity: 0.6; }

/* ---------- Header and navigation ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.wordmark { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: 0.02em; font-size: 1.15rem; }
/* The header logo sits beside the name. Fixed box so a late-loading picture never shifts the header. */
.wordmark-logo { width: 2rem; height: 2rem; border-radius: 0.45rem; object-fit: cover; display: block; flex: none; }
@media (max-width: 30rem) { .wordmark-logo { width: 1.7rem; height: 1.7rem; } }
.wordmark-bbr { color: var(--link); }
.wordmark-originals { color: var(--text); font-weight: 600; }
.site-nav { display: flex; align-items: center; }
/* Site search in the header: a plain GET form, labelled, with a visible button. */
.site-search { display: flex; align-items: center; gap: 0.4rem; }
.site-search input[type="search"] { min-height: 2.6rem; width: 11rem; padding: 0.4rem 0.7rem; border: 1px solid #b9b2a4; border-radius: 999px; font: inherit; color: var(--text); background: #fff; }
.site-search .btn { min-height: 2.6rem; padding: 0.4rem 0.9rem; }
.site-search input[type="search"]:focus { outline: 3px solid var(--focus, #0066ff); outline-offset: 2px; }
@media (max-width: 61.99rem) {
  .site-search { width: 100%; }
  .site-search input[type="search"] { flex: 1; width: auto; min-width: 0; }
}
.nav-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; }
.nav-list > li > a { display: inline-block; padding: 0.45rem 0.7rem; border-radius: 999px; color: var(--text-soft); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav-list > li > a:hover, .nav-list > li > a[aria-current="page"] { color: var(--text); background: rgba(0, 210, 255, 0.1); }
.nav-list > li > a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--cyan); border-radius: 6px 6px 0 0; }
/* "Stories" dropdown: native disclosure, works without JavaScript and with the keyboard. */
.nav-dropdown { position: relative; }
.nav-dropdown > details > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.7rem; border-radius: 999px; color: var(--text-soft); font-weight: 600; font-size: 0.95rem; }
.nav-dropdown > details > summary::-webkit-details-marker { display: none; }
.nav-dropdown > details > summary::after { content: ""; width: 0.45rem; height: 0.45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
.nav-dropdown > details[open] > summary::after { transform: rotate(-135deg); }
.nav-dropdown > details > summary:hover, .nav-dropdown > details[open] > summary, .nav-dropdown.is-current > details > summary { color: var(--text); background: rgba(0, 210, 255, 0.1); }
.nav-dropdown > details > summary:focus-visible { outline: 3px solid var(--focus, #0066ff); outline-offset: 2px; }
.nav-dropdown.is-current > details > summary { box-shadow: inset 0 -2px 0 var(--cyan); border-radius: 6px 6px 0 0; }
.nav-sub { position: absolute; top: 100%; left: 0; z-index: 60; list-style: none; margin: 0.4rem 0 0; padding: 0.4rem; min-width: 13rem; display: grid; gap: 0.1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(11, 26, 51, 0.12); }
.nav-sub a { display: block; padding: 0.55rem 0.75rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav-sub a:hover, .nav-sub a[aria-current="page"] { background: rgba(0, 210, 255, 0.1); }
.nav-sub a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--cyan); }

/* Mobile navigation: wraps into a row under the wordmark, large touch targets. */
@media (max-width: 52rem) {
  .header-inner { flex-direction: column; align-items: flex-start; padding: 0.7rem 0; gap: 0.4rem; }
  .nav-list { gap: 0; }
  .nav-list > li > a { padding: 0.5rem 0.6rem; font-size: 0.9rem; }
}

/* Header menu: one blue three-line button opens the full list (native details, works without JavaScript). */
.header-inner { flex-wrap: wrap; }
.site-nav { margin-left: auto; }
.menu { position: relative; }
.menu-button { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 2.9rem; height: 2.9rem; border-radius: 10px; background: var(--blue); color: #fff; }
.menu-button::-webkit-details-marker { display: none; }
.menu-button:hover, .menu[open] > .menu-button { background: #0050cc; }
.menu-button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.menu-bars { display: grid; gap: 4px; width: 1.3rem; }
.menu-bars span { display: block; height: 2.5px; background: #fff; border-radius: 2px; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 60; list-style: none; margin: 0; padding: 0.4rem; min-width: 16rem; display: grid; gap: 0.1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(11, 26, 51, 0.12); }
.menu-panel a { display: block; padding: 0.75rem 0.9rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1rem; }
.menu-panel a:hover, .menu-panel a[aria-current="page"] { background: rgba(0, 102, 255, 0.08); }
.menu-panel a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--blue); }
.menu-panel a:focus-visible { outline: 3px solid var(--focus, #0066ff); outline-offset: -2px; }
/* Phones: wordmark and menu button share the first row; search takes the full second row. */
@media (max-width: 52rem) {
  .header-inner { flex-direction: row; align-items: center; padding: 0.6rem 0; gap: 0.5rem 0.75rem; }
  .site-search { order: 3; flex: 1 0 100%; }
}
@media (min-width: 52.01rem) {
  .site-search { order: 2; }
}

/* ---------- Hero and homepage ---------- */
.hero { background: var(--gradient-hero); padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4.5rem); border-bottom: 1px solid var(--line); }
.hero-inner { max-width: none; }
.hero-inner > * { max-width: 46rem; }
.hero-title { font-size: clamp(2.2rem, 6vw, 3.9rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.5em; }
.hero-note { color: var(--text-muted); font-size: 0.92rem; margin-top: 1.2rem; }
.intro-points, .points, .checklist { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.7rem; }
.intro-points li, .points li { padding-left: 1.3rem; position: relative; color: var(--text-soft); }
.intro-points li::before, .points li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--cyan); }
.pill-list, .chips { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 0; }
.pill { display: inline-block; padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); font-size: 0.9rem; text-decoration: none; background: rgba(11, 26, 51, 0.04); }
a.pill:hover { border-color: var(--cyan); color: var(--text); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.stat { border-top: 1px solid var(--line); padding-top: 0.8rem; }
.stat-value { font-size: 1.5rem; font-weight: 750; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; }
.philosophy { background: var(--midnight); border-top: 1px solid var(--line); }
.philosophy-inner { max-width: 46rem; }
.prose-page p, .prose, .prose-page li { color: var(--text-soft); }
/* Page text reads in the same font as a story. Headings, buttons and labels stay in the UI font,
   so the site still looks like one thing; only the reading text changes. The size follows the
   reader's own text-size setting, exactly as a story does. */
.page-body, .prose-page .page-body p, .prose-page .page-body li,
.prose-page > p, .prose-page > ul, .prose-page > ol, .prose-page > blockquote {
  font-family: var(--font-story);
  font-size: var(--story-size);
  line-height: var(--story-line);
}
.page-body h2, .page-body h3, .page-body h4 { font-family: var(--font-ui); }
.page-body p { margin-bottom: 1.35em; } /* the same breathing room as a story */
.page-body blockquote { margin: 0 0 1em; padding-left: 1rem; border-left: 3px solid var(--line); color: var(--text-soft); }

/* Hero actions and CTAs */
.hero-actions, .cta-row, .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.75rem; padding: 0.6rem 1.15rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease; }
.btn:hover { border-color: var(--cyan); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #00121f; }
.btn-primary:hover { background: #5fe4ff; border-color: #5fe4ff; color: #00121f; }
.btn-secondary { background: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-danger { background: #fdecec; border-color: #e7a3a8; color: #7a1020; }
.btn-danger-text { background: none; border: 0; color: var(--danger); padding: 0; min-height: 0; font-weight: 700; text-decoration: underline; }
.btn-small { min-height: 2.1rem; padding: 0.35rem 0.7rem; font-size: 0.9rem; }

/* ---------- Cards and grids ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1.25rem; list-style: none; padding: 0; margin: 0; }
.card, .story-card, .category-card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem;
  display: flex; flex-direction: column; gap: 0.6rem; min-width: 0;
}
.story-card { padding: 0; overflow: hidden; }
.story-card .card-body { padding: 1.1rem 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.card-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-title { font-size: 1.2rem; margin: 0; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--link); text-decoration: underline; }
.card-synopsis { color: var(--text-soft); margin: 0; font-size: 0.97rem; }
.category-card-title { font-size: 1.15rem; margin: 0; }
.category-card-title a { color: var(--text); text-decoration: none; }
/* Whole category card is clickable: the title link covers the card. */
.category-card { position: relative; }
.category-card .card-stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.category-card:focus-within { outline: 3px solid var(--focus, #1d4ed8); outline-offset: 3px; }
.category-card .card-stretch:focus { outline: none; }
.category-card:hover { border-color: var(--link); }
.category-card p { color: var(--text-soft); margin: 0; font-size: 0.95rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.category-card a.card-link { color: var(--link); font-weight: 700; margin-top: auto; }
.featured .card { border-color: rgba(0, 210, 255, 0.35); }
.badge, .chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; border: 1px solid var(--line); color: var(--text-soft); background: rgba(11, 26, 51, 0.04); }
.chip-warning, .warning-chip { background: var(--warn-bg); border-color: #6b4a12; color: var(--warn-text); }
.badge-live { border-color: #1f7a54; color: var(--ok); }
.badge-scheduled { border-color: #1d5fb0; color: #1d4f98; }
.badge-draft { border-color: #6b5b1f; color: #6b4300; }
.badge-archived { border-color: #4a4f5e; color: #3d4a63; }
.badge-demo { border-color: #6a3c8f; color: #5b2a85; }
.badge-published { border-color: #1f7a54; color: var(--ok); }
.is-featured { border-color: var(--cyan); }
.warnings, .story-warnings { display: flex; flex-direction: column; gap: 0.5rem; }
.warnings-label { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 700; }
.warning-list, .warning-defs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.warning-defs dt { font-weight: 700; color: var(--text); }
.warning-defs dd { margin: 0 0 0.25rem; color: var(--text-soft); }
.empty-state { text-align: center; padding: 2.5rem 1.25rem; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(11, 26, 51, 0.03); }
.empty-title { font-size: 1.2rem; margin-bottom: 0.4rem; }
.empty-state p { color: var(--text-soft); max-width: 36rem; margin-inline: auto; }

/* ---------- Pagination and breadcrumbs ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-top: 2rem; }
.breadcrumbs { font-size: 0.9rem; color: var(--text-muted); padding: 1rem 0 0; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.3rem; opacity: 0.6; }
.breadcrumbs a { color: var(--text-soft); }

/* ---------- Newsletter ---------- */
.newsletter, .invite { background: linear-gradient(135deg, rgba(0, 102, 255, 0.16), rgba(0, 210, 255, 0.04)); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2rem); }
.newsletter-body { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .newsletter-body { grid-template-columns: 1fr 1fr; align-items: start; } }
.newsletter-copy p { color: var(--text-soft); }
.newsletter-form, .inline-form { display: flex; flex-direction: column; gap: 0.75rem; }
.inline-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.inline-form-wide { flex: 1 1 22rem; }
.inline-form .field { flex: 1 1 14rem; }
.invite-title { font-size: 1.3rem; margin-bottom: 0.4rem; }
.invite p { color: var(--text-soft); }
.check-group { display: flex; gap: 0.6rem; align-items: flex-start; color: var(--text-soft); font-size: 0.95rem; }
.check-group input { margin-top: 0.3rem; width: 1.15rem; height: 1.15rem; accent-color: var(--cyan); flex: 0 0 auto; }
.check-scroll { max-height: 14rem; overflow: auto; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--midnight); display: grid; gap: 0.5rem; }
.hp-field { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { min-height: 65px; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: 1rem; max-width: 42rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field label, .field > span, legend { font-weight: 700; color: var(--text); }
.field-help { font-size: 0.88rem; color: var(--text-muted); margin: 0; }
.field-check { flex-direction: row; align-items: flex-start; gap: 0.6rem; font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="number"], input[type="datetime-local"], input[type="date"], select, textarea {
  font: inherit; color: var(--text); background: var(--midnight); border: 1px solid #b9c8de; border-radius: 8px; padding: 0.6rem 0.75rem; min-height: 2.75rem; width: 100%; max-width: 100%;
}
input::placeholder, textarea::placeholder { color: #6b7a95; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: 2px solid var(--cyan); outline-offset: 1px; }
textarea { min-height: 8rem; resize: vertical; line-height: 1.55; }
.textarea-story { min-height: 26rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem; }
/* Grammar check panel: one button under each story box, and a list the owner ticks through. */
.grammar-tools { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: center; margin: 0.7rem 0 0; }
.grammar-summary { color: var(--text-muted); font-size: 0.9rem; }
.grammar-list { flex-basis: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0.9rem; }
.grammar-rows { display: grid; gap: 0.55rem; max-height: 22rem; overflow-y: auto; }
.grammar-row { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.92rem; line-height: 1.45; cursor: pointer; }
.grammar-row input { margin-top: 0.2rem; flex: none; }
.grammar-row-notice { color: var(--text-muted); cursor: default; }
.grammar-mark { font-weight: 700; color: var(--text); }
/* Clicking a finding puts the cursor on that exact word, so it can be seen in the text. */
.grammar-locate { cursor: pointer; text-decoration: underline dotted; text-decoration-color: #9aa4b2; text-underline-offset: 2px; }
.grammar-locate:hover, .grammar-locate:focus-visible { text-decoration-color: var(--cyan); color: var(--link); }
.grammar-row.is-current { background: #fff6d6; outline: 2px solid #ffd75e; outline-offset: 2px; border-radius: 4px; }
.grammar-change { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem; }
.grammar-change del { color: #a11; background: #fdeaea; text-decoration: line-through; padding: 0 0.15rem; border-radius: 3px; }
.grammar-change ins { color: #0a6b2d; background: #e9f7ee; text-decoration: none; padding: 0 0.15rem; border-radius: 3px; }
.grammar-empty { margin: 0; color: var(--text-muted); }
.grammar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.req { color: var(--danger); }
.inline-error { color: var(--danger); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; background: var(--midnight); }
tr:last-child td { border-bottom: 0; }

/* ---------- Notices ---------- */
.notice { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 0.9rem 1rem; background: var(--surface); margin-bottom: 1.25rem; color: var(--text-soft); }
.notice p:last-child { margin-bottom: 0; }
.notice-title { display: block; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.notice-info { border-left-color: var(--cyan); }
.notice-ok, .notice-success { border-left-color: var(--ok); }
.notice-warn, .notice-warning { border-left-color: var(--warn-text); background: #fff8e6; }
.notice-error, .notice-danger { border-left-color: var(--danger); background: #fdecec; }
.notice-config { border-left-color: var(--blue); }

/* ---------- Story page ---------- */
.story-header { padding: clamp(2rem, 6vw, 3.5rem) 0 1.5rem; border-bottom: 1px solid var(--line); background: var(--gradient-hero); }
.story-header-inner { max-width: none; }
.story-header-inner > * { max-width: 46rem; }
@media (min-width: 62rem) { .story-header-inner { padding-left: 8.5rem; } }
.story-title { font-size: clamp(2rem, 5.2vw, 3.2rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.story-subtitle { font-size: clamp(1.1rem, 2.2vw, 1.35rem); color: var(--text-soft); margin: 0 0 1rem; font-weight: 500; }
.story-header .meta-row, .story-header .meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; color: var(--text-muted); font-size: 0.92rem; }
.story-layout { display: grid; gap: 1.5rem; padding: 2rem 0 3rem; grid-template-columns: 1fr; }
.story-main { min-width: 0; max-width: var(--measure); width: 100%; }
.story-excerpt { font-size: 1.15rem; color: var(--text-soft); font-style: italic; border-left: 3px solid var(--cyan); padding-left: 1rem; margin: 0 0 2rem; }
.story-body {
  font-family: var(--font-story); font-size: var(--story-size); line-height: var(--story-line); color: var(--text);
  text-align: left; hyphens: manual; overflow-wrap: break-word;
}
.story-body p { margin: 0 0 1.35em; } /* a little more air between paragraphs, easier to follow */
.story-body h2 { font-family: var(--font-ui); font-size: 1.45em; margin: 1.6em 0 0.6em; }
.story-body h3 { font-family: var(--font-ui); font-size: 1.2em; margin: 1.4em 0 0.5em; }
.story-body strong { font-weight: 700; }
.story-body em { font-style: italic; }
.story-body blockquote { margin: 1.6em 0; padding: 0.2em 0 0.2em 1.2em; border-left: 3px solid var(--blue); color: var(--text-soft); font-style: italic; }
.story-body hr { margin: 2.2em auto; width: 40%; border-top: 1px solid var(--line); }
.story-body a { color: var(--link); }
.story-body ul, .story-body ol { margin-bottom: 1.1em; }
.copyright-note { margin-top: 2.5rem; font-size: 0.9rem; color: var(--text-muted); border-top: 1px solid var(--line); padding-top: 1rem; }
.story-extras { margin-top: 2.5rem; display: grid; gap: 1.25rem; }
.author-note, .discussion { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.author-note .section-title, .discussion .section-title { font-size: 1.1rem; margin-bottom: 0.5rem; }
.author-note p, .discussion p { color: var(--text-soft); margin-bottom: 0.6rem; }
.story-related { margin-top: 3rem; }

/* Reader toolbar. Vertical column on desktop; compact floating bar on small screens. */
.toolbar { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: center; }
.tool-group { display: flex; flex-direction: row; gap: 0.4rem; align-items: center; }
.tool-form { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: 2.75rem; min-width: 2.75rem;
  padding: 0.45rem 0.75rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(244, 247, 252, 0.95);
  color: var(--text); font: inherit; font-size: 0.92rem; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.tool-btn:hover { border-color: var(--cyan); color: var(--text); }
.tool-btn[aria-pressed="true"], .tool-btn.is-active { border-color: var(--cyan); color: var(--link); }
.tool-btn:disabled { opacity: 0.6; cursor: wait; }
.tool-btn svg { flex: 0 0 auto; }
.tool-btn-small { min-width: 2.4rem; min-height: 2.4rem; padding: 0.3rem 0.6rem; font-size: 0.95rem; color: var(--text-soft); }
.tool-label { white-space: nowrap; }
.tool-count { min-width: 0.5rem; font-variant-numeric: tabular-nums; color: var(--text-soft); font-weight: 600; }
.tool-note { font-size: 0.85rem; color: var(--text-muted); margin: 0; max-width: 14rem; }
.tool-support { border-color: rgba(0, 102, 255, 0.5); }
.tool-size { color: var(--text-muted); }
.size-up-mark { font-size: 0.7em; margin-left: 0.05em; }
.share-status { margin: 0; font-size: 0.85rem; color: var(--text-soft); min-height: 1.2em; text-align: center; }
.share-fallback { width: 100%; display: grid; gap: 0.3rem; }
.share-fallback label { font-size: 0.85rem; color: var(--text-muted); }
.share-fallback input { font-size: 0.85rem; }

@media (min-width: 62rem) {
  .story-layout { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 3rem; }
  .toolbar { position: sticky; top: 6rem; flex-direction: column; align-items: stretch; align-self: start; gap: 0.75rem; }
  .tool-group { flex-direction: column; }
  .tool-form { flex-direction: column; }
  .tool-btn { flex-direction: column; min-height: 4rem; width: 100%; border-radius: var(--radius); padding: 0.6rem 0.3rem; font-size: 0.8rem; }
  .tool-btn-small { min-height: 2.6rem; flex-direction: row; }
  .tool-note, .share-fallback { display: none; }
  .tool-size { flex-direction: column; }
  .toolbar[aria-label] { gap: 1rem; }
  .story-layout > .story-main { grid-column: 2; }
}

@media (max-width: 61.99rem) {
  .toolbar {
    position: sticky; bottom: 0.5rem; z-index: 40; align-self: center; width: min(calc(100% + 1rem), 36rem);
    background: rgba(255, 255, 255, 0.96); border: 1px solid var(--line); border-radius: 14px; padding: 0.25rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); backdrop-filter: blur(6px); flex-wrap: wrap; justify-content: center; gap: 0.15rem;
  }
  .tool-group, .tool-size { flex-wrap: nowrap; justify-content: center; gap: 0.15rem; }
  .tool-label { font-size: 0.8rem; }
  .tool-btn { min-height: 2.5rem; padding: 0.3rem 0.35rem; gap: 0.2rem; font-size: 0.8rem; }
  .tool-btn-small { min-width: 2.1rem; padding: 0.3rem 0.2rem; }
  .toolbar [data-share] .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .toolbar [data-share] { padding-left: 0.5rem; padding-right: 0.5rem; }
  .toolbar .share-status:empty { display: none; }
  .tool-note, .share-fallback { display: none; }
  .story-layout { display: flex; flex-direction: column; }
  .story-layout > .story-main { order: 1; }
  .story-layout > .toolbar { order: 2; }
}

/* ---------- Audio ---------- */
.audio-list { display: grid; gap: 1rem; list-style: none; padding: 0; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--midnight); border-top: 1px solid var(--line); padding: 3rem 0 2rem; margin-top: 3rem; color: var(--text-soft); font-size: 0.95rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 46rem) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand .wordmark { font-size: 1.3rem; }
.footer-tagline { color: var(--text-muted); max-width: 22rem; margin-top: 0.6rem; }
.footer-heading { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin: 0 0 0.7rem; }
.footer-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.footer-nav a { color: var(--text-soft); text-decoration: none; }
.footer-nav a:hover { color: var(--link); text-decoration: underline; }
.footer-bottom { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--text-muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.footer-note { max-width: 46rem; margin: 0; }

/* ---------- Static and legal pages ---------- */
.page-head { padding: clamp(2rem, 5vw, 3.5rem) 0 1.5rem; }
.page-title { font-size: clamp(1.9rem, 4.2vw, 2.9rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.page-body { padding-bottom: 3rem; max-width: var(--measure); }
.page-body h2 { margin-top: 2rem; }
.page-body li { margin-bottom: 0.4rem; }
.placeholder, .todo { background: rgba(255, 210, 122, 0.12); color: var(--warn-text); padding: 0 0.2em; border-radius: 4px; }

/* ---------- Admin ---------- */
.admin { background: var(--bg); }
.admin-header { background: var(--midnight); border-bottom: 1px solid var(--line); }
.admin-header-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1.5rem; padding: 0.8rem 0; }
.admin-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.2rem; padding: 0; margin: 0; }
.admin-nav a { display: inline-block; padding: 0.4rem 0.6rem; border-radius: 8px; color: var(--text-soft); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.admin-nav a:hover, .admin-nav a[aria-current="page"] { color: var(--text); background: rgba(0, 210, 255, 0.1); }
.admin-account { display: flex; align-items: center; gap: 0.75rem; color: var(--text-muted); font-size: 0.9rem; }
.admin-account form { margin: 0; }
.admin-page { padding: 2rem 0 4rem; }
.admin-page .page-title { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.admin-preview-bar { background: var(--warn-bg); color: var(--warn-text); padding: 0.6rem 0; border-bottom: 1px solid #e0c27a; font-size: 0.92rem; }
.admin-preview-bar .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: center; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 1.25rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { min-width: 10rem; flex: 1 1 10rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.row-actions form { margin: 0; }
.editor-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 60rem) { .editor-grid { grid-template-columns: minmax(0, 1fr) 20rem; } }
.editor-main, .editor-side { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.editor-side .panel { gap: 0.8rem; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.danger-zone { border: 1px solid #e7a3a8; background: #fdecec; border-radius: var(--radius); padding: 1.1rem; }
.danger-zone h2 { color: #7a1020; font-size: 1.15rem; }
.readiness, .checklist-panel { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.readiness li { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.93rem; color: var(--text-soft); }
.readiness .ok { color: var(--ok); font-weight: 800; }
.readiness .todo { background: none; color: var(--warn-text); font-weight: 800; padding: 0; }
.ordered-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; counter-reset: item; }
.ordered-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; padding: 0.7rem 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.ordered-title { font-weight: 700; }
.admin-page .small { color: var(--text-muted); }
.admin-page .btn { min-height: 2.4rem; }
.admin.is-admin .story-body { font-size: 1rem; }
.options { display: grid; gap: 0.4rem; }
.page-intro-text + .panel { margin-top: 1rem; }

/* Login */
.login-card { max-width: 26rem; margin: 3rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }

/* ---------- Motion and contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(11, 26, 51, 0.5); --text-soft: #1f2b44; --text-muted: #3d4a63; }
}

/* Print: readable without the reader tools. */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .toolbar, .story-related, .invite, .skip-link { display: none !important; }
  .story-body, .story-title, .story-excerpt { color: #000; }
  a { color: #000; }
}

/* ---------- Pictures and icons (linked images set in Settings → Images and icons) ---------- */
.site-image { display: block; max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.hero-image { width: 100%; max-width: 62rem; aspect-ratio: 16 / 9; object-fit: cover; margin: 2.5rem 0 0; box-shadow: 0 18px 40px rgba(11, 26, 51, 0.12); }
.section-banner { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; margin: 0 0 1.75rem; box-shadow: 0 10px 28px rgba(11, 26, 51, 0.10); }
.page-picture { margin-top: 0; }
.point-icon { width: 3rem; height: 3rem; object-fit: contain; border: 0; background: transparent; margin: 0 0 0.6rem; }
.category-card-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 0 0 0.9rem; border: 0; }
.category-icon { width: 2.5rem; height: 2.5rem; object-fit: contain; border: 0; background: transparent; margin: 0 0 0.6rem; }
.story-figure { margin: 2rem 0; }
.story-figure img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.image-group-title { margin-top: 1.5rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.image-field { border-bottom: 1px dashed var(--line); padding-bottom: 0.9rem; }
@media (max-width: 640px) {
  .section-banner { aspect-ratio: 16 / 9; }
  .hero-image { aspect-ratio: 4 / 3; }
}

/* ---------- Chapter pages, chapter list and reader comments (2026-11-03) ---------- */
.chapter-nav { display: grid; gap: 0.75rem; margin: 2.5rem 0 2rem; }
.chapter-nav .btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; height: auto; padding: 0.75rem 1rem; white-space: normal; }
.chapter-nav-dir { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.chapter-end { margin: 0; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(244, 247, 252, 0.6); }
.chapter-list { margin: 2rem 0; }
.chapter-links { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; }
.chapter-links a { display: block; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); background: rgba(244, 247, 252, 0.6); }
.chapter-links a:hover { border-color: var(--cyan); }
.chapter-links a[aria-current="page"] { border-color: var(--cyan); font-weight: 700; }
.field-error { margin: 0.25rem 0 0; color: var(--danger); font-size: 0.92rem; font-weight: 600; }
.comments { margin: 3rem 0 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.comments-intro, .comments-count, .comments-empty { color: var(--text-soft); }
.comment-list { list-style: none; padding: 0; margin: 1rem 0 2rem; display: grid; gap: 0.9rem; }
.comment { padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(244, 247, 252, 0.6); }
.comment-meta { margin: 0 0 0.4rem; font-size: 0.9rem; color: var(--text-muted); }
.comment-name { color: var(--text); }
.comment-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.comment-form-title { margin-top: 1.5rem; }
.comment-form textarea { width: 100%; min-height: 8rem; font: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); }
@media (min-width: 40rem) {
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .chapter-links { grid-template-columns: 1fr 1fr; }
}

/* Story cards: the whole card is one link (the title link is stretched over it), like the category and tier cards. */
.story-card { position: relative; }
.story-card .card-stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.story-card .card-stretch:focus { outline: none; }
.story-card:focus-within { outline: 3px solid var(--focus, #1d4ed8); outline-offset: 3px; }
.story-card:hover { border-color: var(--link); }

/* Homepage motion: sections fade up as they scroll into view, and cards lift on hover (mouse only).
   The reveal is applied by app.js (class "js"); content is visible without JavaScript and with reduced motion. */
.home-page [data-reveal] { transition: opacity 0.7s ease, transform 0.7s ease; }
.js .home-page [data-reveal]:not(.is-revealed) { opacity: 0; transform: translateY(22px); }
.home-page [data-reveal].is-revealed { opacity: 1; transform: none; }
@media (hover: hover) {
  .home-page .story-card:hover, .home-page .category-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(11, 26, 51, 0.12); }
}
@media (prefers-reduced-motion: reduce) {
  .home-page [data-reveal], .home-page .card-grid > * { transition: none; }
  .js .home-page [data-reveal]:not(.is-revealed) { opacity: 1; transform: none; }
  .home-page .story-card:hover, .home-page .category-card:hover { transform: none; }
}

/* Homepage hero: the picture fills the band behind the text, with a dark blue wash so the words stay readable.
   Without a picture, the blue band shows on its own. The text sits in a short left column. */
.home-page .hero { position: relative; isolation: isolate; overflow: hidden; color: #fff; border-bottom: 0;
  background: linear-gradient(135deg, #061a3d 0%, #0a2d6e 55%, #0052cc 100%);
  padding: clamp(2.5rem, 6vw, 3.5rem) 0; min-height: clamp(320px, 42vw, 440px); display: flex; align-items: center; }
.home-page .hero-bg { position: absolute; inset: 0; z-index: -1; }
.home-page .hero-bg .hero-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; object-fit: cover; object-position: center; margin: 0; border-radius: 0; box-shadow: none; }
.home-page .hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6, 26, 61, 0.94) 0%, rgba(6, 26, 61, 0.82) 42%, rgba(6, 26, 61, 0.3) 100%); }
.home-page .hero-grid { position: relative; }
.home-page .hero .eyebrow { color: #7fe3ff; }
.home-page .hero .hero-inner > * { max-width: 34rem; }
.home-page .hero .hero-title { color: #fff; font-size: clamp(1.9rem, 6.6vw, 3.2rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 0.45em; }
.home-page .hero .lede { color: rgba(255, 255, 255, 0.92); font-size: clamp(0.98rem, 2.6vw, 1.1rem); line-height: 1.55; }
.home-page .hero .hero-note { color: rgba(255, 255, 255, 0.8); font-size: 0.85rem; margin-top: 1rem; }
.home-page .hero .actions { gap: 0.6rem; margin-top: 1.4rem; }
.home-page .hero .btn { min-height: 2.8rem; padding: 0.6rem 1.2rem; border-radius: 999px; font-size: 0.95rem; }
.home-page .hero .btn-primary { background: #5adbff; border-color: #5adbff; color: #03182e; }
.home-page .hero .btn-primary:hover { background: #8ae8ff; border-color: #8ae8ff; color: #03182e; }
.home-page .hero .btn-secondary { background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, 0.7); }
.home-page .hero .btn-secondary:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
@media (min-width: 700px) {
  .home-page .hero .hero-title { font-size: clamp(2.4rem, 4.6vw, 3.2rem); }
  .home-page .hero .lede { font-size: 1.1rem; }
  .home-page .hero .btn { min-height: 3rem; padding: 0.75rem 1.6rem; font-size: 1rem; }
}
@media (max-width: 699px) {
  .home-page .hero-bg::after { background: linear-gradient(180deg, rgba(6, 26, 61, 0.55) 0%, rgba(6, 26, 61, 0.86) 62%, rgba(6, 26, 61, 0.92) 100%); }
}
@keyframes bbr-fade-up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.home-page .hero .hero-inner > * { animation: bbr-fade-up 0.8s ease both; }
.home-page .hero .hero-inner > :nth-child(1) { animation-delay: 0s; }
.home-page .hero .hero-inner > :nth-child(2) { animation-delay: 0.1s; }
.home-page .hero .hero-inner > :nth-child(3) { animation-delay: 0.2s; }
.home-page .hero .hero-inner > :nth-child(4) { animation-delay: 0.3s; }
.home-page .hero .hero-inner > :nth-child(5) { animation-delay: 0.4s; }

/* Homepage cards: each card fades up as it scrolls into view, one after another; hover lifts it (mouse only). */
.home-page .card-grid > [data-reveal], .home-page .category-grid > [data-reveal] { transition: opacity 0.7s ease, transform 0.4s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.home-page .card-grid > [data-reveal].is-revealed, .home-page .category-grid > [data-reveal].is-revealed { transition-delay: calc(var(--reveal-order, 0) * 100ms); }
.home-page .card-grid > [data-reveal].is-revealed:hover, .home-page .category-grid > [data-reveal].is-revealed:hover { transition-delay: 0s; }
@media (prefers-reduced-motion: reduce) {
  .home-page .card-grid > [data-reveal], .home-page .category-grid > [data-reveal] { transition: none; }
  .home-page .card-grid > [data-reveal].is-revealed, .home-page .category-grid > [data-reveal].is-revealed { transition-delay: 0s; }
}

/* Buy form on shop and Premium story pages (shown only while checkout is open). */
.buy-form { margin-top: 0.75rem; display: grid; gap: 0.5rem; max-width: 28rem; }
.buy-label { font-weight: 600; }
.buy-input { font: inherit; padding: 0.6rem 0.75rem; border: 1px solid #9aa9bd; border-radius: 0.5rem; width: 100%; box-sizing: border-box; }
.buy-help { margin: 0; font-size: 0.9rem; }
.buy-currency { border: 0; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.buy-currency legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
.buy-choice { display: flex; gap: 0.5rem; align-items: center; }

/* Shop: a catalogue of cover, title and price. Each card leads to the story page. */
.shop-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 1.25rem; }
.shop-card { margin: 0; padding: 0.75rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 0.5rem; align-content: start; }
.shop-cover-link { display: block; border-radius: 10px; overflow: hidden; }
.shop-cover { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; margin: 0; }
.shop-title { font-size: 1.05rem; line-height: 1.3; margin: 0; }
.shop-title a { color: var(--text); text-decoration: none; }
.shop-title a:hover { text-decoration: underline; }
.shop-prices { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; font-weight: 600; color: var(--text); }
/* Shop sub-menu inside the blue menu panel. */
.menu-sub { display: block; }
.menu-sub summary { list-style: none; cursor: pointer; display: block; padding: 0.75rem 0.9rem; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 1rem; }
.menu-sub summary::-webkit-details-marker { display: none; }
.menu-sub summary::after { content: "▾"; float: right; color: var(--muted, #5b6b82); }
.menu-sub[open] summary::after { content: "▴"; }
.menu-sub summary:hover, .menu-sub summary:focus-visible { background: rgba(0, 102, 255, 0.08); outline: none; }
.menu-sub ul { list-style: none; margin: 0; padding: 0 0 0 0.6rem; display: grid; gap: 0.1rem; }

/* ---------- Premium story page: a product page for a file to buy ---------- */
.product-crumbs { padding-top: 1.5rem; }
.product { padding-bottom: 2.5rem; }
.product-layout { display: grid; gap: 1.75rem; grid-template-columns: 1fr; align-items: start; padding-top: 1rem; }
.product-media { width: 100%; max-width: 18rem; }
.product-cover { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(11, 26, 51, 0.16); margin: 0; background: var(--surface); }
.product-cover-empty { display: grid; place-items: center; padding: 1.5rem; text-align: center; background: linear-gradient(160deg, #0b1a33 0%, #0052cc 100%); color: #fff; font-family: var(--font-story); font-size: 1.5rem; line-height: 1.2; }
.product-format { display: inline-block; margin: 0 0 0.75rem; padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--surface-2); color: var(--link); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.product-title { font-size: clamp(1.9rem, 4.5vw, 2.75rem); line-height: 1.12; margin: 0 0 0.5rem; }
.product-subtitle { color: var(--text-soft); font-size: 1.1rem; margin: 0 0 0.5rem; }
.product-by { color: var(--text-muted); margin: 0 0 1rem; }
.product-price { font-size: 1.6rem; font-weight: 700; color: var(--text); margin: 0 0 1rem; }
.product-cta { margin: 0 0 1.25rem; }
.product-info .toolbar { position: static; justify-content: flex-start; margin-top: 1rem; }
.product-body { display: grid; gap: 1.75rem; padding-top: 2rem; max-width: 52rem; margin-left: 0; }
.product-section { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.product-section .section-title, .product-buy .section-title { margin-top: 0; }
.product-sample audio { display: block; width: 100%; margin: 0 0 1.25rem; }
.product-sample .story-body { font-size: 1.05rem; }
.product-buy { padding: 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px rgba(11, 26, 51, 0.08); }
.offer-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 1rem; }
.offer { display: grid; gap: 0.45rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.offer-format { margin: 0; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.85rem; color: var(--link); }
.offer-price { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text); }
@media (min-width: 760px) {
  .product-layout { grid-template-columns: minmax(16rem, 19rem) 1fr; gap: 3.25rem; padding-top: 2rem; }
  .product-media { position: sticky; top: 6rem; }
}
@media (max-width: 420px) {
  .product-section, .product-buy { padding: 1.1rem; }
}

/* The reader tools sit in the product info column as a row of pills (not the sidebar stack). */
.product-info .toolbar, .product-info .toolbar[aria-label] { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; align-self: auto; gap: 0.6rem; margin-top: 1rem; }
.product-info .tool-group, .product-info .tool-size, .product-info .tool-form { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 0.5rem; }
.product-info .tool-btn { flex-direction: row; width: auto; min-height: 2.6rem; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.9rem; gap: 0.35rem; }
.product-info .tool-btn-small { min-width: 2.6rem; }
.product-info .toolbar [data-share] .tool-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.product-info .tool-note, .product-info .share-fallback { display: none; }

/* Premium story page: headings in capitals, with room around them; one buy control under the price. */
.product-page h2 { margin: 0 0 1.1rem; line-height: 1.2; }
.product-page .product-body { gap: 2.5rem; }
.product-page .product-section { padding: 1.85rem 1.75rem; }
.product-buy-top { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.6rem; margin: 0 0 0.9rem; }
.product-buy-top .btn { width: auto; min-height: 2.75rem; padding-left: 1.1rem; padding-right: 1.1rem; white-space: nowrap; }
.product-share { white-space: nowrap; }

/* Promo slot between chapters (owner's own links: Premium stories, the shop, future resources). */
.chapter-promo { margin: 2rem 0; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chapter-promo-label { margin: 0 0 0.6rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.chapter-promo-card { display: flex; gap: 1rem; align-items: center; color: inherit; text-decoration: none; }
.chapter-promo-image { width: 4.5rem; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 0.35rem; flex: 0 0 auto; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.chapter-promo-body { display: flex; flex-direction: column; gap: 0.3rem; }
.chapter-promo-title { font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.chapter-promo-text { color: var(--text-soft); }
.chapter-promo-cta { color: var(--link); font-weight: 700; font-size: 0.9rem; }
.chapter-promo-card:hover .chapter-promo-title { text-decoration: underline; }
.chapter-promo-editor { margin: 0.5rem 0 1rem; }
.chapter-promo-editor summary { cursor: pointer; font-weight: 700; }

/* Note on each Premium story page: says where the story stands (made from a free story, or not). */
.premium-note { margin: 1rem 0; padding: 0.9rem 1.1rem; border-left: 4px solid var(--brand, #1d4ed8); border-radius: var(--radius); background: #eef4fc; }
.premium-note-title { margin: 0 0 0.25rem; font-weight: 700; }
.premium-note p { margin: 0; }
.choice { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.4rem 0; }

/* The chapter editor stays compact; expand a chapter to edit it. */
.chapter-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem; margin: 0.7rem 0; }
.chapter-row > summary { cursor: pointer; font-weight: 700; }
.chapter-row[open] > summary { margin-bottom: 1rem; }


/* Compact picture previews in the admin Pictures list. */
.media-thumbnail { display: block; width: 9rem; max-width: 100%; height: 7rem; object-fit: contain; object-position: left center; border-radius: 8px; background: var(--surface-2); }
/* On the homepage only, keep the complete cover visible but shorter on phones. */
@media (max-width: 600px) {
  .home-page .shop-cover-link { width: min(100%, 10rem); }
}

/* Discourage ordinary text selection in public stories, not admin editing or controls. */
body:not(.is-admin) [data-story-body] { -webkit-user-select: none; user-select: none; }
body:not(.is-admin) [data-story-body] :is(input, textarea, select, [contenteditable="true"]) { -webkit-user-select: text; user-select: text; }

/* Click the visible homepage pictures without covering their text and buttons. */
.home-page .hero-picture-link { position: absolute; inset: 0; z-index: 0; }
.home-page .hero-picture-link:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.home-page .hero-grid { z-index: 1; pointer-events: none; }
.home-page .hero-inner > * { pointer-events: auto; }

/* Footer uses the same image and dark-blue wash as the homepage philosophy hero. */
.site-footer { position: relative; isolation: isolate; overflow: hidden; background: linear-gradient(135deg,#061a3d,#0b2a55); color: #fff; }
.footer-bg { position: absolute; inset: 0; z-index: -1; }
.footer-background { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.footer-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg,rgba(6,26,61,.96),rgba(6,26,61,.88) 60%,rgba(6,26,61,.77)); }
.site-footer .footer-heading { color: #a7e9fa; }
.site-footer .footer-nav a, .site-footer .footer-bottom { color: #fff; }
.site-footer .footer-nav a:hover { color: #7fe3ff; }
.site-footer .footer-nav a:focus-visible { outline: 2px solid #7fe3ff; outline-offset: 3px; }
.site-footer .footer-bottom { border-color: rgba(255,255,255,.3); }

/* Only the homepage mobile shelves change. Other pages and desktop grids stay as before. */
.home-shelf-controls[hidden] { display: none; }
@media (min-width: 601px) {
  .home-page #premium-home-shelf .shop-grid > :nth-child(n+4) { display: none; }
  .home-shelf-controls { display: none !important; }
}
@media (max-width: 600px) {
  .home-page .home-shelf-track { overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; }
  .home-page .home-shelf-track :is(.shop-grid,.card-grid) { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: calc((100% - 1rem) / 3); gap: .5rem; margin: 0; }
  .home-page .home-shelf-track :is(.shop-card,.story-card) { min-width: 0; scroll-snap-align: start; overflow-wrap: anywhere; }
  .home-page .home-shelf-track .shop-card { padding: .35rem; gap: .3rem; }
  .home-page .home-shelf-track .shop-cover-link { width: 100%; }
  .home-page .home-shelf-track :is(.shop-title,.card-title) { font-size: .8rem; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
  .home-page .home-shelf-track .story-card { gap: .35rem; }
  .home-page .home-shelf-track .story-card > :not(.card-image) { margin-left: .35rem; margin-right: .35rem; }
  .home-page .home-shelf-track :is(.eyebrow,.meta,.shop-prices,.card-synopsis,.chip,.warnings-label) { font-size: .67rem; line-height: 1.25; letter-spacing: normal; }
  .home-page .home-shelf-track .card-synopsis { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .home-shelf-controls:not([hidden]) { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .55rem; }
  .home-shelf-controls button { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; font-size: 1.7rem; line-height: 1; border: 1px solid #9eacc0; border-radius: 50%; background: #fff; color: #0b2a55; cursor: pointer; }
  .home-shelf-controls button:disabled { opacity: .4; cursor: default; }
  .home-shelf-controls button:focus-visible { outline: 3px solid #0066ff; outline-offset: 2px; }
  .footer-bg::after { background: linear-gradient(180deg,rgba(6,26,61,.89),rgba(6,26,61,.95)); }
}

/* Phone homepage: free covers and titles only; details remain accessible and on each story page. */
@media (max-width: 600px) {
  .home-page #free-home-shelf .story-card > :not(.card-image):not(.card-title) {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .home-page #free-home-shelf .story-card { align-self: start; gap: .35rem; }
  .home-page #free-home-shelf .card-title { margin-bottom: .4rem; }
  /* Controls sit beside the cards; with no JS or no overflow, the shelf keeps its full width. */
  .home-page .home-shelf.has-controls { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem; gap: .2rem; align-items: center; }
  .home-page .home-shelf.has-controls .home-shelf-track { grid-column: 2; grid-row: 1; min-width: 0; }
  .home-page .home-shelf.has-controls .home-shelf-controls:not([hidden]) { display: contents; }
  .home-page .home-shelf.has-controls [data-shelf-prev] { grid-column: 1; grid-row: 1; }
  .home-page .home-shelf.has-controls [data-shelf-next] { grid-column: 3; grid-row: 1; }
  .home-page .home-shelf.has-controls .home-shelf-controls button { width: 2.25rem; height: 2.75rem; }
}
@media (max-width: 600px) {
  .home-page #free-home-shelf .story-card { padding: .35rem; display: grid; align-content: start; gap: .3rem; border-radius: 14px; }
  .home-page #free-home-shelf .story-card > .card-title { margin: 0; }
  .home-page #free-home-shelf .card-image { display: block; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 10px; }
  .home-page #free-home-shelf .card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
}

/* Show complete cover art and titles in both mobile homepage shelves. */
@media (max-width: 600px) {
  .home-page .home-shelf-track :is(.shop-title, .card-title) {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    overflow-wrap: anywhere;
  }
  .home-page #premium-home-shelf .shop-cover,
  .home-page #free-home-shelf .card-image img {
    object-fit: contain;
  }
  .home-page #premium-home-shelf .shop-cover-link,
  .home-page #free-home-shelf .card-image { background: var(--surface-2); }
}
/* Free story art is normally landscape: show it at its real proportions, without portrait letterboxing. */
@media (max-width: 600px) {
  .home-page #free-home-shelf .card-image { aspect-ratio: auto; height: auto; background: transparent; }
  .home-page #free-home-shelf .card-image img { width: 100%; height: auto; object-fit: initial; }
  .home-page .home-shelf-track :is(.shop-card, .story-card, .shop-title, .card-title) { overflow-wrap: break-word; word-break: normal; }
}
/* Two larger Free Stories cards on phones; Premium remains three across. */
@media (max-width: 600px) {
  .home-page #free-home-shelf .card-grid { grid-auto-columns: calc((100% - .5rem) / 2); }
}
/* Give the two Free Stories cards more of the phone screen, with prominent full-width art. */
@media (max-width: 600px) {
  .home-page .home-shelf:has(#free-home-shelf) { margin-inline: -0.75rem; }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) { grid-template-columns: 1.75rem minmax(0, 1fr) 1.75rem; gap: .1rem; }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) .home-shelf-controls button { width: 1.75rem; height: 2.75rem; }
  .home-page #free-home-shelf .card-grid { gap: .4rem; grid-auto-columns: calc((100% - .4rem) / 2); }
  .home-page #free-home-shelf .story-card { padding: 0; gap: .4rem; }
  .home-page #free-home-shelf .card-image { border-radius: 13px 13px 0 0; }
  .home-page #free-home-shelf .card-title { padding: 0 .45rem .55rem; font-size: .9rem; line-height: 1.25; font-weight: 750; }
}
/* Wider, bolder Free Stories cards; hide only the scrollbar, not scrolling. */
@media (max-width: 600px) {
  .home-page .home-shelf:has(#free-home-shelf) { margin-inline: -1.1rem; }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) { grid-template-columns: 1.5rem minmax(0, 1fr) 1.5rem; gap: .05rem; }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) .home-shelf-controls button { width: 1.5rem; height: 2.75rem; }
  .home-page #free-home-shelf { scrollbar-width: none; -ms-overflow-style: none; }
  .home-page #free-home-shelf::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .home-page #free-home-shelf .card-title { font-size: 1rem; font-weight: 800; }
}
/* Two larger Free covers: side arrows sit slightly lower, over the card edges. */
@media (max-width: 600px) {
  .home-page .home-shelf.has-controls:has(#free-home-shelf) { display: block; position: relative; }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) .home-shelf-controls button {
    position: absolute; top: clamp(5.5rem, 27vw, 9rem); z-index: 2;
    width: 2.25rem; height: 2.75rem; background: rgba(255, 255, 255, .94);
  }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) [data-shelf-prev] { left: 0; }
  .home-page .home-shelf.has-controls:has(#free-home-shelf) [data-shelf-next] { right: 0; }
}

/* The same phone shelves outside the homepage; desktop grids remain unchanged. */
@media (max-width: 600px) {
  :is(.mobile-premium-shelf,.mobile-free-shelf) .home-shelf-track { overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none; }
  :is(.mobile-premium-shelf,.mobile-free-shelf) .home-shelf-track::-webkit-scrollbar { display: none; width: 0; height: 0; }
  :is(.mobile-premium-shelf,.mobile-free-shelf) :is(.shop-grid,.card-grid) { display: grid; grid-auto-flow: column; grid-template-columns: none; gap: .5rem; margin: 0; }
  .mobile-premium-shelf .shop-grid { grid-auto-columns: calc((100% - 1rem) / 3); }
  .mobile-free-shelf .card-grid { gap: .4rem; grid-auto-columns: calc((100% - .4rem) / 2); }
  :is(.mobile-premium-shelf,.mobile-free-shelf) :is(.shop-card,.story-card) { min-width: 0; scroll-snap-align: start; overflow-wrap: break-word; word-break: normal; }
  .mobile-premium-shelf .shop-card { padding: .35rem; gap: .3rem; }
  .mobile-premium-shelf .shop-cover-link { width: 100%; background: var(--surface-2); }
  .mobile-premium-shelf .shop-cover { object-fit: contain; }
  .mobile-premium-shelf :is(.shop-title,.eyebrow,.shop-prices) { letter-spacing: normal; }
  .mobile-premium-shelf .shop-title { font-size: .8rem; line-height: 1.25; overflow-wrap: break-word; }
  .mobile-premium-shelf :is(.eyebrow,.shop-prices) { font-size: .67rem; line-height: 1.25; }
  .mobile-premium-shelf.has-controls { display: grid; grid-template-columns: 2.25rem minmax(0,1fr) 2.25rem; gap: .2rem; align-items: center; }
  .mobile-premium-shelf.has-controls .home-shelf-track { grid-column: 2; grid-row: 1; min-width: 0; }
  .mobile-premium-shelf.has-controls .home-shelf-controls:not([hidden]) { display: contents; }
  .mobile-premium-shelf.has-controls [data-shelf-prev] { grid-column: 1; grid-row: 1; }
  .mobile-premium-shelf.has-controls [data-shelf-next] { grid-column: 3; grid-row: 1; }
  .mobile-premium-shelf.has-controls .home-shelf-controls button { width: 2.25rem; height: 2.75rem; }
  .mobile-free-shelf { width: calc(100vw - .3rem); margin-left: calc(50% - 50vw + .15rem); }
  .mobile-free-shelf .story-card { padding: 0; display: grid; align-content: start; gap: .4rem; border-radius: 14px; }
  .mobile-free-shelf .story-card > :not(.card-image):not(.card-title) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .mobile-free-shelf .card-image { display: block; width: 100%; height: auto; aspect-ratio: auto; border-radius: 13px 13px 0 0; overflow: hidden; background: transparent; }
  .mobile-free-shelf .card-image img { display: block; width: 100%; height: auto; object-fit: initial; }
  .mobile-free-shelf .card-title { margin: 0; padding: 0 .45rem .55rem; font-size: 1rem; line-height: 1.25; font-weight: 800; overflow-wrap: break-word; }
  .mobile-free-shelf.has-controls { position: relative; }
  .mobile-free-shelf.has-controls .home-shelf-controls:not([hidden]) { display: contents; }
  .mobile-free-shelf.has-controls .home-shelf-controls button { position: absolute; top: clamp(5.5rem,27vw,9rem); z-index: 2; width: 2.25rem; height: 2.75rem; background: rgba(255,255,255,.94); }
  .mobile-free-shelf.has-controls [data-shelf-prev] { left: 0; }
  .mobile-free-shelf.has-controls [data-shelf-next] { right: 0; }
}

/* Two roomier Premium cards on phones, without excessively tall cover frames. */
@media (max-width: 600px) {
  .home-page #premium-home-shelf .shop-grid,
  .mobile-premium-shelf .shop-grid { grid-auto-columns: calc((100% - .5rem) / 2); }
  .home-page #premium-home-shelf .shop-cover-link,
  .mobile-premium-shelf .shop-cover-link { display: flex; justify-content: center; align-items: center; background: var(--surface-2); }
  .home-page #premium-home-shelf .shop-cover,
  .mobile-premium-shelf .shop-cover { width: auto; max-width: 100%; height: auto; max-height: 9.5rem; aspect-ratio: auto; object-fit: contain; }
}

/* Give Premium titles more room on phones without changing cover size. */
@media (max-width: 600px) {
  .home-page .home-shelf:has(#premium-home-shelf),
  .mobile-premium-shelf { width: calc(100vw - .3rem); margin-left: calc(50% - 50vw + .15rem); margin-right: 0; }
  .home-page .home-shelf.has-controls:has(#premium-home-shelf),
  .mobile-premium-shelf.has-controls { display: block; position: relative; }
  .home-page .home-shelf.has-controls:has(#premium-home-shelf) .home-shelf-controls button,
  .mobile-premium-shelf.has-controls .home-shelf-controls button {
    position: absolute; top: clamp(5.5rem, 27vw, 9rem); z-index: 2;
    width: 2.25rem; height: 2.75rem; background: rgba(255,255,255,.94);
  }
  .home-page .home-shelf.has-controls:has(#premium-home-shelf) [data-shelf-prev],
  .mobile-premium-shelf.has-controls [data-shelf-prev] { left: 0; }
  .home-page .home-shelf.has-controls:has(#premium-home-shelf) [data-shelf-next],
  .mobile-premium-shelf.has-controls [data-shelf-next] { right: 0; }
}

/* Consistent, visible blue edges on public story and Premium cards everywhere. */
body:not(.is-admin) :is(.story-card, .shop-card) {
  border: 2px solid #7da8d6;
  border-radius: 14px;
  box-shadow: 0 2px 7px rgba(11, 42, 85, .1);
}
body:not(.is-admin) :is(.story-card, .shop-card):hover { border-color: #1765b4; }
