/*
 * Code architect: Mark Bachman
 * Code generator: Gemini/Antigravity
 *
 * CODE DESCRIPTION
 * Centralized magazine theme and layout stylesheet.
 * Shared across the front page (index.html), all section pages, and every server-side rendered
 * article ({articleId}.html). Holds no magazine-specific text or colors: those come from
 * manifest.yaml.
 *
 * Default visual identity follows design/webapp-standards.md (Digibase OKLCH Glassmorphism:
 * Raleway body, Outfit headings, Inconsolata monospace, Dark/Light mode).
 * Supports live switching of:
 *   - Color mode:    html[data-theme="dark" | "light"]
 *   - Design theme:  html[data-mag-theme="digibase" | "editorial-print" | "avant-garde" | "botanical"]
 *   - Layout preset: html[data-mag-layout="magazine" | "broadsheet" | "minimal" | "gallery"]
 *
 * REVISION HISTORY
 * 20 Nov 2026 | Filename created
 * 21 Nov 2026 | Edit buttons for admins and the Join (newsletter) modal
 * 21 Nov 2026 | Site page window (About Us, legal notices)
 * 21 Nov 2026 | Disclosure line, sample statement, corrections and "last reviewed" on articles
 *
 */

/* ==========================================================================
   1. CORE DESIGN TOKENS — Default: Digibase Glass (Dark Mode)
   ========================================================================== */
:root {
  --font-primary: 'Raleway', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Inconsolata', monospace;

  --border-radius-card: 16px;
  --border-radius-input: 8px;
  --border-width: 1px;
  --card-shadow: 0 10px 30px -10px oklch(0.00% 0.000 0.0 / 0.18);
  --card-shadow-hover: 0 20px 40px -15px oklch(0.00% 0.000 0.0 / 0.32);
  --transition-speed: 0.25s;

  --brand-primary: oklch(75.70% 0.149 77.4);
  --brand-primary-hover: oklch(68.87% 0.135 78.3);
  --button-text: oklch(20.77% 0.040 265.8);
  --brand-danger: oklch(51.74% 0.169 30.0);
  --success: oklch(69.59% 0.149 162.5);

  --app-bg: oklch(20.77% 0.040 265.8);
  --surface-elevated: oklch(25.00% 0.038 263.0 / 0.88);
  --card-bg: oklch(27.95% 0.037 260.0 / 0.72);
  --input-bg: oklch(20.77% 0.040 265.8 / 0.82);
  --text-primary: oklch(98.42% 0.003 247.9);
  --text-muted: oklch(71.07% 0.035 256.8);
  --border-color: oklch(100.00% 0.000 89.2 / 0.11);
  --glass-border: oklch(100.00% 0.000 89.2 / 0.06);
  --focus-ring: oklch(75.70% 0.149 77.4 / 0.30);
  --code-bg: oklch(14.00% 0.020 260.0 / 0.88);
  --code-color: oklch(85.00% 0.130 145.0);

  --radial-highlight-1: oklch(75.70% 0.149 77.4 / 0.10);
  --radial-highlight-2: oklch(51.74% 0.169 30.0 / 0.09);
  --card-backdrop: blur(12px);
  --section-accent: var(--brand-primary);
  --container-max: 1180px;
}

/* Light Mode Overrides */
[data-theme="light"] {
  --app-bg: oklch(98.42% 0.003 247.9);
  --surface-elevated: oklch(100.00% 0.000 89.2 / 0.92);
  --card-bg: oklch(100.00% 0.000 89.2 / 0.86);
  --input-bg: oklch(96.83% 0.007 247.9 / 0.92);
  --text-primary: oklch(20.77% 0.040 265.8);
  --text-muted: oklch(44.55% 0.037 257.3);
  --border-color: oklch(0.00% 0.000 0.0 / 0.10);
  --glass-border: oklch(0.00% 0.000 0.0 / 0.07);
  --focus-ring: oklch(75.70% 0.149 77.4 / 0.22);
  --card-shadow: 0 10px 30px -10px oklch(0.00% 0.000 0.0 / 0.08);
  --radial-highlight-1: oklch(75.70% 0.149 77.4 / 0.05);
  --radial-highlight-2: oklch(51.74% 0.169 30.0 / 0.04);
}

