/* ============================================================
   The Blair Mountain — base styles + theme system
   Three palettes (press / ridge / ledger) x two modes (day / night).
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f4efe6; --bg2: #fbf8f1; --ink: #1e1a16; --ink2: #6e6459; --line: #ddd3c2; --accent: #a83226;
}

body[data-palette="press"][data-mode="day"]   { --bg:#f4efe6; --bg2:#fbf8f1; --ink:#1e1a16; --ink2:#6e6459; --line:#ddd3c2; --accent:#a83226; }
body[data-palette="press"][data-mode="night"] { --bg:#171410; --bg2:#201c16; --ink:#ece4d6; --ink2:#9c917f; --line:#37312a; --accent:#d0543f; }
body[data-palette="ridge"][data-mode="day"]   { --bg:#edf1f2; --bg2:#f7fafa; --ink:#16232b; --ink2:#5d7078; --line:#cfd9dc; --accent:#c25a2e; }
body[data-palette="ridge"][data-mode="night"] { --bg:#0d141a; --bg2:#131e26; --ink:#dde7ec; --ink2:#84979f; --line:#26343d; --accent:#e07840; }
body[data-palette="ledger"][data-mode="day"]   { --bg:#f7f7f5; --bg2:#ffffff; --ink:#141414; --ink2:#6b6b66; --line:#e0e0da; --accent:#c22f2f; }
body[data-palette="ledger"][data-mode="night"] { --bg:#101010; --bg2:#1a1a19; --ink:#efefea; --ink2:#8f8f88; --line:#2c2c29; --accent:#e05545; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  transition: background .35s, color .35s;
}

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

@keyframes feedIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes vidprog { from { width: 0; } to { width: 100%; } }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 56px; }
.logo { font: 600 15px/1 Newsreader, serif; letter-spacing: .04em; white-space: nowrap; }
.logo .site-beta { display: inline-block; font: 600 9px/1 Archivo, sans-serif; letter-spacing: .08em; text-transform: none; color: var(--ink2); border: 1px solid var(--ink2); padding: 3px 7px; border-radius: 3px; vertical-align: middle; margin-left: 6px; position: relative; top: -1px; }

.nav { display: flex; gap: 2px; flex: 1; justify-content: center; }
.nav-btn {
  font: 600 12px/1 Archivo, sans-serif; letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 14px; border: none; border-radius: 2px; cursor: pointer;
  background: transparent; color: var(--ink2); box-shadow: inset 0 -2px 0 transparent;
  transition: background .2s, color .2s;
}
.nav-btn:hover { color: var(--accent); }
.nav-btn.active { background: var(--ink); color: var(--bg); box-shadow: inset 0 -2px 0 var(--accent); }
.nav-btn.active:hover { color: var(--bg); }

.theme-toggle {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
  user-select: none; transition: border-color .2s; -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg circle, .theme-toggle svg line, .theme-toggle svg path { fill: var(--ink); stroke: var(--ink); }
.theme-wrap { position: relative; display: flex; align-items: center; }

.theme-menu {
  position: absolute; top: 42px; right: 0; z-index: 30; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 172px; padding: 6px;
  display: none; flex-direction: column; gap: 2px;
}
.theme-menu.open { display: flex; }
.theme-menu-label { font: 600 10px/1 Archivo, sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--ink2); padding: 8px 10px 6px; }
.theme-menu-item {
  display: flex; align-items: center; gap: 10px; font: 500 13px/1 Archivo, sans-serif; color: var(--ink);
  text-align: left; background: transparent; border: none; border-radius: 3px; padding: 9px 10px; cursor: pointer;
  width: 100%; transition: background .15s;
}
.theme-menu-item:hover { background: var(--bg); }
.theme-menu-item.active { background: var(--bg); }
.swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }
.theme-menu-item span.label { flex: 1; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: transparent; }
.theme-menu-item.active .dot { background: var(--accent); }
.menu-scrim { position: fixed; inset: 0; z-index: 29; display: none; }
.menu-scrim.open { display: block; }

/* ---------- hero ---------- */
.hero { position: relative; border-bottom: 1px solid var(--line); overflow: hidden; background: var(--bg); display: none; }
.hero.show { display: block; }
.hero-inner { padding: 56px 28px 0; position: relative; z-index: 2; }
.hero-title { font: 700 clamp(40px,6vw,72px)/1.02 Newsreader, serif; letter-spacing: -.01em; margin: 0; }
.hero-dek { font: italic 400 clamp(17px,2vw,21px)/1.5 Newsreader, serif; color: var(--ink2); max-width: 560px; margin: 16px 0 0; }
.hero-ridge { display: block; width: 100%; height: 150px; margin-top: -8px; }

