/*
Theme Name: WikiActivism
Theme URI: https://wikiactivism.com
Author: WikiActivism
Description: Independent-premium editorial theme for WikiActivism — navy/near-black dominant, red quarantined to breaking-news only. Newsreader (serif, voice) / Archivo (sans, body) / IBM Plex Mono (metadata) type system. Ported from the approved Phase 1 prototype (homepage-prototype-v3-real-images.html).
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: wikiactivism
*/

/* =========================================================
   0. Self-hosted fonts (Phase 2 requirement — no Google Fonts CDN)
   Variable fonts: Google serves one file across the declared
   weight range, browsers auto-map font-weight to the instance.
   ========================================================= */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('assets/fonts/newsreader-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('assets/fonts/newsreader-italic-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/archivo-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
}

/* =========================================================
   1. Design tokens — ported verbatim from the Phase 1 prototype.
   Do not reinterpret; see prototypes/claude-code-handoff.md §1.
   ========================================================= */
:root {
  --paper: #FAF9F6;
  --paper-raised: #FFFFFF;
  --ink: #181B22;
  --ink-soft: #4B5163;
  --navy: #1B3A6B;
  --navy-deep: #12294D;
  --navy-bright: #2F5FA8;
  --signal: #9C4A3E;        /* muted brick-red — "breaking" indicators ONLY, never decorative */
  --hairline: #DEDAD0;
  --pillar-fs: #2F5FA8;      /* Free Speech (fallback; real value comes from term meta) */
  --pillar-fin: #3E7C6B;     /* Financial Systems */
  --pillar-cl: #6B4E9A;      /* Civil Liberties */
  --pillar-tech: #4B5163;    /* Technology */
  --pillar-future: #B2793A;  /* Future Forecasting */
  --radius: 2px;
  --maxw: 1180px;
}
[data-theme="dark"] {
  --paper: #14171D;
  --paper-raised: #1B1F27;
  --ink: #EDEBE4;
  --ink-soft: #A8ACB8;
  --navy: #4A76B8;
  --navy-deep: #2F5FA8;
  --navy-bright: #6E9BE0;
  --signal: #C4756A;
  --hairline: #2E323C;
  --pillar-fs: #6E9BE0;
  --pillar-fin: #5FA98F;
  --pillar-cl: #9C81CC;
  --pillar-tech: #8A90A3;
  --pillar-future: #D6A05C;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; height: auto; }
:focus-visible { outline: 2px solid var(--navy-bright); outline-offset: 2px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--navy); color: #fff; padding: 12px 18px; font-family: 'Archivo', sans-serif; font-weight: 600;
}
.skip-link:focus { left: 12px; top: 12px; }
.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
hr.hairline { border: none; border-top: 1px solid var(--hairline); margin: 0; }

/* ---------- Utility bar ---------- */
.utility-bar {
  border-bottom: 1px solid var(--hairline);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
}
.utility-bar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 34px; color: var(--ink-soft);
}
.utility-bar .actions { display: flex; align-items: center; gap: 16px; }
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  display: flex; align-items: center; gap: 6px; padding: 6px 4px;
  min-height: 44px;
}
.icon-btn:hover { color: var(--navy-bright); }

/* ---------- Masthead ---------- */
.masthead { padding: 28px 0 18px; text-align: center; }
.masthead .logo-mark {
  display: inline-block;
  margin: 0;
  font-family: 'Newsreader', serif;
  font-weight: 600;
  font-size: clamp(34px, 6vw, 54px);
  letter-spacing: -0.01em;
  background-image: linear-gradient(
    125deg,
    #0E0E0C 0%, #0E0E0C 40%,
    #4A3D1D 45%, #8A6F2E 48.5%, #C2A155 50%, #8A6F2E 51.5%,
    #4A3D1D 55%, #0E0E0C 60%, #0E0E0C 100%
  );
  background-size: 340% 100%;
  background-position: 130% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: wa-sweep 43s linear infinite;
}
[data-theme="dark"] .masthead .logo-mark {
  background-image: linear-gradient(
    125deg,
    #D8D4C8 0%, #D8D4C8 40%,
    #7A6B4A 45%, #96835A 48.5%, #A8926B 50%, #96835A 51.5%,
    #7A6B4A 55%, #D8D4C8 60%, #D8D4C8 100%
  );
}
.masthead .logo-mark .big { font-size: 1.265em; }
.masthead .logo-mark img { height: clamp(34px, 6vw, 54px); width: auto; }
@keyframes wa-sweep {
  0%      { background-position: 130% 0; }
  93.02%  { background-position: -130% 0; }
  100%    { background-position: -130% 0; }
}
.masthead .tagline {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ---------- Primary nav ---------- */
.primary-nav { border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); position: relative; }
.primary-nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.nav-links { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.02em;
  padding: 16px 2px; display: inline-block; border-bottom: 2px solid transparent;
}
.nav-links a:hover { opacity: 0.6; }
.nav-toggle { display: none; background: none; border: 1px solid var(--hairline); border-radius: var(--radius); width: 44px; height: 44px; cursor: pointer; }
.nav-toggle span, .nav-toggle::before, .nav-toggle::after { content: ""; display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px auto; }