/* ==========================================================================
   2. ALTERNATE MAGAZINE DESIGN THEMES (data-mag-theme)
   ========================================================================== */

/* Theme: Editorial Print */
[data-mag-theme="editorial-print"] {
  --font-display: 'Playfair Display', Georgia, serif;
  --border-radius-card: 3px;
  --border-radius-input: 3px;
  --card-backdrop: none;
  --app-bg: oklch(15.50% 0.008 60.0);
  --card-bg: oklch(19.00% 0.008 60.0);
  --surface-elevated: oklch(17.00% 0.008 60.0 / 0.96);
  --brand-primary: oklch(80.00% 0.110 72.0);
  --border-color: oklch(95.00% 0.010 80.0 / 0.18);
  --radial-highlight-1: transparent;
  --radial-highlight-2: transparent;
}
[data-mag-theme="editorial-print"][data-theme="light"] {
  --app-bg: oklch(96.80% 0.012 85.0);
  --card-bg: oklch(99.00% 0.006 85.0);
  --surface-elevated: oklch(97.50% 0.010 85.0 / 0.96);
  --text-primary: oklch(16.00% 0.010 50.0);
  --text-muted: oklch(42.00% 0.012 50.0);
  --brand-primary: oklch(46.00% 0.140 28.0);
  --button-text: oklch(98.50% 0.004 85.0);
  --border-color: oklch(16.00% 0.010 50.0 / 0.22);
}

/* Theme: Avant-Garde */
[data-mag-theme="avant-garde"] {
  --font-display: 'Outfit', sans-serif;
  --border-radius-card: 0px;
  --border-radius-input: 0px;
  --border-width: 2px;
  --app-bg: oklch(13.00% 0.015 280.0);
  --card-bg: oklch(18.00% 0.018 280.0 / 0.92);
  --surface-elevated: oklch(15.00% 0.016 280.0 / 0.95);
  --brand-primary: oklch(64.00% 0.220 26.0);
  --brand-primary-hover: oklch(58.00% 0.220 26.0);
  --button-text: oklch(98.50% 0.002 0.0);
  --border-color: oklch(95.00% 0.010 85.0 / 0.24);
  --radial-highlight-1: oklch(64.00% 0.220 26.0 / 0.13);
  --radial-highlight-2: oklch(78.00% 0.160 85.0 / 0.10);
}
[data-mag-theme="avant-garde"][data-theme="light"] {
  --app-bg: oklch(96.00% 0.005 90.0);
  --card-bg: oklch(100.00% 0.000 0.0);
  --surface-elevated: oklch(98.00% 0.004 90.0 / 0.96);
  --text-primary: oklch(12.00% 0.010 280.0);
  --border-color: oklch(12.00% 0.010 280.0 / 0.80);
  --brand-primary: oklch(55.00% 0.220 26.0);
}

