/* ──────────────────────────────────────────────────────────────────────────
   Literary reading theme — WHITE background, refined SERIF.
   Per reader-ux.md §5: the HTML reading view is ALWAYS white; the typeface
   reflects the title's character — serif for classical/literary magazines
   (Strong Words, LRB, Granta), sans for modern titles.
   Type: Source Serif 4 (modern, screen-legible serif). Clean, contemporary,
   literary — no sepia, no fust.  Styles every class the converted HTML emits.
   ────────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,500;1,8..60,600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@1,6..72,400;1,6..72,500&display=swap');

:root {
  --bg: #ffffff;
  --ink: #18181b;
  --ink-soft: #3f3f46;
  --muted: #71717a;
  --faint: #fafafa;
  --rule: #e5e5e5;
  --accent: #18181b;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

/* ──────────────────────────────────────────────────────────────────────────
   GLOBAL archetype font. The whole reader (feed chrome, Discover/contents,
   cards, archive, reading view) inherits ONE font per active issue archetype,
   set via data-archetype on the App root:
     editorial-literary → Source Serif 4 (serif)
     industrial-trade   → Inter (sans)
   Components no longer hardcode a family; they inherit this and only pin
   weight/size. Monospace meta tags opt back out explicitly below.
   ────────────────────────────────────────────────────────────────────────── */
