/* ============================================================
   CIVIX21 — Design System
   Aesthetic: Editorial-authoritative. Policy journal meets
   data publication. Serious without being academic-dry.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300;1,8..60,400&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Tokens ── */
:root {
  --navy:       #0d1b2a;
  --navy-mid:   #1a2f45;
  --navy-light: #243d57;
  --accent:     #c8873a;       /* warm amber — conviction, not alarm */
  --accent-dim: #a06828;
  --cream:      #f5f0e8;
  --cream-mid:  #ede7d9;
  --text:       #1c1c1c;
  --text-mid:   #444;
  --text-light: #777;
  --border:     #d4cec4;
  --white:      #ffffff;

  --serif-display: 'Playfair Display', Georgia, serif;
  --serif-body:    'Source Serif 4', Georgia, serif;
  --sans:          'DM Sans', system-ui, sans-serif;

  --max-w:    1100px;
  --col-text: 700px;

  --space-xs:  0.375rem;
  --space-sm:  0.75rem;
  --space-md:  1.5rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;
  --space-2xl: 7rem;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--serif-body);
  font-weight: 400;
  color: var(--text);
  background: var(--cream);
  line-height: 1.7;
}

img { max-width: 100%; display: block; }
a  { color: inherit; }

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--serif-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1.1rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }

p { margin-bottom: var(--space-md); }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: 1.2rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text-mid);
}

.label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.container--narrow {
  max-width: var(--col-text);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

/* ── HEADER / NAV ── */
.site-header {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}

.header-inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  height: 64px;
}

.site-logo {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}

.logo-mark {
  font-family: var(--serif-display);
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--white);
  letter-spacing: -0.02em;
}

.logo-mark span {
  color: var(--accent);
}

.logo-sub {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.site-nav a {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.active { color: var(--white); }

.nav-cta {
  background: var(--accent);
  color: var(--navy) !important;
  padding: 0.4rem 1rem;
  border-radius: 3px;
  font-weight: 600 !important;
  transition: background 0.2s !important;
}

.nav-cta:hover { background: var(--accent-dim) !important; }

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  transition: all 0.3s;
}

/* ── HERO (homepage) ── */
.hero {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-2xl) 0 var(--space-xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(200,135,58,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.hero-rule {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.hero-rule::before {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--accent);
  flex-shrink: 0;
}

.hero-inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
  position: relative;
}

.hero h1 {
  max-width: 780px;
  margin-bottom: var(--space-lg);
  font-style: italic;
  font-weight: 700;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .lead {
  max-width: 600px;
  color: rgba(255,255,255,0.72);
  margin-bottom: var(--space-xl);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.75rem 1.75rem;
  border-radius: 3px;
  letter-spacing: 0.03em;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--navy);
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-outline {
  border: 1.5px solid rgba(255,255,255,0.4);
  color: var(--white);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--white);
  background: rgba(255,255,255,0.06);
}

.btn-outline-dark {
  border: 1.5px solid var(--navy);
  color: var(--navy);
  background: transparent;
}

.btn-outline-dark:hover {
  background: var(--navy);
  color: var(--white);
}

/* ── STAT BAR ── */
.stat-bar {
  background: var(--navy-mid);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: var(--space-lg) 0;
}

.stat-bar-inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-lg);
}

.stat {
  text-align: center;
}

.stat-number {
  font-family: var(--serif-display);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  display: block;
}

.stat-label {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: var(--space-xs);
  display: block;
}

/* ── SECTION BASE ── */
.section {
  padding: var(--space-2xl) 0;
}

.section--cream { background: var(--cream); }
.section--white { background: var(--white); }
.section--navy  { background: var(--navy); color: var(--white); }
.section--mid   { background: var(--cream-mid); }

.section-header {
  margin-bottom: var(--space-xl);
}

.section-header .label {
  display: block;
  margin-bottom: var(--space-sm);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  max-width: 560px;
  color: var(--text-mid);
}

.section--navy .section-header p {
  color: rgba(255,255,255,0.65);
}

/* ── THREE PILLARS GRID ── */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.pillar {
  background: var(--white);
  border-top: 4px solid var(--navy);
  padding: var(--space-lg);
}

.pillar--accent { border-top-color: var(--accent); }