/* Theme: Botanical Studio */
[data-mag-theme="botanical"] {
  --font-display: 'Playfair Display', Georgia, serif;
  --border-radius-card: 22px;
  --border-radius-input: 12px;
  --app-bg: oklch(19.50% 0.028 158.0);
  --card-bg: oklch(24.50% 0.026 158.0 / 0.80);
  --surface-elevated: oklch(21.50% 0.028 158.0 / 0.92);
  --brand-primary: oklch(76.00% 0.120 135.0);
  --brand-primary-hover: oklch(70.00% 0.120 135.0);
  --button-text: oklch(18.00% 0.025 158.0);
  --radial-highlight-1: oklch(72.00% 0.110 145.0 / 0.12);
  --radial-highlight-2: oklch(75.00% 0.120 75.0 / 0.08);
}
[data-mag-theme="botanical"][data-theme="light"] {
  --app-bg: oklch(96.20% 0.014 110.0);
  --card-bg: oklch(99.20% 0.008 110.0 / 0.92);
  --surface-elevated: oklch(97.50% 0.012 110.0 / 0.95);
  --text-primary: oklch(22.00% 0.032 155.0);
  --text-muted: oklch(44.00% 0.024 150.0);
  --brand-primary: oklch(46.00% 0.105 150.0);
  --button-text: oklch(98.50% 0.005 110.0);
  --border-color: oklch(22.00% 0.032 155.0 / 0.14);
}

/* ==========================================================================
   3. BASE & AMBIENT CANVAS
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--app-bg);
  background-image:
    radial-gradient(circle at 12% 8%, var(--radial-highlight-1) 0%, transparent 42%),
    radial-gradient(circle at 88% 18%, var(--radial-highlight-2) 0%, transparent 42%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ==========================================================================
   4. SHARED MASTHEAD & NAVIGATION
   ========================================================================== */
.mag-masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface-elevated);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: var(--border-width) solid var(--border-color);
}

.masthead-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.masthead-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.masthead-logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.masthead-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.wordmark-main {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.16em;
  color: var(--text-primary);
}

.wordmark-main span {
  color: var(--brand-primary);
}

.wordmark-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.masthead-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.masthead-nav a {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.42rem 0.75rem;
  border-radius: var(--border-radius-input);
  color: var(--text-muted);
  transition: all var(--transition-speed);
}

.masthead-nav a:hover,
.masthead-nav a.active {
  color: var(--text-primary);
  background: oklch(100.00% 0.000 0.0 / 0.07);
}

.masthead-nav a.active {
  color: var(--brand-primary);
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn,
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--text-primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-input);
  padding: 0.45rem 0.75rem;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.icon-btn:hover,
.pill-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.pill-btn-accent {
  background: var(--brand-primary);
  color: var(--button-text);
  border-color: transparent;
}

.pill-btn-accent:hover {
  background: var(--brand-primary-hover);
  color: var(--button-text);
}

/* ==========================================================================
   5. MAGAZINE MAIN CONTAINER & SECTION HERO
   ========================================================================== */
.mag-main {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 2.25rem 1.5rem 4rem;
}

.section-banner {
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
  border-bottom: var(--border-width) solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-primary);
  margin-bottom: 0.4rem;
}

.section-banner h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.section-tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0;
  max-width: 640px;
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mag-search-input {
  background: var(--input-bg);
  color: var(--text-primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-input);
  padding: 0.55rem 0.9rem;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  min-width: 220px;
  outline: none;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.mag-search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.tag-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.tag-filter {
  background: transparent;
  color: var(--text-muted);
  border: var(--border-width) solid var(--border-color);
  border-radius: 999px;
  padding: 0.28rem 0.78rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.tag-filter:hover,
.tag-filter.active {
  background: var(--brand-primary);
  color: var(--button-text);
  border-color: transparent;
}

/* ==========================================================================
   6. DIRECTORY LAYOUTS (magazine, broadsheet, minimal, gallery)
   ========================================================================== */
.directory-root {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* Default Layout: Magazine Grid */
.lead-story {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0;
  background: var(--card-bg);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-card);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed), border-color var(--transition-speed);
}

.lead-story:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--brand-primary);
}

.lead-thumb {
  aspect-ratio: 16 / 10;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
}

.lead-content h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
}

.lead-content p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.98rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-card);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed), border-color var(--transition-speed);
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--brand-primary);
}

.card-thumb-wrap {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: oklch(15.00% 0.020 260.0);
}

.card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.article-card:hover .card-thumb-wrap img {
  transform: scale(1.04);
}

