/* The BattleStories website (generated pages, site/web/generate.ts). Mobile first, and as plain
   as the app: the paintings carry the color, the type stays quiet, one button per screen.
   Redesigned 2026-11-11 to match the app's Home and storyline screens. */

@font-face { font-family: 'Oswald'; src: url('fonts/oswald-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 200 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/inter-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #080a0f;
  --surface: #141923;
  --line: #222a36;
  --ivory: #f7f5f0;
  --slate: #a9b3c2;
  --gold: #ffc95c;
  --ink: #101114;
  --display: 'Oswald', Impact, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --pad: clamp(20px, 5vw, 40px);
  --wide: 68rem;
  --measure: 40rem;
  --radius: 22px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ivory); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:where(a, button):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
main > * { max-width: var(--wide); margin-left: auto; margin-right: auto; }

/* ---------- Top bar and footer ---------- */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: max(env(safe-area-inset-top), 14px) var(--pad) 14px; background: rgba(8, 10, 15, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.02em; text-transform: uppercase; text-decoration: none; }
.bar nav { display: flex; gap: 22px; }
.bar nav a { font-size: 0.9375rem; font-weight: 500; text-decoration: none; color: var(--slate); }
.bar nav a:hover { color: var(--ivory); }
/* On a wide screen the bar lines up with the content column. */
.bar { padding-inline: max(var(--pad), calc((100% - var(--wide)) / 2 + var(--pad))); }

.foot { max-width: var(--wide); margin: 72px auto 0; padding: 28px var(--pad) max(env(safe-area-inset-bottom), 32px); color: var(--slate); font-size: 0.8125rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ivory); }

/* ---------- Shared ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 28px; border-radius: 999px; background: var(--ivory); color: var(--ink); font-weight: 600; font-size: 1.0625rem; text-decoration: none; transition: transform 0.15s; }
.button:active { transform: scale(0.98); }
.button[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.button-wide { width: 100%; }
@media (min-width: 900px) { .button-wide { width: auto; min-width: 280px; } }
.button .lock { width: 16px; height: 16px; }
.lock { display: inline-block; width: 14px; height: 14px; vertical-align: -1px; margin-left: 4px; color: var(--slate); }
.free { display: inline-block; padding: 4px 9px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; vertical-align: 2px; }
.line { font-size: 1.125rem; line-height: 1.4; color: rgba(247, 245, 240, 0.9); margin-top: 10px; }
.meta { font-size: 0.875rem; color: var(--slate); margin-bottom: 10px; }
.meta a { text-decoration: none; font-weight: 600; color: var(--ivory); }
.small { font-size: 0.875rem; color: var(--slate); margin-top: 14px; }
.muted { color: var(--slate); font-weight: 400; }
.more { display: inline-block; margin-top: 14px; color: var(--slate); font-weight: 500; font-size: 0.9375rem; }
.page-head { padding: 20px var(--pad) 0; }
.page-head h1, .intro { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2rem, 7vw, 3rem); line-height: 1.02; }
.shelf, .chapters, .related { padding: 36px var(--pad) 0; }
.shelf h2, .chapters h2, .related h2 { font-size: 1.1875rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 14px; }

/* ---------- Home: the intro line and the hero card ---------- */
.intro { padding: 8px var(--pad) 16px; font-size: clamp(1.5rem, 5.5vw, 2.25rem); max-width: var(--wide); }
.feature-card { position: relative; margin: 0 var(--pad); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
@media (min-width: 1150px) { .feature-card { margin: 0 auto; max-width: calc(var(--wide) - 2 * var(--pad)); } }
.feature-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.feature-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8, 10, 15, 0.92) 0%, rgba(8, 10, 15, 0.6) 32%, transparent 60%); pointer-events: none; }
.feature-text { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 24px; }
.feature-text .years { font-size: 0.8125rem; font-weight: 600; color: rgba(247, 245, 240, 0.75); }
.feature-text h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.5rem, 11vw, 4.5rem); line-height: 0.98; margin-top: 4px; }
.feature-text .button { margin-top: 20px; }
@media (min-width: 900px) {
  .feature-card img { aspect-ratio: 16 / 8; }
  .feature-card::after { background: linear-gradient(to top, rgba(8, 10, 15, 0.9) 0%, rgba(8, 10, 15, 0.45) 35%, transparent 65%), linear-gradient(to right, rgba(8, 10, 15, 0.5) 0%, transparent 50%); }
  .feature-text { padding: 40px; max-width: 40rem; }
}

