/* ═══════════════════════════════════════════════════════════════════════════
   News tab — "THE PIANO DESK" · TONEARM-style editorial front page
   Scope: #news-content only.  News overrides the app's dark chrome with its own
   cream "newsprint" surface (by design — it's its own publication).
   Type: Anton (display) · Playfair Display italic (titles) · Source Serif 4 (body)
         · JetBrains Mono (labels/meta).  Accent: vermillion.
   Class names are contracts — see src/js/news.js.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens (cream — applied regardless of app theme) ─────────────────────── */
#news-content {
  --news-paper:   #f4ebd9;   /* canvas newsprint cream */
  --news-paper-2: #efe4cf;   /* faint alt panel */
  --news-cover:   #e3d6ba;   /* cover-art placeholder */
  --news-cover-2: #dccdac;   /* placeholder stripe */

  --news-ink:   #1c1712;     /* near-black headlines */
  --news-ink-2: #3b342a;     /* body */
  --news-ink-3: #7c6f5a;     /* muted meta */
  --news-ink-4: #9c8e75;     /* faint */

  --news-red:      #d63a28;  /* vermillion accent */
  --news-red-deep: #b02a1b;  /* hover / active */
  --news-red-dim:  rgba(214, 58, 40, 0.10);

  --news-rule:   rgba(28, 23, 18, 0.16);
  --news-rule-2: rgba(28, 23, 18, 0.32);
  --news-black:  #15110d;    /* dark footer bookend */

  --news-display: 'Anton', 'Helvetica Neue', Impact, sans-serif;
  --news-title:   'Playfair Display', Georgia, 'Times New Roman', serif;
  --news-body:    'Source Serif 4', Georgia, serif;
  --news-mono:    'JetBrains Mono', 'Consolas', monospace;

  background: var(--news-paper);
  color: var(--news-ink-2);
}

/* ── Canvas ──────────────────────────────────────────────────────────────── */
.news-canvas {
  min-height: 120px;
  background: var(--news-paper);
  color: var(--news-ink-2);
}
.news-sheet {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 40px 0;
}

/* ── Masthead ────────────────────────────────────────────────────────────── */
.news-masthead { }
.news-masthead-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--news-rule);
  font-family: var(--news-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--news-ink-3);
}
.news-masthead-top .news-issue { text-align: center; white-space: nowrap; }
.news-account { display: none; }

body[data-tab="news"] .site-header,
body[data-tab="news"] .site-footer {
  display: none;
}

.news-masthead-main {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 28px;
  padding: 20px 0 16px;
}
.news-masthead-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--news-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--news-ink-3);
  padding-bottom: 8px;
}
.news-masthead-side.is-right { text-align: right; }
.news-masthead-side .news-strong { color: var(--news-ink); }
.news-masthead-side a { color: var(--news-red); text-decoration: none; font-weight: 600; }
.news-masthead-side a:hover { color: var(--news-red-deep); }

.news-masthead-center { text-align: center; }
.news-wordmark {
  margin: 0;
  font-family: var(--news-display);
  font-weight: 400;
  font-size: clamp(40px, 6.6vw, 88px);
  line-height: 0.88;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--news-ink);
  white-space: nowrap;
}
.news-tagline {
  margin: 8px 0 0;
  font-family: var(--news-title);
  font-style: italic;
  font-size: clamp(14px, 1.4vw, 18px);
  color: var(--news-red);
}

