/* ==========================================================================
   Meridian Global News — design system
   Light + dark themes, 12-column measure, zero dependencies.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */
:root {
  --paper: #ffffff;
  --paper-2: #f9f8f6;
  --ink: #10161d;
  --body: #1e2630;
  --body-2: #3c4654;
  --muted: #5a6472;
  --hairline: #e3e6ea;
  --rule: #c9ced6;
  --accent: #a4122a;
  --accent-ink: #ffffff;
  --accent-soft: #fbf4f2;
  --accent-soft-line: #ebdcd8;
  --navy: #0e2742;
  --navy-ink: #ffffff;
  --navy-muted: #a9bacc;
  --tint: #f4f2ee;
  --tint-line: #e0dcd4;
  --ph: #edeae4;
  --ph-line: #dcd8d0;
  --ph-text: #6b6358;
  --footer: #10161d;
  --footer-text: #a3acb8;
  --footer-line: #2c3540;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --measure: 1280px;
  --gutter: 32px;
  --radius: 0px;
  --focus: #1b64c8;
}

[data-theme="dark"] {
  --paper: #0f1317;
  --paper-2: #141920;
  --ink: #f4f5f6;
  --body: #d8dce1;
  --body-2: #b9c1ca;
  --muted: #9aa4b0;
  --hairline: #242a31;
  --rule: #333b44;
  --accent: #e2697e;
  --accent-ink: #1a0d11;
  --accent-soft: #1d1418;
  --accent-soft-line: #33222a;
  --navy: #15293e;
  --navy-muted: #a9bacc;
  --tint: #161b21;
  --tint-line: #262d35;
  --ph: #1b2127;
  --ph-line: #2a3139;
  --ph-text: #8c96a1;
  --footer: #0b0e12;
  --footer-text: #9aa4b0;
  --footer-line: #242a31;
  --focus: #78aef5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1317;
    --paper-2: #141920;
    --ink: #f4f5f6;
    --body: #d8dce1;
    --body-2: #b9c1ca;
    --muted: #9aa4b0;
    --hairline: #242a31;
    --rule: #333b44;
    --accent: #e2697e;
    --accent-ink: #1a0d11;
    --accent-soft: #1d1418;
    --accent-soft-line: #33222a;
    --navy: #15293e;
    --tint: #161b21;
    --tint-line: #262d35;
    --ph: #1b2127;
    --ph-line: #2a3139;
    --ph-text: #8c96a1;
    --footer: #0b0e12;
    --footer-text: #9aa4b0;
    --footer-line: #242a31;
    --focus: #78aef5;
  }
}

/* --- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); margin: 0; }

p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  z-index: 100;
  font-size: 13px;
  font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
}

/* --- Typography utilities ----------------------------------------------- */
.kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}
.meta { font-size: 12px; color: var(--muted); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--rule); display: inline-block; }

.h-lead   { font-size: clamp(30px, 4.4vw, 46px); font-weight: 700; line-height: 1.06; letter-spacing: -0.01em; }
.h-xl     { font-size: clamp(26px, 3vw, 34px); font-weight: 700; line-height: 1.12; }
.h-lg     { font-size: 24px; font-weight: 700; line-height: 1.18; }
.h-md     { font-size: 20px; font-weight: 600; line-height: 1.24; }
.h-sm     { font-size: 17px; font-weight: 600; line-height: 1.3; }
.h-xs     { font-size: 15px; font-weight: 600; line-height: 1.34; }
.standfirst { font-family: var(--serif); font-size: 19px; line-height: 1.52; color: var(--body-2); max-width: 62ch; }
.dek { font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--body-2); }