.card-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.card-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-primary);
}

.card-body h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.card-body p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

/* Layout Override: Broadsheet */
[data-mag-layout="broadsheet"] .lead-story {
  grid-template-columns: 1fr 1fr;
}
[data-mag-layout="broadsheet"] .article-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: var(--border-width) solid var(--border-color);
  border-left: var(--border-width) solid var(--border-color);
}
[data-mag-layout="broadsheet"] .article-card {
  border-radius: 0;
  box-shadow: none;
  border: none;
  border-right: var(--border-width) solid var(--border-color);
  border-bottom: var(--border-width) solid var(--border-color);
}

/* Layout Override: Minimal Stream */
[data-mag-layout="minimal"] .lead-story {
  grid-template-columns: 1fr;
  max-width: 820px;
  margin: 0 auto;
}
[data-mag-layout="minimal"] .article-grid {
  grid-template-columns: 1fr;
  max-width: 820px;
  margin: 0 auto;
  gap: 1.25rem;
}
[data-mag-layout="minimal"] .article-card {
  flex-direction: row;
  align-items: stretch;
}
[data-mag-layout="minimal"] .card-thumb-wrap {
  width: 240px;
  min-width: 240px;
  aspect-ratio: auto;
}

/* Layout Override: Visual Gallery */
[data-mag-layout="gallery"] .article-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
[data-mag-layout="gallery"] .article-card {
  position: relative;
  min-height: 340px;
  justify-content: flex-end;
}
[data-mag-layout="gallery"] .card-thumb-wrap {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
}
[data-mag-layout="gallery"] .card-thumb-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.12) 0%, rgba(10, 14, 24, 0.88) 100%);
}
[data-mag-layout="gallery"] .card-body {
  position: relative;
  z-index: 2;
  color: #f8fafc;
}
[data-mag-layout="gallery"] .card-body p,
[data-mag-layout="gallery"] .card-meta {
  color: rgba(248, 250, 252, 0.82);
  border-top-color: rgba(255, 255, 255, 0.18);
}

/* Hub Section Blocks */
.hub-section-block {
  margin-top: 2.75rem;
}

.section-divider-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.35rem;
  border-bottom: var(--border-width) solid var(--border-color);
}

.section-divider-header h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
}

.section-more-link {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.section-more-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   7. SERVER-SIDE RENDERED ARTICLE PAGE ({articleId}.html)
   ========================================================================== */
.mag-article-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.crumb-section {
  color: var(--brand-primary);
  font-weight: 600;
}

.article-header {
  margin-bottom: 2rem;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  font-weight: 800;
  line-height: 1.12;
  margin: 0 0 0.85rem;
  letter-spacing: -0.02em;
}

.article-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.article-byline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.article-hero-figure {
  margin: 0 0 2.25rem;
}

.article-hero-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--border-radius-card);
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--card-shadow);
}

.article-hero-figure figcaption {
  margin-top: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}

.article-body {
  font-size: 1.08rem;
  line-height: 1.82;
}

.article-body p.lead {
  font-size: 1.22rem;
  line-height: 1.68;
  color: var(--text-primary);
  font-weight: 500;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  margin: 2.5rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2rem 0 0.65rem;
}

.article-body blockquote {
  margin: 2rem 0;
  padding: 1.15rem 1.5rem;
  border-left: 4px solid var(--brand-primary);
  background: var(--card-bg);
  border-radius: 0 var(--border-radius-input) var(--border-radius-input) 0;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-style: italic;
}

.article-body blockquote p {
  margin: 0;
}

.article-body pre {
  background: var(--code-bg);
  color: var(--code-color);
  border: 1px solid oklch(75.70% 0.149 77.4 / 0.25);
  border-radius: var(--border-radius-input);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.55;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: oklch(100.00% 0.000 0.0 / 0.08);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}