/* ---------- feed sections ---------- */
.feed { display: none; animation: feedIn .45s ease both; }
.feed.active { display: block; }


/* ---------- videos ---------- */
.video-scroller { height: calc(100vh - 57px); overflow-y: auto; scroll-snap-type: y mandatory; }
.video-slide { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; padding: 0 28px; box-sizing: border-box; }
.video-card { width: min(100%, 960px, calc((100vh - 280px) * 1.7778)); }
.video-frame { position: relative; aspect-ratio: 16/9; background: repeating-linear-gradient(45deg, var(--bg2), var(--bg2) 9px, var(--line) 9px, var(--line) 10px); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-still-label { font: 400 12px/1.6 ui-monospace, monospace; color: var(--ink2); text-align: center; padding: 0 32px; }
.video-duration { position: absolute; right: 10px; top: 10px; background: var(--ink); color: var(--bg); font: 600 11px/1 Archivo, sans-serif; padding: 4px 6px; border-radius: 2px; }
.video-playing-badge { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; background: var(--ink); color: var(--bg); font: 600 10px/1 Archivo, sans-serif; letter-spacing: .12em; text-transform: uppercase; padding: 5px 8px; border-radius: 2px; }
.video-playing-badge .rec-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.video-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--line); }
.video-progress-bar { display: block; height: 100%; background: var(--accent); }
.video-progress-bar.animate { animation: vidprog linear both; }
.video-play-btn { position: absolute; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; opacity: .92; cursor: pointer; border: 0; }
.video-play-btn .tri { width: 0; height: 0; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent var(--bg); margin-left: 3px; }
.video-meta { display: flex; align-items: baseline; gap: 16px; margin-top: 14px; }
.video-src { font: 600 14px/1 Archivo, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.video-title { font: 600 28px/1.25 Newsreader, serif; }

/* mute overlay */
.video-mute-overlay { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); z-index: 100; background: rgba(208,84,63,.92); color: #fff; font: 700 22px/1 Archivo, sans-serif; letter-spacing: .04em; text-transform: uppercase; padding: 24px 48px; border-radius: 40px; border: 2px solid rgba(255,255,255,.25); cursor: pointer; display: flex; align-items: center; gap: 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: opacity .3s, transform .3s; box-shadow: 0 4px 24px rgba(0,0,0,.4); animation: mutePulse 2.4s ease-in-out infinite; }
@keyframes mutePulse { 0%, 100% { opacity: 1; box-shadow: 0 4px 24px rgba(0,0,0,.4); } 50% { opacity: .45; box-shadow: 0 4px 36px rgba(208,84,63,.6); } }
.video-mute-overlay:hover { background: rgba(168,50,38,.95); }
.video-mute-overlay.hidden { opacity: 0 !important; pointer-events: none; transform: translateX(-50%) translateY(10px); animation: none; }
.video-mute-overlay .mute-icon { font-size: 32px; }

/* ---------- articles ---------- */
.articles-list { max-width: 900px; margin: 0 auto; padding: 36px 28px 40px; }
.article-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 24px; align-items: baseline; padding: 26px 14px; margin: 0 -14px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 3px; transition: background .2s; }
.article-row:hover { background: var(--bg2); }
.article-kicker { font: 600 11px/1 Archivo, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.article-title { font: 600 22px/1.25 Newsreader, serif; }
.article-dek { font: 400 15px/1.55 Newsreader, serif; color: var(--ink2); margin-top: 7px; text-wrap: pretty; }
.article-byline { font: 500 12px/1.6 Archivo, sans-serif; color: var(--ink2); text-align: right; white-space: nowrap; }

/* ---------- essays ---------- */
.essays-list { max-width: 760px; margin: 0 auto; padding: 44px 28px 40px; display: flex; flex-direction: column; gap: 52px; }
.essay { cursor: pointer; }
.essay-meta { display: flex; align-items: baseline; gap: 14px; }
.essay-num { font: italic 400 15px/1 Newsreader, serif; color: var(--accent); }
.essay-sub { font: 500 12px/1 Archivo, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.essay-title { font: 700 clamp(26px,3.4vw,34px)/1.15 Newsreader, serif; margin: 12px 0 10px; transition: color .2s; }
.essay:hover .essay-title { color: var(--accent); }
.essay-dek { font: 400 17px/1.6 Newsreader, serif; color: var(--ink2); text-wrap: pretty; }
.essays-end { padding: 20px 0 48px; text-align: center; border-top: 1px solid var(--line); }
.essays-end .end-kicker { margin: 24px 0 10px; }

/* ---------- blair mountain ---------- */
.blair-wrap { max-width: 1160px; margin: 0 auto; padding: 44px 28px 40px; }
.blair-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: start; }
.blair-kicker { font: 600 11px/1 Archivo, sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.blair-h2 { font: 700 34px/1.15 Newsreader, serif; margin: 0 0 18px; }
.blair-p { font: 400 17px/1.65 Newsreader, serif; color: var(--ink2); text-wrap: pretty; margin: 0 0 14px; }
.timeline-title { font: 600 12px/1 Archivo, sans-serif; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 22px; }
.timeline { border-top: 2px solid var(--ink); padding-top: 26px; }
.timeline-row { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.timeline-date { font: 600 13px/1.5 Archivo, sans-serif; color: var(--accent); }
.timeline-event-title { font: 600 17px/1.3 Newsreader, serif; }
.timeline-text { font: 400 15px/1.55 Newsreader, serif; color: var(--ink2); margin-top: 5px; text-wrap: pretty; }

.blair-side { display: flex; flex-direction: column; gap: 28px; }
.pull-quote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; }
.pull-quote-text { font: italic 500 22px/1.4 Newsreader, serif; }
.pull-quote-attr { font: 500 12px/1 Archivo, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); margin-top: 12px; }
.media-box { aspect-ratio: 16/9; background: repeating-linear-gradient(45deg, var(--bg2), var(--bg2) 9px, var(--line) 9px, var(--line) 10px); border: 1px solid var(--line); border-radius: 3px; display: flex; align-items: center; justify-content: center; position: relative; }
.media-box.ratio-4-3 { aspect-ratio: 4/3; }
.media-caption { font: 400 13px/1.5 Archivo, sans-serif; color: var(--ink2); margin-top: 8px; }
.orgs-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 3px; padding: 24px; }
.orgs-title { font: 600 12px/1 Archivo, sans-serif; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 16px; }
.org-row { padding: 11px 0; border-bottom: 1px solid var(--line); }
.org-name { font: 600 15px/1.3 Newsreader, serif; }
.org-desc { font: 400 13px/1.5 Archivo, sans-serif; color: var(--ink2); margin-top: 3px; }
.orgs-note { font: 400 12px/1.6 Archivo, sans-serif; color: var(--ink2); margin-top: 14px; }