/* --- Utility bar -------------------------------------------------------- */
.utility { background: var(--navy); color: var(--navy-ink); }
.utility .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; }
.utility a { padding: 12px 0; line-height: 20px; font-size: 12px; color: var(--navy-muted); }
.utility a:hover { color: #fff; }
.utility .date { font-size: 12px; color: var(--navy-muted); padding: 14px 0; }
.utility .sep { width: 1px; height: 14px; background: rgba(169, 186, 204, 0.35); }
.editions { display: flex; align-items: center; gap: 2px; }
.editions span.label-sm {
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--navy-muted); margin-right: 6px;
}
.editions a { padding: 12px; font-weight: 500; }
.editions a[aria-current="true"] { color: #fff; background: rgba(255, 255, 255, 0.14); font-weight: 600; }
.grow { flex-grow: 1; }

.btn-subscribe {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink) !important; background: var(--accent);
  padding: 12px 18px; line-height: 20px;
}
.btn-subscribe:hover { filter: brightness(1.1); color: var(--accent-ink) !important; }

/* --- Masthead ----------------------------------------------------------- */
.masthead { padding: 28px 0 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.masthead .side { flex: 1 1 140px; display: flex; align-items: center; gap: 4px; }
.masthead .side.right { justify-content: flex-end; }
.masthead .center { flex: 999 1 380px; text-align: center; }
.wordmark {
  font-family: var(--serif); font-weight: 700; letter-spacing: 0.05em;
  color: var(--ink); display: block;
  font-size: clamp(34px, 5.2vw, 54px); line-height: 1;
}
.tagline { margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.tagline span.rule-line { height: 1px; width: 44px; background: var(--rule); }
.tagline span.txt {
  font-size: 10px; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted);
}

.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--ink); cursor: pointer; padding: 0;
}
.icon-btn.bordered { border: 1px solid var(--hairline); background: var(--paper); }
.icon-btn:hover { color: var(--accent); }

/* --- Navigation --------------------------------------------------------- */
.nav {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  position: sticky; top: 0; z-index: 40;
}
.nav .wrap { display: flex; flex-wrap: wrap; align-items: center; padding-inline: calc(var(--gutter) - 12px); }
.nav a {
  padding: 13px 12px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); line-height: 18px;
}
.nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.nav .live { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; display: inline-flex; align-items: center; gap: 8px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav .wrap { flex-wrap: nowrap; }
  .nav-toggle { display: inline-flex; }
  .nav .links {
    display: none; width: 100%; flex-direction: column; align-items: stretch;
    padding-bottom: 8px;
  }
  .nav .links.open { display: flex; }
  .nav .links a { border-bottom: 1px solid var(--hairline); }
  .nav .wrap { flex-wrap: wrap; }
}
@media (min-width: 861px) {
  .nav .links { display: flex; flex-wrap: wrap; align-items: center; flex-grow: 1; }
}

/* reading progress */
.progress { height: 3px; background: var(--hairline); }
.progress > i { display: block; height: 3px; width: 0; background: var(--accent); }

/* --- Breaking ----------------------------------------------------------- */
.breaking { background: var(--accent-soft); border-bottom: 1px solid var(--accent-soft-line); }
.breaking .wrap { padding-block: 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 18px; }
.tag-breaking {
  background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; padding: 6px 10px;
}
.breaking h2 { flex: 999 1 380px; font-size: 18px; font-weight: 600; line-height: 1.35; }

/* --- Layout rows -------------------------------------------------------- */
.row { display: flex; flex-wrap: wrap; gap: 36px; }
.row.tight { gap: 28px; }
.col-rail { flex: 1 1 230px; min-width: 0; }
.col-main { flex: 999 1 520px; min-width: 0; }
.col-side { flex: 1 1 270px; min-width: 0; }
.col-half { flex: 1 1 400px; min-width: 0; }

section.block { margin-top: 48px; }

/* --- Section headers ---------------------------------------------------- */
.section-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 12px; border-bottom: 2px solid var(--ink);
}
.section-head .mark { width: 10px; height: 10px; background: var(--accent); flex: 0 0 auto; }
.section-head h2 { font-size: 26px; font-weight: 700; }
.section-head .more {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 0;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink); line-height: 20px;
}
.rail-head { padding-bottom: 12px; border-bottom: 2px solid var(--ink); display: flex; align-items: center; gap: 10px; }