.article-body pre code {
  background: transparent;
  padding: 0;
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figure img,
.article-body video {
  border-radius: var(--border-radius-card);
  border: 1px solid var(--border-color);
}

.article-body .video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 2rem 0;
  border-radius: var(--border-radius-card);
  overflow: hidden;
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--card-shadow);
  background: oklch(14.00% 0.020 260.0);
}

.article-body .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: var(--border-width) solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-input);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-speed);
}

.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.article-id-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.related-section {
  margin-top: 3.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.related-card {
  background: var(--card-bg);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-card);
  overflow: hidden;
  transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.related-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-primary);
}

.related-thumb-wrap {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.related-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.related-card-body h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0;
}

.related-card-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* ==========================================================================
   8. DESIGN EXPLORER DRAWER & FOOTER
   ========================================================================== */
.explorer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: oklch(15.00% 0.030 265.0 / 0.45);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: flex-end;
}

.explorer-backdrop.open {
  display: flex;
}

.explorer-drawer {
  width: min(390px, 94vw);
  height: 100%;
  background: var(--surface-elevated);
  border-left: 1px solid var(--border-color);
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.explorer-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 0;
}

.explorer-group h3 {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}

.explorer-options {
  display: grid;
  gap: 0.55rem;
}

.explorer-option {
  text-align: left;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-input);
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition-speed);
}

.explorer-option strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.92rem;
}

.explorer-option span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.explorer-option.active,
.explorer-option:hover {
  border-color: var(--brand-primary);
}

.mag-footer {
  border-top: var(--border-width) solid var(--border-color);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a:hover {
  color: var(--brand-primary);
}

.empty-state {
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-card);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */
@media (max-width: 860px) {
  .lead-story,
  [data-mag-layout="broadsheet"] .lead-story {
    grid-template-columns: 1fr;
  }
  [data-mag-layout="broadsheet"] .article-grid {
    grid-template-columns: 1fr;
  }
  [data-mag-layout="minimal"] .article-card {
    flex-direction: column;
  }
  [data-mag-layout="minimal"] .card-thumb-wrap {
    width: 100%;
    min-width: 0;
    aspect-ratio: 16 / 10;
  }
}

/* ==========================================================================
   10. FULLSCREEN READING MODE & TAP HOTSPOTS
   ========================================================================== */
html.mag-fullscreen .mag-masthead {
  display: none;
}

html.mag-fullscreen,
html.mag-fullscreen body {
  touch-action: manipulation;
}

html.mag-fullscreen .mag-article-shell {
  padding-top: 2rem;
}

.fs-hotspot {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  height: 30vh;
  height: 30dvh;
  z-index: 80;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.fs-hotspot-top {
  top: 0;
}

.fs-hotspot-bottom {
  bottom: 0;
}

html.mag-fullscreen .fs-hotspot {
  display: block;
}

.fs-exit-btn {
  display: none;
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 95;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  color: var(--text-muted);
  border: var(--border-width) solid var(--border-color);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
  touch-action: manipulation;
}

.fs-exit-btn:hover,
.fs-exit-btn:focus-visible {
  opacity: 1;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

html.mag-fullscreen .fs-exit-btn {
  display: inline-flex;
}

.fs-hint-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 96;
  pointer-events: none;
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.35s ease;
  text-align: center;
  max-width: 90vw;
}

.fs-hint-toast.visible {
  opacity: 0.94;
}

/* ==========================================================================
   11. EDIT BUTTONS (readers signed in with the admin role)
   ========================================================================== */
.has-edit-btn {
  position: relative;
}

.card-edit-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 3;
  background: var(--brand-primary);
  color: var(--button-text);
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 2px 10px oklch(0.00% 0.000 0.0 / 0.35);
  transition: background var(--transition-speed), transform var(--transition-speed);
}

.card-edit-btn:hover {
  background: var(--brand-primary-hover);
  transform: scale(1.06);
}

.article-edit-btn {
  margin-left: auto;
  padding: 0.3rem 0.9rem;
}

html.mag-fullscreen .card-edit-btn,
html.mag-fullscreen .article-edit-btn {
  display: none;
}

/* ==========================================================================
   12. JOIN (newsletter sign-up) MODAL
   ========================================================================== */
.join-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: oklch(15.00% 0.030 265.0 / 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.join-backdrop.open {
  display: flex;
}

.join-modal {
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--surface-elevated);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-card);
  box-shadow: var(--card-shadow-hover);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.join-text {
  margin: 0.4rem 0 0.35rem;
  color: var(--text-primary);
  font-size: 0.98rem;
}

.join-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.join-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 1rem;
}