[data-archetype="editorial-literary"] {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}
[data-archetype="industrial-trade"] {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
/* Headings, body, chrome inherit the archetype font from the root. */
[data-archetype] h1,
[data-archetype] h2,
[data-archetype] h3,
[data-archetype] h4,
[data-archetype] p,
[data-archetype] span,
[data-archetype] button,
[data-archetype] input,
[data-archetype] li,
[data-archetype] .card-headline,
[data-archetype] .card-quote-text,
[data-archetype] .card-stat-number,
[data-archetype] .article-body-text {
  font-family: inherit;
}
/* Monospace meta tags keep their typewriter face regardless of archetype. */
[data-archetype] .meta-tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

article {
  max-width: 38rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  /* Pin font/bg so the design holds when injected into the app shell */
  font-family: var(--serif);
  background: var(--bg);
  color: var(--ink);
}
article, article p, article li, article dd, article dt, article span,
article h1, article h2, article h3, article h4, article blockquote,
article figcaption, article cite, article .kicker, article .byline {
  font-family: var(--serif);
}

/* ── Header block ────────────────────────────────────────────────────────── */
.kicker, .sidebar-kicker, h3, .toc-section, .cover-label, .capsule-meta, .pb-key {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-feature-settings: "smcp" 0;
}
.kicker { margin: 0 0 0.85rem; }

h1 {
  font-size: clamp(2.1rem, 8.5vw, 2.9rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0 0 1rem;
  color: var(--ink);
}
h1 em { font-style: italic; font-weight: 600; }

.standfirst, .lede {
  font-size: 1.3rem;
  line-height: 1.5;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
}

.byline, .meta, .issue-meta {
  font-size: 0.9rem;
  font-weight: 500;
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}
.byline {
  margin: 0 0 2.25rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule);
}

/* ── Body ────────────────────────────────────────────────────────────────── */
p { margin: 0 0 1.25rem; }
em { font-style: italic; }
strong { font-weight: 700; }

h2 {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  line-height: 1.24;
  margin: 2.75rem 0 0.7rem;
  color: var(--ink);
}
h3 { margin: 2.25rem 0 0.55rem; }
h4 {
  font-size: 1.05rem; font-weight: 700;
  margin: 1.6rem 0 0.45rem; color: var(--ink);
}

a { color: var(--accent); text-underline-offset: 2px; }

section { margin: 2.5rem 0 0; }
section + section { border-top: 1px solid var(--rule); padding-top: 2rem; }

/* ── Pull quotes — Newsreader italic, 3px terracotta left rule (brand §8.2) ─ */
blockquote.pullquote {
  margin: 2.5rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border: 0;
  border-left: 3px solid #D65A3A;
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1.36;
  font-weight: 500;
  letter-spacing: -0.008em;
  color: var(--ink);
}
blockquote.pullquote cite, cite {
  display: block;
  margin-top: 0.9rem;
  font-style: normal;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

/* ── Images / placeholders ──────────────────────────────────────────────── */
figure.image-placeholder, figure.cover-placeholder, figure.cover-feature-image {
  margin: 2.25rem 0;
  padding: 0;
  background: var(--faint);
  border: 1px solid var(--rule);
  border-radius: 10px;
  aspect-ratio: 3 / 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  overflow: hidden;
}
figure.image-placeholder::before {
  content: "Image";
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: #bcbcc2;
}
figure.image-placeholder figcaption, figure.cover-placeholder figcaption {
  margin: 0.7rem 1.25rem 0;
  font-size: 0.95rem; line-height: 1.4; font-style: italic; color: var(--muted);
}

/* ── Sidebars ────────────────────────────────────────────────────────────── */
aside.sidebar, aside.operator-bio, .press-quotes {
  margin: 2.5rem 0;
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--faint);
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.sidebar-kicker { display: block; margin: 0 0 0.45rem; color: var(--muted); }
.sidebar-title { font-size: 1.2rem; font-weight: 600; margin: 0 0 0.3rem; color: var(--ink); }
.sidebar-meta, .pb-meta, .capsule-meta, .item-desc { font-size: 0.9rem; font-style: italic; color: var(--muted); margin: 0 0 0.7rem; }
aside.operator-bio .name { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.2rem; }
aside.operator-bio .role { color: var(--muted); margin: 0; }

/* ── Paperback / capsule list patterns ──────────────────────────────────── */
dl.pb-pattern { margin: 1.4rem 0; padding: 0; }
dl.pb-pattern dt, .paperback dt {
  font-weight: 700; font-size: 1.1rem; margin: 1.4rem 0 0.1rem; color: var(--ink);
}
dl.pb-pattern dd, .paperback dd { margin: 0 0 0.35rem; }
.pb-meta, .pb-key { display: block; }
.paperback, .capsule {
  margin: 1.6rem 0; padding: 1.4rem 0 0; border-top: 1px solid var(--rule);
}
.capsule-num, .page-num, .capsule-meta { color: var(--muted); }
.capsule-num, .page-num { font-size: 0.85rem; font-weight: 700; }
.item-title { font-weight: 600; color: var(--ink); }
.item-body { margin: 0.3rem 0 0; }

/* ── Contents / TOC ─────────────────────────────────────────────────────── */
.toc-section { display: block; margin: 1.9rem 0 0.7rem; color: var(--muted); }
.toc-item {
  display: flex; gap: 0.75rem; align-items: baseline;
  padding: 0.65rem 0; border-bottom: 1px solid var(--rule);
}
.toc-page, .toc-item .page-num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2ch; }

/* ── Cover article bits ─────────────────────────────────────────────────── */
.cover-hero, .cover { text-align: left; }
.cover-edition, .issue-meta { color: var(--muted); }
.sell { font-size: 1.3rem; font-style: italic; line-height: 1.4; color: var(--ink-soft); }
.delon { font-size: clamp(2.6rem, 12vw, 4.2rem); font-weight: 600; letter-spacing: -0.02em; margin: 0.4rem 0; }
.promise { font-size: 1.15rem; font-style: italic; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 1.4rem; }
.cover-label { display: block; margin-bottom: 0.4rem; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.section-break { text-align: center; margin: 2.4rem 0; color: #cfcfd4; letter-spacing: 0.6em; }

footer.article-foot {
  margin-top: 3.25rem; padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem; font-style: italic; color: var(--muted);
}

/* ──────────────────────────────────────────────────────────────────────────
   In-app reading-view shell. The <article class="reading-view"> rendered by
   ArticleSlideUp carries data-archetype; the WHITE background is always on,
   only the typeface + accents change per genre.
   ────────────────────────────────────────────────────────────────────────── */
article.reading-view {
  max-width: 38rem;
  margin: 0 auto;
  background: #ffffff;        /* WHITE — both archetypes */
  color: var(--ink);
}
article.reading-view .reading-body { margin-top: 1.5rem; }

/* Reading-view rhythm — high-specificity so it beats Tailwind's preflight reset
   (which zeroes h2/p margins, making subheadings run into the body). */
article.reading-view .reading-body p { margin: 0 0 1.15rem; }
article.reading-view .reading-body h2 {
  margin: 2.4rem 0 0.6rem;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
article.reading-view .reading-body h3 { margin: 1.9rem 0 0.5rem; }
article.reading-view .reading-body > :first-child { margin-top: 0; }

/* Quote-only columns (Facts of Life, Two Minutes Hate, testimonials): each
   verbatim quote renders as a body block. Neutral palette — grey rule, no
   brand colour; imagery (none here) is the only source of colour. */
article.reading-view .reading-body blockquote.reading-pullquote {
  margin: 0 0 1.9rem;
  padding: 0 0 0 1.1rem;
  border: 0;
  border-left: 3px solid #d4d4d8;
  color: var(--ink);
}
article.reading-view .reading-body blockquote.reading-pullquote p {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.005em;
}
article.reading-view .reading-body blockquote.reading-pullquote cite {
  display: block;
  margin-top: 0.55rem;
  font-style: normal;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

/* Neutral in-body article image — full content width, white reading view,
   no coloured borders. Applies to both archetypes. */
article.reading-view .reading-image {
  width: 100%;
  margin: 1.75rem 0;
  border-radius: 10px;
  background: #ffffff;
}
article.reading-view .reading-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* ──────────────────────────────────────────────────────────────────────────
   ARCHETYPE: industrial-trade — WHITE background + crisp modern SANS (Inter).
   Steel-blue / amber accents. Mirrors every class the literary theme styles
   (kicker, standfirst, byline, h1/h2, pullquote, image-placeholder,
   article-foot, etc.) but sans-serif.
   ────────────────────────────────────────────────────────────────────────── */
:root {
  --ind-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Neutral grey only — the ONLY difference between archetypes is the font. */
  --ind-steel: #71717a;
  --ind-amber: #71717a;
  --ind-slate: #71717a;
  --ind-ink: #18181b;
  --ind-ink-soft: #3f3f46;
  --ind-muted: #71717a;
}

[data-archetype="industrial-trade"] {
  background: #ffffff;        /* WHITE — never sepia */
  color: var(--ind-ink);
}

[data-archetype="industrial-trade"],
[data-archetype="industrial-trade"] p,
[data-archetype="industrial-trade"] li,
[data-archetype="industrial-trade"] span,
[data-archetype="industrial-trade"] h1,
[data-archetype="industrial-trade"] h2,
[data-archetype="industrial-trade"] h3,
[data-archetype="industrial-trade"] h4,
[data-archetype="industrial-trade"] blockquote,
[data-archetype="industrial-trade"] figcaption,
[data-archetype="industrial-trade"] cite,
[data-archetype="industrial-trade"] .kicker,
[data-archetype="industrial-trade"] .standfirst,
[data-archetype="industrial-trade"] .byline {
  font-family: var(--ind-sans);
}

[data-archetype="industrial-trade"] .kicker {
  color: var(--ind-steel);
  font-weight: 700;
  letter-spacing: 0.12em;
}

[data-archetype="industrial-trade"] h1 {
  color: var(--ind-ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}
[data-archetype="industrial-trade"] h1 em { font-style: normal; }

[data-archetype="industrial-trade"] .standfirst,
[data-archetype="industrial-trade"] .lede {
  font-style: normal;          /* sans standfirst reads cleaner upright */
  font-weight: 400;
  color: var(--ind-ink-soft);
  font-size: 1.2rem;
  line-height: 1.5;
}

[data-archetype="industrial-trade"] .byline {
  color: var(--ind-muted);
  font-weight: 500;
}

[data-archetype="industrial-trade"] h2,
[data-archetype="industrial-trade"] h3,
[data-archetype="industrial-trade"] h4 {
  color: var(--ind-ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}

[data-archetype="industrial-trade"] p { color: var(--ind-ink-soft); }

[data-archetype="industrial-trade"] blockquote.pullquote {
  font-style: italic;
  font-weight: 600;
  border-left: 3px solid #D65A3A;
  color: var(--ind-ink);
}
[data-archetype="industrial-trade"] blockquote.pullquote cite,
[data-archetype="industrial-trade"] cite {
  color: var(--ind-muted);
}

[data-archetype="industrial-trade"] a { color: var(--ind-steel); }

[data-archetype="industrial-trade"] figure.image-placeholder,
[data-archetype="industrial-trade"] figure.cover-placeholder {
  background: #f3f5f8;
  border-color: #d9dee6;
}
[data-archetype="industrial-trade"] figure.image-placeholder figcaption,
[data-archetype="industrial-trade"] figure.cover-placeholder figcaption {
  font-style: normal;
  color: var(--ind-muted);
}

[data-archetype="industrial-trade"] aside.operator-bio,
[data-archetype="industrial-trade"] aside.sidebar {
  background: #f3f5f8;
  border-color: #d9dee6;
}

[data-archetype="industrial-trade"] .section-break { color: var(--ind-amber); }

[data-archetype="industrial-trade"] footer.article-foot {
  font-style: normal;
  color: var(--ind-muted);
}

/* ── Read | Original toggle (neutral pill, two segments) ────────────────── */
.orig-toggle {
  display: inline-flex;
  background: #f1f1f3;
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.orig-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  color: #71717a;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.orig-toggle button.active {
  background: #18181b;
  color: #ffffff;
}

/* ── Original magazine page images (lazy, full content width) ───────────── */
.original-pages {
  background: #ffffff;
  padding: 12px 16px 32px;
}
.original-pages figure {
  margin: 0 0 16px;
}
.original-pages img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #ffffff;
}
.original-pages figcaption {
  margin-top: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  color: #80838c;
  text-align: center;
}

/* ── In-feed ad card — show the WHOLE advert, never cropped ──────────────── */
.ad-card-contain {
  background: #18181b; /* neutral charcoal letterbox */
}
.ad-card-contain img {
  object-fit: contain; /* the entire advert is visible, letterboxed as needed */
  width: 100%;
  height: 100%;
  display: block;
}

/* SPONSORED disclosure pill (ASA UK) — neutral, used in feed + full-screen */
.ad-sponsored-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fafafa;
  border: 1px solid rgba(255, 255, 255, 0.20);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ── Full-screen advert view — fit-to-width, scroll to read it all ──────── */
.ad-view {
  position: absolute;
  top: 6%;
  left: 0;
  right: 0;
  bottom: 0;
  background: #18181b;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.ad-view-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #18181b;
  border-bottom: 1px solid #27272a;
}
.ad-view-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fafafa;
}
.ad-view-body {
  background: #ffffff; /* neutral white reading surface for the creative */
}
.ad-view-body img {
  width: 100%;
  height: auto;
  display: block; /* full advert, fit to width, taller-than-screen = scroll */
}
.ad-view-placeholder {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #18181b;
  padding: 0 24px;
  text-align: center;
}
.ad-view-placeholder-name {
  color: #fafafa;
  font-size: 1.5rem;
  font-weight: 700;
  max-width: 20ch;
}
.ad-view-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #18181b;
  border-top: 1px solid #27272a;
}
.ad-view-advertiser {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: #a1a1aa;
}
.ad-view-visit {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 9999px;
  background: #fafafa;
  color: #18181b;
  border: 1px solid #71717a;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
}