/* --- Media placeholders ------------------------------------------------- */
.ph {
  width: 100%; background: var(--ph); border: 1px solid var(--ph-line);
  display: flex; align-items: center; justify-content: center;
}
.ph span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ph-text);
}
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-3x2 { aspect-ratio: 3 / 2; }
.ratio-4x3 { aspect-ratio: 4 / 3; }
figcaption { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* --- Cards and lists ---------------------------------------------------- */
.card h3 { margin-top: 8px; }
.card .meta { margin-top: 10px; }
.card-grid { display: flex; flex-wrap: wrap; gap: 32px; padding-top: 26px; }
.card-grid > article { flex: 1 1 230px; min-width: 0; }

.list-divided > li { padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.list-divided > li:last-child { border-bottom: 0; }

.timeline li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.timeline .time { flex: 0 0 48px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); padding-top: 3px; }
.timeline li:first-child .time { color: var(--accent); }

.ranked li { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.ranked .num { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1; color: var(--accent); flex: 0 0 26px; }
.ranked li:last-child { border-bottom: 0; }

.story-sm { display: flex; gap: 18px; }
.story-sm .thumb { flex: 0 0 120px; height: 90px; }

/* --- Panels ------------------------------------------------------------- */
.panel { background: var(--tint); border-top: 3px solid var(--navy); padding: 20px; }
.panel.accent { background: var(--accent-soft); border-top-color: var(--accent); border-bottom: 1px solid var(--accent-soft-line); }
.keybox { background: var(--tint); border-left: 3px solid var(--navy); padding: 22px 24px; }
.keybox ul { font-family: var(--serif); font-size: 17px; line-height: 1.6; color: var(--body); list-style: disc; padding-left: 20px; }
.keybox li { margin-bottom: 8px; }

.markets { background: var(--tint); border-block: 1px solid var(--tint-line); padding: 18px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px 36px; }
.markets .tick { flex: 1 1 120px; min-width: 0; }
.markets .tick .n { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ph-text); }
.markets .tick .v { display: block; margin-top: 4px; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--ink); }
.badge-feed { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ph-text); border: 1px solid var(--tint-line); padding: 3px 7px; }

.ad { border: 1px solid var(--ph-line); background: var(--paper-2); padding: 18px; text-align: center; }
.ad .slot { margin-top: 12px; background: var(--ph); border: 1px dashed var(--ph-line); display: flex; align-items: center; justify-content: center; }
.ad span.l { font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ph-text); }