/* Honeypot: people never see or fill this field */
.join-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.join-privacy {
  margin: 0.5rem 0 0;
  padding: 0.7rem 0.85rem;
  border: var(--border-width) solid var(--border-color);
  border-left: 3px solid var(--success);
  border-radius: var(--border-radius-input);
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.join-privacy strong {
  color: var(--text-primary);
}

.join-status {
  min-height: 1.2em;
  font-size: 0.86rem;
  color: oklch(64.00% 0.190 28.0);
}

.join-status.ok {
  color: var(--success);
}

.join-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ==========================================================================
   13. ARTICLE DISCLOSURE, CORRECTIONS & LAST REVIEWED
   ========================================================================== */
.article-disclosure {
  margin: 1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.article-notes {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.article-notes p {
  margin: 0;
}

.article-corrections {
  padding: 0.75rem 0.9rem;
  border: var(--border-width) solid var(--border-color);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--border-radius-input);
}

.article-corrections strong {
  color: var(--text-primary);
}

.article-corrections ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.article-reviewed {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ==========================================================================
   14. SITE PAGE WINDOW (About Us, legal notices)
   ========================================================================== */
html.mag-page-open,
html.mag-page-open body {
  overflow: hidden;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  z-index: 96;
  background: oklch(15.00% 0.030 265.0 / 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.page-backdrop.open {
  display: flex;
}

.page-modal {
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-elevated);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--border-radius-card);
  box-shadow: var(--card-shadow-hover);
  overflow: hidden;
}

.page-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 1.75rem 1.1rem;
  border-bottom: var(--border-width) solid var(--border-color);
}

.page-modal-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-primary);
  margin-bottom: 0.3rem;
}

.page-modal-title {
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}

.page-modal-body {
  padding: 1.4rem 1.75rem 1.6rem;
  overflow-y: auto;
  font-family: var(--font-primary);
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text-primary);
}

.page-modal-lead {
  font-size: 1.06rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.page-modal-body h2 {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 1.9rem 0 0.55rem;
  padding-top: 1.1rem;
  border-top: var(--border-width) solid var(--border-color);
  color: var(--text-primary);
}

.page-modal-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.page-modal-body h3 {
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 700;
  margin: 1.2rem 0 0.35rem;
}

.page-modal-body p {
  margin: 0 0 0.85rem;
}

.page-modal-body ul,
.page-modal-body ol {
  margin: 0 0 0.9rem;
  padding-left: 1.25rem;
}

.page-modal-body li {
  margin-bottom: 0.35rem;
}

.page-modal-body a {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.page-modal-body th,
.page-modal-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: var(--border-width) solid var(--border-color);
}

.page-modal-body th {
  font-family: var(--font-heading);
  font-weight: 700;
}

.page-modal-status {
  color: var(--text-muted);
}

.page-modal-foot {
  padding: 0.75rem 1.75rem;
  border-top: var(--border-width) solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.page-edit-btn {
  float: right;
  padding: 0.2rem 0.8rem;
}

.page-modal-foot:empty {
  display: none;
}

@media (max-width: 600px) {
  .page-backdrop {
    padding: 0;
  }

  .page-modal {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .page-modal-header,
  .page-modal-body,
  .page-modal-foot {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
}