/* ---------- Storyline cards ---------- */
.posters { list-style: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 40%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--pad); scrollbar-width: none; }
.posters::-webkit-scrollbar { display: none; }
.posters li { scroll-snap-align: start; }
@media (min-width: 700px) { .posters { margin: 0; padding: 0; grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; } }
@media (min-width: 1000px) { .posters { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.posters-grid { margin: 0; padding: 0; grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
@media (min-width: 700px) { .posters-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .posters-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.poster { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; text-decoration: none; background: var(--surface); }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.poster:hover img { transform: scale(1.03); }
.poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.88), transparent 55%); }
.poster .free { position: absolute; z-index: 1; top: 10px; right: 10px; }
.poster-text { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 12px; }
.poster-title { display: block; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(1.1rem, 4.4vw, 1.4rem); line-height: 1; overflow-wrap: anywhere; }
.poster-years { display: block; margin-top: 6px; font-size: 0.75rem; color: rgba(255, 255, 255, 0.72); }

/* ---------- Plain lists of links ---------- */
.questions { list-style: none; margin: 0; padding: 0; }
.questions li { border-top: 1px solid var(--line); }
.questions li:last-child { border-bottom: 1px solid var(--line); }
.questions a { display: block; padding: 14px 0; font-weight: 600; line-height: 1.35; text-decoration: none; }
.questions a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Storyline and chapter top: painting, title, one line, one button ---------- */
.top { position: relative; }
.top-art { position: relative; }
.top-art img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.top-art::after { content: ''; position: absolute; inset: -1px 0; background: linear-gradient(to top, var(--bg) 0%, rgba(8, 10, 15, 0.5) 22%, transparent 45%); }
.top-text { position: relative; z-index: 1; margin-top: -72px; padding: 0 var(--pad); }
.top h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.6rem, 12vw, 4.25rem); line-height: 0.98; }
.top .button { margin-top: 22px; }
@media (min-width: 900px) {
  /* A portrait painting: words on the left, the painting on the right. */
  .top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 40%); align-items: center; gap: 56px; padding: 32px var(--pad) 0; }
  .top-art { grid-column: 2; }
  .top-art img { aspect-ratio: 9 / 16; max-height: 72vh; width: auto; margin-left: auto; border-radius: var(--radius); }
  .top-art::after { display: none; }
  .top-text { grid-column: 1; grid-row: 1; margin: 0; padding: 0; }
  /* A wide painting: full width, words over its lower left. */
  .top-wide { display: block; padding: 24px var(--pad) 0; }
  .top-wide .top-art img { aspect-ratio: 16 / 8; width: 100%; max-height: none; border-radius: var(--radius); }
  .top-wide .top-art::after { display: block; inset: 0; border-radius: var(--radius); background: linear-gradient(to top, rgba(8, 10, 15, 0.92) 0%, rgba(8, 10, 15, 0.5) 38%, transparent 68%), linear-gradient(to right, rgba(8, 10, 15, 0.6) 0%, transparent 55%); }
  .top-wide .top-text { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6); }
  .top-wide .top-text { position: absolute; left: var(--pad); bottom: 0; padding: 40px; max-width: 40rem; }
}

/* ---------- Chapter list, as in the app ---------- */
.chapter-set { margin: 28px 0 12px; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.65; }
.chapter-set:first-of-type { margin-top: 8px; }
.chapter-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
@media (min-width: 900px) { .chapter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 40px; } }
.chapter { display: flex; gap: 16px; align-items: flex-start; text-decoration: none; }
.chapter img { width: 92px; height: 92px; flex-shrink: 0; object-fit: cover; border-radius: 16px; background: var(--surface); transition: opacity 0.2s; }
.chapter:hover img { opacity: 0.85; }
.chapter-text { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.chapter-title { font-weight: 650; font-size: 1.0625rem; line-height: 1.25; }
.chapter-hook { font-size: 0.9375rem; line-height: 1.4; color: var(--slate); margin-top: 4px; }

/* ---------- Chapter page extras ---------- */
.more-art { padding: 36px var(--pad) 0; }
.strip { list-style: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 40%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--pad); scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip li { scroll-snap-align: start; position: relative; }
.strip img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 16px; background: var(--surface); }
@media (min-width: 900px) { .strip { margin: 0; padding: 0; grid-auto-columns: minmax(0, 1fr); overflow: visible; } .more-art .strip { grid-template-columns: repeat(3, minmax(0, 220px)); grid-auto-flow: row; } }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 28px var(--pad) 0; }
.pager a { display: flex; flex-direction: column; padding: 14px 16px; border-radius: 16px; background: var(--surface); text-decoration: none; font-weight: 600; line-height: 1.25; }
.pager a span { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--slate); margin-bottom: 4px; }
.pager-next { text-align: right; grid-column: 2; }