/* ---------- Pillar rule (signature element) ---------- */
.pillar-rule { display: grid; height: 5px; }
.pillar-rule a { display: block; height: 100%; }

/* ---------- Ticker ---------- */
.ticker-band { background: var(--navy-deep); color: #fff; overflow: hidden; border-top: 1px solid rgba(255,255,255,0.08); }
.ticker-band .wrap { display: flex; align-items: center; height: 38px; }
.ticker-tag {
  color: var(--signal); font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  padding-right: 14px; margin-right: 14px; height: 100%; display: flex; align-items: center; gap: 7px;
  flex-shrink: 0; border-right: 1px solid rgba(255,255,255,0.15);
}
.ticker-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); flex-shrink: 0; }
.ticker-track { overflow: hidden; flex: 1; }
.ticker-move {
  display: inline-block; white-space: nowrap; font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px; color: #D8DCE4; animation: ticker 48s linear infinite;
  padding-left: 100%;
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- Hero ---------- */
.hero-section { padding-top: 36px; padding-bottom: 8px; }
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; }
.hero-lead .eyebrow { color: var(--pillar-fs); }
.hero-lead h1 {
  font-family: 'Newsreader', serif; font-weight: 600; font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.08; margin: 10px 0 14px; letter-spacing: -0.01em;
}
.hero-lead h1 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.hero-lead .deck {
  font-family: 'Newsreader', serif; font-style: italic; font-size: 18px;
  color: var(--ink-soft); line-height: 1.45; margin: 0 0 14px; max-width: 46em;
}
.hero-lead .byline { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-soft); }
.hero-image { aspect-ratio: 16/10; border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.hero-image img { width: 100%; height: 100%; object-fit: cover; }

.hero-secondary { display: flex; flex-direction: column; gap: 22px; }
.hero-secondary .story + .story { border-top: 1px solid var(--hairline); padding-top: 22px; }
.story .eyebrow { margin-bottom: 6px; }
.story h2 {
  font-family: 'Newsreader', serif; font-weight: 600; font-size: 21px; line-height: 1.2; margin: 0 0 6px;
}
.story h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.story p.dek { color: var(--ink-soft); font-size: 14.5px; line-height: 1.5; margin: 0; }

/* ---------- Placeholder editorial art (fallback when no featured image) ---------- */
.art-mark { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.art-mark svg { width: 30%; height: 30%; color: var(--tint-fg, var(--ink-soft)); }
.art-mark .art-label {
  position: absolute; bottom: 8px; left: 10px; font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px; letter-spacing: 0.06em; color: var(--ink-soft); opacity: 0.75;
}
.thumb .art-mark svg { width: 42%; height: 42%; }
.story-thumb { aspect-ratio: 21/9; border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.story-thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-thumb .art-mark svg { width: 22%; height: 22%; }
[data-theme="dark"] .tint { filter: brightness(0.55); }

/* ---------- Main split: article list + most read ---------- */
.main-split { display: grid; grid-template-columns: 1fr 320px; gap: 48px; padding-top: 44px; padding-bottom: 44px; }
.section-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--ink); padding-bottom: 10px; margin-bottom: 20px;
}
.article-list { display: flex; flex-direction: column; gap: 24px; }
.article-list .story { display: grid; grid-template-columns: 100px 1fr; gap: 16px; }
.article-list .thumb { aspect-ratio: 1/1; border-radius: var(--radius); overflow: hidden; }
.article-list .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-list .story + .story { border-top: 1px solid var(--hairline); padding-top: 24px; }
.article-list h2 { font-size: 18px; }
.pagination { display: flex; gap: 10px; margin-top: 28px; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }
.pagination a, .pagination span { padding: 8px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); }
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }

.most-read { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.most-read li { display: flex; gap: 14px; padding: 14px 0; counter-increment: rank; }
.most-read li + li { border-top: 1px solid var(--hairline); }
.most-read li::before {
  content: counter(rank);
  font-family: 'Newsreader', serif; font-weight: 500; font-size: 26px; color: var(--hairline);
  line-height: 1; flex-shrink: 0; width: 28px;
}
.most-read h3 { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 14.5px; line-height: 1.35; margin: 0; }
.most-read a:hover { text-decoration: underline; }

/* ---------- Action band ---------- */
.action-band { background: var(--navy); color: #fff; padding: 30px 0; }
.action-grid { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.action-copy .eyebrow { color: #B9CCEA; }
.action-copy h2 { font-family: 'Newsreader', serif; font-weight: 600; font-size: 24px; margin: 8px 0 4px; }
.action-copy p { margin: 0; color: #D8E2F2; font-size: 14px; }
.action-side { display: flex; align-items: center; gap: 18px; }
.counter { font-family: 'IBM Plex Mono', monospace; text-align: right; }
.counter .num { font-size: 22px; font-weight: 600; display: block; }
.counter .label { font-size: 11px; color: #B9CCEA; }
.btn-primary {
  background: #fff; color: var(--navy-deep); border: none; border-radius: var(--radius);
  padding: 14px 22px; font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 14px;
  cursor: pointer; min-height: 44px; white-space: nowrap;
}
.btn-primary:hover { background: #EAF0FA; }
.btn-primary:disabled { opacity: 0.7; cursor: default; }

/* ---------- Footer ---------- */
footer.site-footer { border-top: 1px solid var(--hairline); padding: 36px 0 60px; margin-top: 8px; }
.footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { font-size: 12.5px; color: var(--ink-soft); }
.footer-links a:hover { color: var(--navy-bright); }
.footer-note { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); margin-top: 18px; }

/* ---------- Sticky mobile action bar ---------- */
.mobile-action-bar { display: none; }

/* =========================================================
   2. Article template ("experience" version)
   ========================================================= */
.article-header { padding: 40px 0 24px; max-width: 46em; margin: 0 auto; }
.article-header .eyebrow a:hover { text-decoration: underline; }
.article-header h1 {
  font-family: 'Newsreader', serif; font-weight: 600; font-size: clamp(32px, 5vw, 50px);
  line-height: 1.08; letter-spacing: -0.01em; margin: 14px 0 16px;
}
.article-header .deck {
  font-family: 'Newsreader', serif; font-style: italic; font-size: 20px; color: var(--ink-soft);
  line-height: 1.5; margin: 0 0 20px;
}
.article-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-soft); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); padding: 14px 0; }
.article-hero-image { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; max-width: var(--maxw); margin: 24px auto; }
.article-hero-image img { width: 100%; height: 100%; object-fit: cover; }
.article-hero-image figcaption { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); padding-top: 8px; }

.article-body { max-width: 46em; margin: 0 auto; padding: 8px 0 40px; font-size: 18px; line-height: 1.7; }
.article-body p { margin: 0 0 24px; }
.article-body > p:first-of-type::first-letter {
  font-family: 'Newsreader', serif; font-weight: 600; font-size: 4.6em; line-height: 0.82;
  float: left; padding: 4px 8px 0 0; color: var(--navy);
}
.article-body h2 { font-family: 'Newsreader', serif; font-weight: 600; font-size: 28px; margin: 44px 0 18px; line-height: 1.2; }
.article-body h3 { font-family: 'Newsreader', serif; font-weight: 600; font-size: 22px; margin: 36px 0 14px; }
.article-body a { text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
.article-body a:hover { text-decoration-color: var(--navy-bright); }
.article-body ul, .article-body ol { padding-left: 1.4em; margin: 0 0 24px; }
.article-body img { border-radius: var(--radius); margin: 8px 0; }
.article-body figcaption { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); padding-top: 8px; }
.article-body blockquote.pull-quote {
  font-family: 'Newsreader', serif; font-style: italic; font-weight: 500; font-size: 28px;
  line-height: 1.35; color: var(--ink); border: none; margin: 40px -8px; padding: 0 8px;
  position: relative;
}
.article-body blockquote.pull-quote::before {
  content: "\201C"; color: var(--navy-bright); font-size: 1.4em; line-height: 0; display: block; margin-bottom: 8px;
}
.article-body blockquote.pull-quote cite { display: block; font-family: 'IBM Plex Mono', monospace; font-style: normal; font-size: 13px; color: var(--ink-soft); margin-top: 10px; }

.article-tags { display: flex; gap: 10px; flex-wrap: wrap; max-width: 46em; margin: 0 auto 40px; }
.article-tags a {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  border: 1px solid var(--hairline); border-radius: 999px; padding: 6px 12px; color: var(--ink-soft);
}
.article-tags a:hover { border-color: var(--navy-bright); color: var(--navy-bright); }

.article-share { display: flex; gap: 12px; max-width: 46em; margin: 0 auto 44px; }
.article-share a { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 16px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; min-height: 44px; display: inline-flex; align-items: center; }
.article-share a:hover { border-color: var(--navy-bright); color: var(--navy-bright); }

.author-box { max-width: 46em; margin: 0 auto 44px; padding: 24px; border: 1px solid var(--hairline); border-radius: var(--radius); display: flex; gap: 18px; align-items: flex-start; }
.author-box img { width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; }
.author-box h3 { font-family: 'Newsreader', serif; font-size: 18px; margin: 0 0 6px; }
.author-box p { font-size: 14px; color: var(--ink-soft); margin: 0; line-height: 1.5; }

.where-next { background: var(--paper-raised); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); padding: 44px 0; }
.where-next .section-label { border-bottom-color: var(--ink); }
.where-next-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }

/* =========================================================
   3. Archive / hub pages
   ========================================================= */
.hub-header { padding: 40px 0 28px; border-bottom: 1px solid var(--hairline); }
.hub-header .eyebrow { font-size: 13px; }
.hub-header h1 { font-family: 'Newsreader', serif; font-weight: 600; font-size: clamp(32px, 5vw, 48px); margin: 10px 0 12px; }
.hub-header .hub-desc { font-family: 'Newsreader', serif; font-style: italic; font-size: 18px; color: var(--ink-soft); max-width: 46em; margin: 0; line-height: 1.5; }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding: 40px 0; }
.hub-grid .thumb { aspect-ratio: 3/2; margin-bottom: 12px; }

/* =========================================================
   4. Generic page / search / 404
   ========================================================= */
.page-header { padding: 40px 0 20px; max-width: 46em; margin: 0 auto; }
.page-header h1 { font-family: 'Newsreader', serif; font-weight: 600; font-size: clamp(30px, 4.5vw, 44px); margin: 0; }
.page-body { max-width: 46em; margin: 0 auto; padding: 8px 0 60px; font-size: 17px; line-height: 1.7; }
.page-body h2 { font-family: 'Newsreader', serif; font-weight: 600; font-size: 26px; margin: 36px 0 16px; }
.page-body p { margin: 0 0 20px; }

.search-form { display: flex; gap: 10px; max-width: 46em; margin: 20px auto 0; }
.search-form input[type="search"] {
  flex: 1; font-family: 'Archivo', sans-serif; font-size: 15px; padding: 12px 14px;
  border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--paper-raised); color: var(--ink);
  min-height: 44px;
}
.search-form button {
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12.5px; text-transform: uppercase;
  background: var(--navy); color: #fff; border: none; border-radius: var(--radius); padding: 0 20px; cursor: pointer; min-height: 44px;
}
.no-results { max-width: 46em; margin: 40px auto; text-align: center; }
.no-results h1 { font-family: 'Newsreader', serif; font-size: 36px; margin-bottom: 12px; }

/* =========================================================
   5. Mobile
   ========================================================= */
@media (max-width: 780px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.is-open {
    display: flex !important; flex-direction: column; gap: 0; position: absolute;
    top: 100%; left: 0; right: 0; background: var(--paper-raised); border-bottom: 1px solid var(--hairline);
    padding: 8px 20px; z-index: 30;
  }
  .hero-grid, .main-split, .where-next-grid, .hub-grid { grid-template-columns: 1fr; }
  .article-list .story { grid-template-columns: 72px 1fr; }
  body { padding-bottom: 74px; }
  .action-band .action-grid { flex-direction: column; align-items: flex-start; }
  .mobile-action-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--navy); color: #fff; padding: 10px 16px; align-items: center;
    justify-content: space-between; gap: 12px; border-top: 1px solid var(--navy-deep);
  }
  .mobile-action-bar .btn-primary { flex-shrink: 0; }
  .mobile-action-bar .mobile-sig-count { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
  .author-box { flex-direction: column; }
}