/* ── Ticker — "Now Reading" (vermillion) ─────────────────────────────────── */
.news-ticker {
  display: flex;
  align-items: stretch;
  height: 42px;
  margin-top: 2px;
  border-top: 2px solid var(--news-red);
  border-bottom: 2px solid var(--news-red);
  background: var(--news-paper);
  overflow: hidden;
}
.news-ticker-label {
  display: flex;
  align-items: center;
  flex: none;
  padding: 0 16px;
  background: var(--news-red);
  color: var(--news-paper);
  font-family: var(--news-display);
  font-size: 13px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.news-ticker-viewport {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 96%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 3%, #000 96%, transparent);
}
.news-ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: news-ticker-scroll 145s linear infinite;
}
.news-ticker-viewport:hover .news-ticker-track { animation-play-state: paused; }
.news-ticker-item { display: inline-flex; align-items: baseline; gap: 8px; padding: 0 2px; text-decoration: none; }
.news-ticker-source {
  font-family: var(--news-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--news-red);
}
.news-ticker-text { font-family: var(--news-title); font-style: italic; font-size: 14px; color: var(--news-ink); }
.news-ticker-item:hover .news-ticker-text { color: var(--news-red); }
.news-ticker-sep { margin: 0 18px; font-size: 8px; color: var(--news-red); transform: translateY(-2px); }
@keyframes news-ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── Section nav (genre filters) ─────────────────────────────────────────── */
.news-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 26px;
  padding: 13px 0;
  border-bottom: 1px solid var(--news-rule);
  font-family: var(--news-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.news-subnav-link {
  color: var(--news-ink-3);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none; border-top: 0; border-left: 0; border-right: 0;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.news-subnav-link:hover { color: var(--news-red); }
.news-subnav-link.is-active { color: var(--news-ink); border-bottom-color: var(--news-red); }

/* ── Front-page grid ─────────────────────────────────────────────────────── */
.news-frontpage {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 290px;
  margin-top: 26px;
}
.news-rail  { padding: 0 30px 0 0; border-right: 1px solid var(--news-rule); }
.news-hero-col { padding: 0 32px; }
.news-spin  { padding: 0 0 0 30px; border-left: 1px solid var(--news-rule); }

/* Section heads */
.news-secthead {
  margin: 0 0 4px;
  font-family: var(--news-display);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--news-ink);
}
.news-secthead.is-red { color: var(--news-red); }
.news-secthead-rule { height: 2px; background: var(--news-ink); margin: 0 0 14px; }
.news-secthead-rule.is-red { background: var(--news-red); }

/* ── On the Desk (left rail) ─────────────────────────────────────────────── */
.news-rail-list { list-style: none; margin: 0; padding: 0; }
.news-rail-item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--news-rule);
  text-decoration: none;
}
.news-rail-item:first-child { padding-top: 0; }
.news-rail-thumb {
  width: 46px; height: 46px; flex: none;
  background: var(--news-cover);
  background-image: repeating-linear-gradient(135deg, var(--news-cover) 0 6px, var(--news-cover-2) 6px 12px);
  object-fit: cover;
}
.news-rail-body { min-width: 0; }
.news-rail-source {
  display: block;
  font-family: var(--news-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--news-red);
  margin-bottom: 2px;
}
.news-rail-title {
  font-family: var(--news-title);
  font-style: italic;
  font-size: 15px;
  line-height: 1.2;
  color: var(--news-ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-rail-item:hover .news-rail-title { color: var(--news-red); }
.news-rail-num {
  font-family: var(--news-display);
  font-size: 19px;
  color: var(--news-red);
  align-self: start;
}

/* ── Story of the Week (hero) ────────────────────────────────────────────── */
.news-kicker {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 11px;
  background: var(--news-red);
  color: var(--news-paper);
  font-family: var(--news-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.news-hero-title-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.news-hero-title-link:hover .news-hero-title { color: var(--news-red); }
.news-cover-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.news-hero-title {
  margin: 0 0 8px;
  font-family: var(--news-title);
  font-weight: 800;
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.03;
  color: var(--news-ink);
  text-wrap: balance;
}
.news-hero-byline {
  margin: 0 0 18px;
  font-family: var(--news-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--news-ink-3);
}
.news-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: 0 0 14px;
  background: var(--news-cover);
  background-image: repeating-linear-gradient(135deg, var(--news-cover) 0 14px, var(--news-cover-2) 14px 28px);
  overflow: hidden;
}
.news-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-cover-label {
  position: absolute; left: 12px; bottom: 10px;
  font-family: var(--news-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--news-ink-3);
}
.news-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.news-tag {
  font-family: var(--news-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--news-ink);
  border: 1px solid var(--news-rule-2);
  padding: 4px 9px;
}
.news-hero-blurb {
  margin: 0;
  font-family: var(--news-body);
  font-size: 17px;
  line-height: 1.66;
  color: var(--news-ink-2);
  text-wrap: pretty;
}

/* ── The Spin (right) ────────────────────────────────────────────────────── */
.news-spin-item {
  display: block;
  padding: 0 0 15px;
  margin: 0 0 15px;
  border-bottom: 1px solid var(--news-rule);
  text-decoration: none;
}
.news-spin-item:last-child { border-bottom: 0; }
.news-spin-title {
  margin: 0 0 7px;
  font-family: var(--news-title);
  font-style: italic;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.18;
  color: var(--news-ink);
}
.news-spin-item:hover .news-spin-title { color: var(--news-red); }
.news-spin-byline {
  font-family: var(--news-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--news-ink-3);
}

/* ── Actions (hero + detail) ─────────────────────────────────────────────── */
.news-card-actions, .news-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 20px;
  margin-top: 18px;
}
.news-card-read-more, .news-read-more {
  font-family: var(--news-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--news-ink);
  text-decoration: none;
  border-bottom: 2px solid var(--news-red);
  padding-bottom: 2px;
}
.news-card-read-more:hover, .news-read-more:hover { color: var(--news-red); }
.news-card-external, .news-external {
  font-family: var(--news-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--news-ink-3);
  text-decoration: none;
}
.news-card-external:hover, .news-external:hover { color: var(--news-red); }

/* ── Dark footer bookend ─────────────────────────────────────────────────── */
.news-footer { margin-top: 44px; background: var(--news-black); color: #b8ac94; }
.news-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 28px;
}
.news-footer-mark {
  font-family: var(--news-display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--news-paper);
}
.news-disclaimer {
  margin: 0;
  max-width: 560px;
  font-family: var(--news-mono);
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.03em;
  color: #94886f;
}
.news-disclaimer a { color: var(--news-red); text-decoration: none; }
.news-disclaimer a:hover { color: #e8634f; }

/* ── States ──────────────────────────────────────────────────────────────── */
.news-loading, .news-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  font-family: var(--news-title);
  font-style: italic;
  font-size: 21px;
  color: var(--news-ink-3);
  text-align: center;
}
.news-empty a { color: var(--news-red); text-decoration: none; font-style: normal; }
.news-empty a:hover { color: var(--news-red-deep); }
.news-error { color: var(--news-red-deep, #a33); }
.news-retry-btn {
  margin-left: 0.5em;
  font: inherit;
  font-style: normal;
  cursor: pointer;
  color: var(--news-red);
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0.15em 0.55em;
}
.news-retry-btn:hover { color: var(--news-red-deep); }

/* ── Article detail ──────────────────────────────────────────────────────── */
.news-detail { max-width: 760px; margin: 0 auto; padding: 36px 0 8px; }
.news-back {
  display: inline-block;
  margin: 0 0 26px;
  font-family: var(--news-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--news-ink-3);
  text-decoration: none;
}
.news-back:hover { color: var(--news-red); }
.news-detail-header { margin: 0 0 22px; }
.news-detail-kicker { /* uses .news-kicker */ }
.news-detail-meta {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin: 0 0 14px;
  font-family: var(--news-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.news-detail-source { color: var(--news-red); font-weight: 600; }
.news-detail-date { color: var(--news-ink-3); }
.news-detail-title {
  margin: 0;
  font-family: var(--news-title);
  font-weight: 800;
  font-size: clamp(32px, 4.4vw, 50px);
  line-height: 1.04;
  color: var(--news-ink);
  text-wrap: balance;
}
.news-detail-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 24px 0;
  background: var(--news-cover);
  background-image: repeating-linear-gradient(135deg, var(--news-cover) 0 16px, var(--news-cover-2) 16px 32px);
  overflow: hidden;
}
.news-detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-detail-blurb {
  margin: 22px 0 0;
  font-family: var(--news-body);
  font-size: 19px;
  line-height: 1.72;
  color: var(--news-ink-2);
  text-wrap: pretty;
}
.news-detail-blurb::first-letter {
  float: left;
  margin: 0.04em 0.09em 0 0;
  font-family: var(--news-title);
  font-weight: 800;
  font-size: 3.4em;
  line-height: 0.78;
  color: var(--news-red);
}
.news-detail-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 30px 0 0; }
.news-primary-btn, .news-secondary-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 24px;
  font-family: var(--news-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .14s, border-color .14s, color .14s;
}
.news-primary-btn { background: var(--news-red); color: var(--news-paper); border: 2px solid var(--news-red); }
.news-primary-btn:hover { background: var(--news-red-deep); border-color: var(--news-red-deep); }
.news-secondary-btn { background: transparent; border: 2px solid var(--news-ink); color: var(--news-ink); }
.news-secondary-btn:hover { border-color: var(--news-red); color: var(--news-red); }

/* ── Focus-visible ───────────────────────────────────────────────────────── */
.news-subnav-link:focus-visible,
.news-rail-item:focus-visible,
.news-spin-item:focus-visible,
.news-card-read-more:focus-visible,
.news-card-external:focus-visible,
.news-read-more:focus-visible,
.news-external:focus-visible,
.news-back:focus-visible,
.news-ticker-item:focus-visible,
.news-primary-btn:focus-visible,
.news-secondary-btn:focus-visible,
.news-empty a:focus-visible,
.news-disclaimer a:focus-visible {
  outline: 2px solid var(--news-red);
  outline-offset: 3px;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .news-ticker-track { animation: none; }
  .news-ticker-viewport { overflow-x: auto; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE / TABLET
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1000px) {
  .news-frontpage { grid-template-columns: 1fr; }
  .news-rail, .news-spin { padding: 0; border: 0; }
  .news-hero-col { padding: 0; order: -1; }
  .news-rail  { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--news-rule); }
  .news-spin  { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--news-rule); }
}
@media (max-width: 640px) {
  .news-sheet { padding: 16px 16px 0; }
  .news-masthead-top { grid-template-columns: 1fr; justify-items: center; gap: 6px; text-align: center; }
  .news-masthead-top .news-account { justify-content: center; }
  .news-masthead-main { grid-template-columns: 1fr; gap: 14px; }
  .news-masthead-side { align-items: center; text-align: center; padding: 0; }
  .news-masthead-side.is-right { text-align: center; }
  .news-wordmark { white-space: normal; font-size: clamp(38px, 13vw, 60px); }
  .news-subnav { justify-content: flex-start; gap: 8px 18px; overflow-x: auto; flex-wrap: nowrap; }
  .news-ticker-label { font-size: 11px; padding: 0 12px; }
  .news-ticker-text { font-size: 12px; }
  .news-hero-title { font-size: clamp(28px, 8vw, 36px); }
  .news-footer-inner { padding: 24px 16px; }
  .news-detail-actions { flex-direction: column; align-items: stretch; }
  .news-primary-btn, .news-secondary-btn { justify-content: center; }
}