.pillar-number {
  font-family: var(--serif-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--cream-mid);
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.pillar h3 {
  margin-bottom: var(--space-sm);
  font-size: 1.15rem;
}

.pillar p {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.pillar-link {
  display: inline-block;
  margin-top: var(--space-md);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pillar-link::after { content: ' →'; }

/* ── FINDING / PULL QUOTE ── */
.finding {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-xl) var(--space-lg);
  border-left: 6px solid var(--accent);
  margin: var(--space-xl) 0;
}

.finding blockquote {
  font-family: var(--serif-display);
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  font-style: italic;
  font-weight: 700;
  line-height: 1.35;
  max-width: 800px;
  margin-bottom: var(--space-md);
}

.finding cite {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-style: normal;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── DATA TOOLS CARDS ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.tool-card {
  border: 1px solid var(--border);
  background: var(--white);
  padding: var(--space-lg);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.tool-card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 20px rgba(13,27,42,0.1);
}

.tool-card-tag {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--navy);
  display: inline-block;
  padding: 3px 8px;
  margin-bottom: var(--space-md);
}

.tool-card-tag--accent { background: var(--accent); }

.tool-card h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.tool-card p {
  font-size: 0.92rem;
  color: var(--text-mid);
  margin-bottom: var(--space-md);
}

.tool-card-meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
}

/* ── INSIGHT ARTICLES ── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.insight-card {
  background: var(--white);
  border-bottom: 3px solid var(--cream-mid);
  padding: var(--space-lg);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s;
}

.insight-card:hover { border-bottom-color: var(--accent); }

.insight-card .label { margin-bottom: var(--space-sm); display: block; }

.insight-card h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-sm);
  line-height: 1.35;
}

.insight-card p {
  font-size: 0.9rem;
  color: var(--text-mid);
}

/* ── BRIEFING CTA STRIP ── */
/* Replaces ad slots — on-brand, converts the right audience */
.briefing-cta {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-lg) var(--space-xl);
  margin: var(--space-xl) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
  border-left: 5px solid var(--accent);
}

.briefing-cta__text {}

.briefing-cta__label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: var(--space-xs);
}

.briefing-cta__heading {
  font-family: var(--serif-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  display: block;
  line-height: 1.3;
}

.briefing-cta__sub {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  display: block;
  margin-top: var(--space-xs);
}

.briefing-cta__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Wide strip variant — full width between sections */
.briefing-cta--wide {
  border-left: none;
  border-top: 3px solid var(--accent);
  border-radius: 0;
  margin: 0;
  padding: var(--space-xl) 0;
}

.briefing-cta--wide .briefing-cta__inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

/* ── SUBSTACK SUBSCRIBE BLOCK ── */
.substack-cta {
  background: var(--cream-mid);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  padding: var(--space-lg) var(--space-xl);
  margin: var(--space-xl) 0;
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.substack-cta__icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.substack-cta__text { flex: 1; min-width: 200px; }

.substack-cta__label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dim);
  display: block;
  margin-bottom: var(--space-xs);
}

.substack-cta__heading {
  font-family: var(--serif-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  display: block;
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.substack-cta__desc {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.substack-cta__actions { flex-shrink: 0; }

@media (max-width: 680px) {
  .briefing-cta { flex-direction: column; align-items: flex-start; }
  .briefing-cta--wide .briefing-cta__inner { flex-direction: column; align-items: flex-start; }
  .substack-cta { flex-direction: column; gap: var(--space-md); }
}

/* ── INLINE RULE ── */
.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

.rule--accent {
  border-top: 3px solid var(--accent);
}

/* ── BREADCRUMB ── */
.breadcrumb {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: var(--space-lg);
}

.breadcrumb a {
  text-decoration: none;
  color: var(--text-light);
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin-inline: 0.4em; }

/* ── PAGE HERO (inner pages) ── */
.page-hero {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-xl) 0;
  border-bottom: 3px solid var(--accent);
}

.page-hero .label { margin-bottom: var(--space-sm); display: block; }

.page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  max-width: 700px;
  margin-bottom: var(--space-md);
}

.page-hero .lead {
  color: rgba(255,255,255,0.68);
  max-width: 580px;
}

/* ── PROSE CONTENT ── */
.prose h2 {
  font-size: 1.6rem;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.2rem;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.prose ul, .prose ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

.prose li { margin-bottom: var(--space-xs); }

.prose a {
  color: var(--accent-dim);
  text-decoration: underline;
}

.prose a:hover { color: var(--accent); }

/* ── FOOTER ── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.6);
  padding: var(--space-xl) 0 var(--space-lg);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-brand .logo-mark { font-size: 1.2rem; display: block; margin-bottom: var(--space-sm); }

.footer-brand p {
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.footer-col h4 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
  margin-bottom: var(--space-md);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-col a {
  font-size: 0.88rem;
  text-decoration: none;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s;
}

.footer-col a:hover { color: var(--white); }

.footer-bottom {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.78rem;
}

.footer-bottom a {
  text-decoration: none;
  color: rgba(255,255,255,0.45);
}

.footer-bottom a:hover { color: var(--white); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  html { font-size: 16px; }

  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--navy-mid);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-md);
    gap: var(--space-md);
    border-bottom: 3px solid var(--accent);
  }

  .site-nav.open { display: flex; }

  .site-nav a { font-size: 1rem; color: rgba(255,255,255,0.85); }

  .hero { padding: var(--space-xl) 0; }

  .footer-inner { grid-template-columns: 1fr; gap: var(--space-lg); }

  .footer-bottom { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }

  .hero-actions { flex-direction: column; }
  .btn { text-align: center; }
}
