/* ============ MERIDIAN — shared styles ============ */
:root {
  --bg: #f6f4ef;
  --bg-elev: #ffffff;
  --ink: #141413;
  --ink-2: #3a3936;
  --ink-3: #6b6963;
  --ink-4: #a6a39c;
  --rule: #e4e1d8;
  --accent: #2f5d53;       /* muted clinical teal-green */
  --accent-ink: #1c3c35;
  --accent-wash: #e6ece9;
  --warn: #8a3a2b;
  --serif: "Fraunces", Georgia, serif;
  --display: "Inter Tight", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --maxw: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
}

[data-theme="dark"] {
  --bg: #0f0f0e;
  --bg-elev: #18181633;
  --ink: #f2efe8;
  --ink-2: #d4d1c8;
  --ink-3: #9a968c;
  --ink-4: #5c5a53;
  --rule: #2a2925;
  --accent: #9ac7bb;
  --accent-ink: #c6ddd6;
  --accent-wash: #1b2722;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.55;
  font-size: 16px;
  transition: background 250ms ease, color 250ms ease;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--accent-ink); border-bottom: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); }
a.link:hover { border-bottom-color: var(--accent); }
img { display: block; max-width: 100%; }

/* layout */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* type */
.display {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.028em;
  line-height: 1.02;
}
.eyebrow {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; color: var(--ink-3); }
.kicker { color: var(--accent-ink); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
.deck { font-size: 19px; line-height: 1.45; color: var(--ink-2); max-width: 62ch; }
.byline { font-size: 13px; color: var(--ink-3); }
.byline strong { color: var(--ink-2); font-weight: 600; }

/* Header */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(140%) blur(8px);
}
.masthead-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px var(--gutter);
  gap: 24px;
}
.masthead-left, .masthead-right { display: flex; gap: 22px; align-items: center; font-size: 13px; color: var(--ink-2); }
.masthead-right { justify-content: flex-end; }
.masthead-left a:hover, .masthead-right a:hover { color: var(--ink); }
.logo {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.03em;
  display: flex; align-items: baseline; gap: 6px;
}
.logo .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; transform: translateY(-2px); }
.nav-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--rule); border-radius: 999px;
  font-size: 12px; color: var(--ink-3);
}
.nav-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Sub-nav (topic bar) */
.subnav {
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  overflow-x: auto;
}
.subnav-inner {
  display: flex; gap: 28px; padding: 12px var(--gutter);
  white-space: nowrap;
  color: var(--ink-3);
}
.subnav-inner a.active { color: var(--ink); }
.subnav-inner a:hover { color: var(--ink); }

/* Footer */
.foot {
  border-top: 1px solid var(--rule);
  margin-top: 80px;
  padding: 64px var(--gutter) 40px;
  background: var(--bg);
}
.foot-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 48px;
}
.foot h5 { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 14px; font-weight: 600; }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
.foot ul a:hover { color: var(--ink); }
.foot-base {
  max-width: var(--maxw); margin: 56px auto 0;
  padding-top: 24px; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--ink-3);
}
.foot-disclaim {
  max-width: 66ch; font-size: 12px; color: var(--ink-3); line-height: 1.55;
  margin-top: 16px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: var(--body); font-size: 14px; font-weight: 500;
  border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg);
  cursor: pointer; transition: all 180ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .btn.accent { color: var(--ink); }
.btn .arr { transition: transform 200ms; }
.btn:hover .arr { transform: translateX(3px); }

/* Card — article */
.card { display: grid; gap: 14px; }
.card .thumb {
  aspect-ratio: 4/3; background: var(--rule); border-radius: 4px;
  overflow: hidden; position: relative;
}
.card .thumb.tall { aspect-ratio: 3/4; }
.card .thumb.wide { aspect-ratio: 16/9; }
.card h3 {
  font-family: var(--display); font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.12;
  margin: 0; font-size: 22px; color: var(--ink);
}
.card h3 a:hover { color: var(--accent-ink); }
.card .meta { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--ink-3); }
.card .meta .cat { color: var(--accent-ink); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.card .dek { font-size: 14px; color: var(--ink-2); line-height: 1.5; }

/* Placeholder image (Pexels-swap later) */
.ph {
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(135deg,
      color-mix(in oklab, var(--ink) 6%, transparent) 0 1px,
      transparent 1px 8px),
    linear-gradient(180deg,
      color-mix(in oklab, var(--ink) 10%, var(--bg)),
      color-mix(in oklab, var(--ink) 4%, var(--bg)));
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 12px; font-family: var(--mono); font-size: 10px;
  color: var(--ink-3);
}
.ph .tag { background: var(--bg); padding: 3px 6px; border-radius: 2px; }

/* Section header */
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 40px 0 20px; gap: 24px; border-bottom: 1px solid var(--rule); margin-bottom: 32px;
}
.sec-head h2 {
  font-family: var(--display); font-weight: 500; letter-spacing: -0.02em;
  font-size: 28px; margin: 0;
}
.sec-head .more { font-size: 13px; color: var(--ink-3); }
.sec-head .more:hover { color: var(--ink); }

/* Ticker bar */
.ticker {
  border-bottom: 1px solid var(--rule);
  background: var(--accent-wash);
  font-family: var(--mono); font-size: 11px;
  color: var(--accent-ink);
  padding: 8px var(--gutter);
  display: flex; gap: 40px; overflow: hidden; white-space: nowrap;
}
.ticker span::before { content: "●"; color: var(--accent); margin-right: 8px; font-size: 8px; vertical-align: middle; }

/* Tweaks panel */
.tweaks-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); border: 0;
  font-family: var(--body); font-size: 13px; font-weight: 500;
  cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none;
}
.tweaks-panel {
  position: fixed; right: 20px; bottom: 72px; z-index: 100;
  width: 320px; background: var(--bg-elev);
  border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  padding: 18px; display: none;
  font-size: 13px;
  max-height: 70vh; overflow-y: auto;
}
[data-theme="dark"] .tweaks-panel { background: #1c1c1a; }
.tweaks-panel h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.tweaks-panel .sub { color: var(--ink-3); font-size: 11px; margin-bottom: 14px; }
.tweaks-panel label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 6px; font-weight: 600; }
.tweaks-panel input[type="text"], .tweaks-panel select {
  width: 100%; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--bg);
  color: var(--ink); font-family: var(--body); font-size: 13px;
}
.tweak-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tweak-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  outline: 1px solid var(--rule);
}
.tweak-swatch.active { border-color: var(--ink); }
.tweak-seg {
  display: flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden;
}
.tweak-seg button {
  flex: 1; padding: 7px 10px; border: 0; background: transparent;
  color: var(--ink-2); font-family: var(--body); font-size: 12px; cursor: pointer;
}
.tweak-seg button.active { background: var(--ink); color: var(--bg); }

/* Utility */
.hide-on-mobile { }
@media (max-width: 840px) {
  .hide-on-mobile { display: none !important; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .masthead-left, .masthead-right { gap: 14px; font-size: 12px; }
  .masthead-left a:not(.first), .masthead-right a:not(.first) { display: none; }
}
