/* =========================================================
   The Meridian — news/blog theme
   Plain CSS, no build step.
   ========================================================= */

:root {
  --font-sans: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;

  --bg: #ffffff;
  --surface: #f8f9fb;
  --surface-2: #eef1f5;
  --text: #111827;
  --muted: #667085;
  --border: #e4e7ec;
  --accent: #d92d20;
  --accent-hover: #b42318;
  --accent-soft: #fef3f2;
  --link: #175cd3;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
  --container: 1180px;
}

html[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d232c;
  --text: #e6edf3;
  --muted: #98a2b3;
  --border: #2a323d;
  --accent: #ff6b5e;
  --accent-hover: #ff8a80;
  --accent-soft: #2a1a1a;
  --link: #79b8ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; }

.container {
  width: min(100% - 40px, var(--container));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 6px;
}
.skip-link:focus { left: 16px; color: var(--bg); }

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

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.brand:hover { color: inherit; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 800;
}

.site-nav { display: flex; align-items: center; gap: 22px; margin-right: auto; }
.site-nav a {
  font-size: .92rem;
  font-weight: 600;
  color: var(--muted);
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
.icon-sun { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }
.btn--outline { background: transparent; color: var(--accent); }
.btn--outline:hover { background: var(--accent-soft); }
.btn--small { padding: 8px 14px; font-size: .85rem; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.nav-toggle span { display: block; width: 18px; height: 2px; margin: 4px auto; background: currentColor; }

/* ---------- Breaking bar ---------- */
.breaking {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: .85rem;
}
.breaking .container { display: flex; align-items: center; gap: 12px; padding-block: 8px; }
.breaking-label {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: .7rem;
  letter-spacing: .08em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.breaking a { font-weight: 600; }

/* ---------- Section headings ---------- */
.section { padding-block: 44px; }
.section--tight { padding-block: 28px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--text);
  padding-bottom: 10px;
}
.section-head h2 { font-family: var(--font-serif); font-size: 1.55rem; margin: 0; letter-spacing: -.01em; }
.section-head a { color: var(--accent); font-size: .85rem; font-weight: 700; }

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ---------- Hero ---------- */
.hero { padding-top: 30px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 28px;
}

.hero-main .thumb { aspect-ratio: 16 / 9; }
.hero-main h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  line-height: 1.18;
  letter-spacing: -.02em;
  margin: 18px 0 10px;
}
.hero-main h2 a:hover { color: var(--accent); }
.hero-main p { color: var(--muted); margin: 0 0 16px; max-width: 62ch; }

.hero-side { display: grid; gap: 18px; align-content: start; }
.mini-story {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.mini-story:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-story .thumb { aspect-ratio: 4 / 3; }
.mini-story h3 { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.35; margin: 0 0 6px; }
.mini-story h3 a:hover { color: var(--accent); }

.meta { color: var(--muted); font-size: .78rem; font-weight: 600; }
.meta span + span::before { content: "•"; margin-inline: 6px; }

/* ---------- Thumbnail artwork (no external images needed) ---------- */
.thumb {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1e3a8a, #0ea5e9);
  display: block;
}
.thumb::before,
.thumb::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: .35;
}
.thumb::before { width: 55%; aspect-ratio: 1; right: -8%; top: -22%; background: #fff; }
.thumb::after { width: 38%; aspect-ratio: 1; left: -6%; bottom: -18%; background: #fbbf24; }
.thumb--2 { background: linear-gradient(135deg, #7c2d12, #f97316); }
.thumb--2::after { background: #fde68a; }
.thumb--3 { background: linear-gradient(135deg, #134e4a, #14b8a6); }
.thumb--3::after { background: #a7f3d0; }
.thumb--4 { background: linear-gradient(135deg, #4c1d95, #a855f7); }
.thumb--4::after { background: #f0abfc; }
.thumb--5 { background: linear-gradient(135deg, #831843, #ec4899); }
.thumb--5::after { background: #fbcfe8; }
.thumb--6 { background: linear-gradient(135deg, #0f172a, #475569); }
.thumb--6::after { background: #94a3b8; }
.thumb--7 { background: linear-gradient(135deg, #365314, #84cc16); }
.thumb--7::after { background: #d9f99d; }
.thumb--8 { background: linear-gradient(135deg, #713f12, #eab308); }
.thumb--8::after { background: #fef08a; }
.thumb-label {
  position: absolute;
  z-index: 1;
  left: 14px;
  bottom: 12px;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, .28);
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* ---------- Article grid ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: start;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 24px;
}
.card .thumb { aspect-ratio: 16 / 9; margin-bottom: 14px; }
.card h3 { font-family: var(--font-serif); font-size: 1.22rem; line-height: 1.35; margin: 0 0 8px; }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--muted); font-size: .92rem; margin: 0 0 10px; }

/* ---------- Sidebar ---------- */
.sidebar { display: grid; gap: 28px; position: sticky; top: 96px; }
.widget {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
}
.widget h3 {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 0 0 14px;
  color: var(--muted);
}
.widget ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.widget li { display: flex; gap: 12px; align-items: flex-start; }
.widget .num { color: var(--accent); font-family: var(--font-serif); font-size: 1.4rem; font-weight: 700; line-height: 1; }
.widget li a { font-size: .9rem; font-weight: 600; line-height: 1.4; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags a {
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
}
.tags a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- AdSense slots ----------
   Auto ads is active, so the manual slot placeholders below are hidden.
   Add ?preview-ads=1 to any page URL to preview them. */
.ad-slot {
  margin-block: 28px;
  text-align: center;
  min-height: 90px;
  display: none;
  place-items: center;
}
body.preview-ads .ad-slot { display: grid; }
.ad-slot--leaderboard { min-height: 100px; }
.ad-slot--box { min-height: 250px; }
.ad-slot--inline { min-height: 250px; margin-block: 34px; }
.ad-slot--skyscraper { min-height: 600px; }

.ad-placeholder {
  width: 100%;
  min-height: inherit;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(127, 127, 127, .035) 10px, rgba(127, 127, 127, .035) 20px),
    var(--surface);
  color: var(--muted);
  font-size: .75rem;
  display: grid;
  place-content: center;
  gap: 2px;
  padding: 16px;
}
.ad-placeholder small {
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .75;
}
.ad-placeholder strong { font-size: .78rem; font-weight: 600; }

/* ---------- Newsletter ---------- */
.newsletter {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.newsletter .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-block: 34px;
}
.newsletter h2 { font-family: var(--font-serif); font-size: 1.5rem; margin: 0 0 4px; }
.newsletter p { color: var(--muted); margin: 0; font-size: .9rem; }
.newsletter form { display: flex; gap: 8px; min-width: min(100%, 420px); }
.newsletter input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}
.form-note { margin-top: 8px; font-size: .78rem; color: var(--muted); min-height: 1.2em; }
.form-note.is-error { color: var(--accent); }
.form-note.is-ok { color: #067647; }

/* ---------- Article page ---------- */
.article-header { max-width: 820px; margin: 0 auto; padding-block: 40px 24px; text-align: center; }
.article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -.025em;
  margin: 10px 0 16px;
}
.article-header .dek { font-size: 1.1rem; color: var(--muted); max-width: 68ch; margin-inline: auto; }
.article-byline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  font-size: .85rem;
  color: var(--muted);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: .85rem;
}
.article-hero { aspect-ratio: 21 / 9; max-height: 480px; margin-bottom: 8px; }
.article-caption { text-align: center; color: var(--muted); font-size: .78rem; margin-bottom: 24px; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: start;
  padding-bottom: 50px;
}
.prose { max-width: 70ch; margin-inline: auto; font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.8; }
.prose p { margin: 0 0 1.4em; }
.prose h2 { font-size: 1.6rem; line-height: 1.3; margin: 2em 0 .6em; letter-spacing: -.01em; }
.prose h3 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 1.4em; }
.prose li { margin-bottom: .5em; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.8em 0;
  padding: .2em 0 .2em 1.2em;
  font-style: italic;
  color: var(--muted);
}
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }

.share-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-block: 20px; border-top: 1px solid var(--border); max-width: 70ch; margin: 30px auto 0; }
.share-bar span { font-size: .8rem; font-weight: 700; color: var(--muted); margin-right: 4px; }
.share-bar a {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: .78rem;
  font-weight: 600;
}

/* ---------- Simple pages ---------- */
.page-head { padding-block: 52px 28px; border-bottom: 1px solid var(--border); margin-bottom: 36px; }
.page-head h1 { font-family: var(--font-serif); font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 8px; letter-spacing: -.02em; }
.page-head p { color: var(--muted); max-width: 65ch; margin: 0; }
.page-body { max-width: 760px; padding-bottom: 70px; }
.page-body h2 { font-family: var(--font-serif); font-size: 1.45rem; margin-top: 2em; }
.page-body p { color: var(--muted); }
.info-box { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 8px; padding: 16px 20px; margin: 24px 0; }
.info-box p { margin: 0; color: var(--text); }

.contact-form { display: grid; gap: 16px; max-width: 560px; }
.contact-form label { display: grid; gap: 6px; font-size: .85rem; font-weight: 700; }
.contact-form input, .contact-form textarea {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.contact-form textarea { min-height: 140px; resize: vertical; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  padding-block: 46px 34px;
}
.site-footer h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer a { font-size: .88rem; color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { color: var(--muted); font-size: .88rem; max-width: 38ch; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-block: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: space-between;
  color: var(--muted);
  font-size: .78rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout, .article-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  .nav-toggle { display: block; order: 3; }
  .header-inner { flex-wrap: wrap; min-height: 64px; gap: 12px; }
  .brand { margin-right: auto; }
  .site-nav {
    display: none;
    order: 5;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 14px;
    border-top: 1px solid var(--border);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 9px 2px; }
  .hero-grid { grid-template-columns: 1fr; }
  .newsletter .container { flex-direction: column; align-items: stretch; }
}

@media (max-width: 560px) {
  .container { width: min(100% - 28px, var(--container)); }
  .card-grid, .sidebar, .footer-grid { grid-template-columns: 1fr; }
  .mini-story { grid-template-columns: 92px 1fr; }
  .newsletter form { flex-direction: column; }
  .footer-bottom { flex-direction: column; }
  .breaking .container { flex-wrap: wrap; }
}

@media print {
  .site-header, .breaking, .newsletter, .site-footer, .ad-slot, .share-bar { display: none !important; }
  body { color: #000; }
}