/* ---------- Articles ---------- */
.article { max-width: var(--measure); padding: 24px var(--pad) 0; }
.crumbs { font-size: 0.875rem; color: var(--slate); margin-bottom: 12px; }
.crumbs a { text-decoration: none; }
.article h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 8vw, 2.875rem); line-height: 1.06; }
.article h2 { font-size: 1.3125rem; font-weight: 700; letter-spacing: -0.01em; margin: 36px 0 10px; line-height: 1.25; }
.article p { margin: 0 0 16px; line-height: 1.65; }
.article ul { margin: 0 0 16px; padding-left: 22px; line-height: 1.6; }
.article li { margin-bottom: 6px; }
.article-art { margin: 0 0 28px; }
.article-art img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; }
.article-art figcaption, .diagram figcaption { font-size: 0.8125rem; color: var(--slate); margin-top: 8px; line-height: 1.45; }
.diagram { margin: 28px 0; }
.diagram img { width: 100%; border-radius: 16px; background: var(--surface); }
.diagram figcaption strong { display: block; color: var(--ivory); font-weight: 650; margin-bottom: 2px; }
.sources ul { color: var(--slate); font-size: 0.9375rem; }
.article .related { padding: 12px 0 0; }
.invite { margin: 32px 0; }
.invite a { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--surface); text-decoration: none; }
.invite img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.invite-text { display: flex; flex-direction: column; padding: 18px 20px 22px; }
.invite-kicker { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--slate); }
.invite-title { font-family: var(--display); font-weight: 700; font-size: 1.75rem; text-transform: uppercase; line-height: 1.02; margin-top: 6px; }
.invite-hook { font-size: 1rem; line-height: 1.4; margin-top: 6px; color: rgba(247, 245, 240, 0.88); }
.invite .button { margin-top: 16px; align-self: flex-start; }
@media (min-width: 700px) { .invite a { flex-direction: row; } .invite img { width: 40%; aspect-ratio: 3 / 4; } .invite-text { justify-content: center; } }

/* ---------- History index ---------- */
.article-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 700px) { .article-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.article-card { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 18px; background: var(--surface); text-decoration: none; font-weight: 600; line-height: 1.3; }
.article-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }

/* ---------- Premium ---------- */
.premium { max-width: 44rem; padding: 24px var(--pad) 0; text-align: center; }
.premium h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.2rem, 9vw, 3.5rem); line-height: 1; margin-top: 28px; }
.premium .button { margin-top: 26px; }
.premium .strip { text-align: left; grid-auto-columns: minmax(110px, 30%); }
@media (min-width: 900px) { .premium .strip { grid-auto-columns: minmax(0, 1fr); } }
.strip-covers span { position: absolute; left: 10px; right: 10px; bottom: 10px; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 0.95rem; line-height: 1; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.purchased { margin-top: 24px; font-size: 1.125rem; font-weight: 600; }

@media (prefers-reduced-motion: reduce) { .poster img, .button { transition: none; } }

/* ---------- Support, privacy and terms ---------- */
.legal-page { max-width: var(--measure); margin: 0 auto; padding: 24px var(--pad) 0; }
.legal h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2rem, 8vw, 2.875rem); line-height: 1.04; }
.legal h2 { font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.01em; margin: 34px 0 8px; line-height: 1.3; }
.legal p { margin: 0 0 14px; line-height: 1.65; color: rgba(247, 245, 240, 0.88); }
.legal .legal-updated { color: var(--slate); margin-top: 10px; }
.legal a { color: var(--gold); overflow-wrap: anywhere; }

/* ---------- Not found ---------- */
.missing { padding: 64px var(--pad) 0; text-align: center; }
.missing h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.2rem, 9vw, 3.5rem); line-height: 1; }
.missing .line { margin: 12px auto 26px; max-width: 26rem; }

/* A chapter title's last word and its lock or Free pill never split across lines. */
.tail { white-space: nowrap; }

/* Short pages keep the footer at the bottom of the window. */
body { min-height: 100svh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }

/* ---------- Article formatting: subheads, numbered steps ---------- */
.article h3 { font-size: 1.0625rem; font-weight: 700; margin: 24px 0 6px; line-height: 1.3; color: var(--ivory); }
.article ol { margin: 0 0 18px; padding-left: 24px; line-height: 1.6; }
.article ol li { margin-bottom: 8px; padding-left: 4px; }
.article ul li::marker { color: var(--slate); }

/* ---------- Web paywall: plan cards and the unlocked state ---------- */
.plans { display: grid; gap: 12px; margin: 26px 0 0; text-align: left; }
@media (min-width: 560px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.plan { display: grid; gap: 4px; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ivory); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s; }
.plan[aria-checked="true"] { border-color: var(--ivory); }
.plan:hover { border-color: var(--slate); }
.plan-name { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate); display: flex; align-items: center; gap: 8px; }
.plan-price { font-size: 1.25rem; font-weight: 700; }
.plan-sub { font-size: 0.9375rem; color: var(--slate); min-height: 1.4em; }
.plan + .plan { margin: 0; }
.premium .plans + .button { margin-top: 20px; }
.small[data-tone="error"] { color: #ff9b8a; }
.purchased { margin-top: 28px; }
.purchased p { font-size: 1.1875rem; font-weight: 600; margin-bottom: 18px; }

body > .foot { width: 100%; }