/* ---------- about ---------- */
.about-wrap { max-width: 720px; margin: 0 auto; padding: 48px 28px 40px; }
.about-h2 { font: 700 38px/1.1 Newsreader, serif; margin: 0 0 22px; }
.about-p, .about-wrap > p { font: 400 18px/1.7 Newsreader, serif; text-wrap: pretty; margin: 0 0 16px; }
.founder-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 3px; padding: 28px 30px; margin: 0 0 34px; }
.founder-kicker { font: 600 11px/1 Archivo, sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.founder-p, .founder-box > p { font: 400 17px/1.65 Newsreader, serif; text-wrap: pretty; margin: 0 0 14px; }
.founder-sig { font: italic 500 15px/1 Newsreader, serif; color: var(--ink2); margin-top: 18px; }
.principles { border-top: 2px solid var(--ink); padding-top: 24px; }
.principles-title { font: 600 12px/1 Archivo, sans-serif; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 18px; }
.principle-row { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.principle-num { font: italic 400 16px/1.5 Newsreader, serif; color: var(--accent); }
.principle-title { font: 600 16px/1.5 Newsreader, serif; }
.principle-text { font: 400 16px/1.5 Newsreader, serif; color: var(--ink2); }

/* ---------- onboarding step cards (in-feed) ---------- */

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg2); display: none; }
.site-footer.show { display: block; }
.footer-inner { padding: 28px; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-logo { font: 600 13px/1 Newsreader, serif; }
.footer-logo span { color: var(--ink2); font-weight: 400; }
.footer-note { font: 400 12px/1.6 Archivo, sans-serif; color: var(--ink2); }
.footer-links { font: 400 12px/1.6 Archivo, sans-serif; color: var(--ink2); }
.footer-links a { margin-left: 12px; }

@media (max-width: 860px) {
  .blair-grid { grid-template-columns: 1fr; }
  .article-row { grid-template-columns: 1fr; gap: 8px; }
  .article-byline { text-align: left; }
  .nav { gap: 0; overflow-x: auto; justify-content: flex-start; }
}