/* --- Opinion band ------------------------------------------------------- */
.band-opinion { margin-top: 56px; background: var(--navy); color: #fff; padding: 44px 0; }
.band-opinion h2, .band-opinion h3 { color: #fff; }
.band-opinion .head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid rgba(169, 186, 204, 0.35); }
.band-opinion .columnists { display: flex; flex-wrap: wrap; gap: 36px; padding-top: 28px; }
.band-opinion article { flex: 1 1 260px; min-width: 0; display: flex; gap: 16px; }
.avatar {
  flex: 0 0 56px; height: 56px; border-radius: 50%; background: #1c3a58;
  border: 1px solid rgba(169, 186, 204, 0.4); display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--navy-muted);
}
.band-opinion .name { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #e0697b; }
.band-opinion h3 { font-size: 19px; font-weight: 600; font-style: italic; line-height: 1.32; margin-top: 8px; }
.band-opinion a:hover { color: #e0697b; }

/* --- Forms -------------------------------------------------------------- */
.newsletter { margin-top: 56px; background: var(--tint); border-top: 1px solid var(--tint-line); }
.newsletter .wrap { padding-block: 44px; display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
form label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--body);
}
.field-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
input[type="email"], input[type="search"], select {
  height: 52px; padding: 0 16px; font-family: var(--sans); font-size: 15px;
  color: var(--body); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
}
input[type="email"] { flex: 999 1 220px; min-width: 0; }
select { height: 40px; font-size: 13px; }
.btn {
  height: 52px; padding: 0 24px; border: 0; background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; cursor: pointer;
}
.btn:hover { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.form-note { margin-top: 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* --- Article ------------------------------------------------------------ */
.article-col { flex: 999 1 620px; min-width: 0; max-width: 760px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 0 0; }
.breadcrumb a, .breadcrumb span { font-size: 12px; color: var(--muted); }
.byline {
  margin-top: 26px; padding: 18px 0; border-block: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px;
}
.byline .av {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ph); border: 1px solid var(--ph-line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ph-text);
}
.prose { margin-top: 34px; font-family: var(--serif); font-size: 20px; line-height: 1.68; color: var(--body); }
.prose > p + p { margin-top: 22px; }
.prose h2 { margin-top: 36px; font-size: 28px; font-weight: 700; line-height: 1.2; }
.prose h2 + p { margin-top: 16px; }
.prose a { color: var(--navy); border-bottom: 1px solid var(--rule); }
[data-theme="dark"] .prose a { color: #9fc4f0; }
.prose figure { margin: 32px 0 0; }
.prose figcaption { font-family: var(--sans); }
.dropcap::first-letter {
  float: left; font-size: 76px; line-height: 0.82; font-weight: 700;
  padding: 6px 12px 0 0; color: var(--ink);
}
blockquote.pull {
  margin: 34px 0 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--accent);
}
blockquote.pull p { font-size: 26px; font-weight: 600; line-height: 1.34; color: var(--ink); }
blockquote.pull footer {
  margin-top: 12px; font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.tags { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--hairline); display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { padding: 9px 14px; border: 1px solid var(--hairline); font-size: 12px; font-weight: 500; color: var(--body); }
.tags a:hover { border-color: var(--accent); }
.author-box { margin-top: 28px; border: 1px solid var(--hairline); padding: 24px; display: flex; flex-wrap: wrap; gap: 20px; }

/* --- Section page ------------------------------------------------------- */
.section-masthead { padding: 36px 0 20px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; }
.section-masthead h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 700; line-height: 1; letter-spacing: -0.015em; margin-top: 10px; }
.subnav { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hairline); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.subnav a { padding: 13px 14px; font-size: 13px; font-weight: 500; color: var(--body-2); line-height: 18px; }
.subnav a[aria-current="page"] { font-weight: 600; color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.sort { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.sort label { font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }

/* --- Footer ------------------------------------------------------------- */
.site-footer { margin-top: 56px; background: var(--footer); color: #fff; }
.site-footer .wrap { padding: 48px var(--gutter) 32px; }
.site-footer h2 { color: #fff; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 12px; }
.site-footer a { color: var(--footer-text); font-size: 13px; display: block; padding: 7px 0; }
.site-footer a:hover { color: #fff; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 40px; }
.site-footer .cols > * { flex: 1 1 150px; min-width: 0; }
.site-footer .brand { flex: 1 1 240px; }
.site-footer .brand p { margin-top: 14px; font-size: 13px; line-height: 1.6; color: var(--footer-text); max-width: 34ch; }
.social { margin-top: 18px; display: flex; gap: 6px; }
.social a { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--footer-line); color: #fff; padding: 0; }
.social a:hover { border-color: var(--accent); color: var(--accent); }
.colophon {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--footer-line);
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center;
  font-size: 12px; color: var(--footer-text);
}

/* --- Theme toggle ------------------------------------------------------- */
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* --- Print -------------------------------------------------------------- */
@media print {
  .nav, .utility, .ad, .newsletter, .site-footer, .icon-btn, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .article-col { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
