/* =============================================================
   CLAWS REPORT — INKED TABLOID
   Editorial newsprint front page, pressroom energy.
   ============================================================= */

/* ── COLOR & TEXTURE: LIGHT ("Newsprint") ── */
:root {
  --paper:        #f3ecd9;   /* warm newsprint cream */
  --paper-deep:   #ece3cd;   /* slightly toasted edge */
  --paper-tint:   #e6dbc1;   /* gutter shade */
  --ink:          #14110d;   /* press black */
  --ink-soft:     #3a342b;
  --ink-fade:     #6b6354;
  --rule:         #b8ad93;
  --rule-soft:    #d3c9ad;
  --stamp:        #b21717;   /* breaking / top story red */
  --stamp-deep:   #7a0e0e;
  --visited:      #6e4a2c;   /* faded ink brown */
  --highlight:    #f6e9a8;   /* highlighter yellow for active row */
  --grain-opacity: 0.18;
}

/* ── COLOR & TEXTURE: DARK ("Pressroom") ── */
[data-theme="mocha"] {
  --paper:        #14141a;
  --paper-deep:   #1b1b22;
  --paper-tint:   #20202a;
  --ink:          #ece4d2;
  --ink-soft:     #c9c2b0;
  --ink-fade:     #9a9484;
  --rule:         #3a3a47;
  --rule-soft:    #2a2a35;
  --stamp:        #ff6b6b;
  --stamp-deep:   #c93131;
  --visited:      #b09f88;
  --highlight:    #3a3520;
  --grain-opacity: 0.10;
}

/* ── RESET ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scrollbar-color: var(--rule) var(--paper);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

/* Paper grain — fixed background using an SVG noise filter */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}

[data-theme="mocha"] body::before {
  mix-blend-mode: screen;
}

body > * {
  position: relative;
  z-index: 1;
}

/* ── LINKS (default) ── */
a {
  color: var(--ink);
  text-decoration: none;
  text-decoration-skip-ink: auto;
}

a:hover {
  color: var(--stamp);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:visited {
  color: var(--visited);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--stamp);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ── ACCESSIBILITY ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  position: fixed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================================
   MASTHEAD
   ============================================================= */
.header {
  text-align: center;
  padding: 28px 16px 18px;
  position: relative;
  border-bottom: 4px double var(--ink);
  background:
    linear-gradient(180deg, var(--paper-deep) 0%, var(--paper) 100%);
}

.header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -10px;
  height: 2px;
  background: var(--ink);
  opacity: 0.95;
}

.header h1 {
  font-family: 'Big Shoulders Display', 'Oswald', Impact, sans-serif;
  font-weight: 900;
  font-stretch: condensed;
  font-size: clamp(58px, 11vw, 132px);
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 0.88;
  text-transform: uppercase;
  /* Mild ink-press feel */
  text-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.header .tagline-sub {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.38em;
  text-transform: uppercase;
  margin-top: 14px;
  padding: 4px 14px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Dateline row beneath masthead — wire-service style */
.dateline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 1140px;
  margin: 14px auto 0;
  padding: 8px 24px 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dateline time {
  color: var(--ink);
}

.dateline .dateline-center {
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

/* ── THEME TOGGLE — pinned to masthead corner ── */
.theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  width: 38px;
  height: 38px;
  font-size: 15px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  background: var(--ink);
  transform: translateY(-1px);
}

/* =============================================================
   TOP STORY — the marquee banner
   ============================================================= */
.top-story {
  max-width: 1100px;
  margin: 36px auto 0;
  padding: 0 24px 28px;
  text-align: center;
  position: relative;
}

/* "BREAKING" stamp above headline */
.top-story::before {
  content: "★ BREAKING ★";
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--stamp);
  padding: 5px 14px 4px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--stamp-deep);
  box-shadow: 2px 2px 0 var(--stamp-deep);
  transform: rotate(-1.2deg);
}

.top-story h2 {
  font-family: 'Big Shoulders Display', 'Oswald', Impact, sans-serif;
  font-weight: 900;
  font-stretch: condensed;
  font-size: clamp(40px, 6.5vw, 78px);
  line-height: 0.96;
  letter-spacing: 0.005em;
  max-width: 950px;
  margin: 0 auto;
  text-transform: uppercase;
}

.top-story a {
  color: var(--ink);
  display: block;
}

.top-story a:hover {
  color: var(--stamp);
  text-decoration: none;
}

.top-story a:visited {
  color: var(--ink-soft);
}

.top-story .source {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-fade);
  margin-top: 16px;
}

.top-story .source::before,
.top-story .source::after {
  content: "—";
  margin: 0 10px;
  color: var(--rule);
}

/* =============================================================
   SECONDARY TOP STORIES — flanking the lead
   ============================================================= */
.top-stories-secondary {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 18px 24px 22px;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 28px;
  align-items: start;
  border-top: 1px solid var(--ink);
  border-bottom: 4px double var(--ink);
  position: relative;
}

/* Vertical center rule between the two secondary stories */
.top-stories-secondary::before {
  content: "";
  grid-column: 2;
  align-self: stretch;
  background: var(--rule);
  width: 1px;
}

.top-stories-secondary .secondary-story {
  text-align: center;
}

.top-stories-secondary .secondary-story:nth-of-type(1) {
  grid-column: 1;
}

.top-stories-secondary .secondary-story:nth-of-type(2) {
  grid-column: 3;
}

.top-stories-secondary .secondary-story a {
  font-family: 'Big Shoulders Display', 'Oswald', Impact, sans-serif;
  font-weight: 800;
  font-stretch: condensed;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--stamp);
  text-transform: uppercase;
  display: block;
}

.top-stories-secondary .secondary-story a:visited {
  color: var(--visited);
}

.top-stories-secondary .secondary-story a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.top-stories-secondary .secondary-story .source {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-fade);
  margin-top: 8px;
}

/* =============================================================
   COLUMNS
   ============================================================= */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 18px 40px;
  gap: 0;
}

.column {
  padding: 0 22px;
  position: relative;
}

/* Vertical dotted rule on right edge of columns 1, 2, 4, 5 (not 3/6 — end of row) */
.column:not(:nth-child(3n))::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 0;
  width: 1px;
  background:
    repeating-linear-gradient(180deg,
      var(--rule) 0 6px,
      transparent 6px 10px);
}

/* Horizontal rule between row 1 and row 2 (columns 4-6 are row 2 in a 3-col grid) */
.column:nth-child(n+4) {
  padding-top: 26px;
  margin-top: 22px;
  border-top: 2px solid var(--ink);
}

/* ── SECTION HEADERS ── */
.section-header {
  font-family: 'Big Shoulders Display', 'Oswald', Impact, sans-serif;
  font-weight: 900;
  font-stretch: condensed;
  font-size: 22px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 0 8px;
  margin-bottom: 6px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-header::after {
  content: attr(data-count);
  margin-left: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-fade);
  text-transform: uppercase;
}

/* ── STORY LINKS ── */
.story-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.story {
  padding: 13px 8px 13px 0;
  border-bottom: 1px solid var(--rule-soft);
  position: relative;
  transition: background 0.15s ease, padding 0.15s ease;
}

.story:last-child {
  border-bottom: none;
}

.story a {
  font-family: 'Big Shoulders Display', 'Oswald', Impact, sans-serif;
  font-weight: 700;
  font-stretch: condensed;
  font-size: 17px;
  line-height: 1.12;
  display: block;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.005em;
}

.story a:visited {
  color: var(--ink-fade);
}

.story a:hover {
  color: var(--stamp);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.story .source {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-fade);
}

/* Keyboard navigation highlight */
.story.active {
  background: var(--highlight);
  padding-left: 10px;
  padding-right: 10px;
  margin-left: -10px;
  margin-right: -10px;
  border-bottom-color: var(--ink);
  box-shadow: inset 4px 0 0 var(--stamp);
}

/* =============================================================
   FOOTER
   ============================================================= */
.footer {
  margin-top: 12px;
  padding: 22px 16px 30px;
  text-align: center;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-top: 4px double var(--ink);
}

.footer .kb-hint {
  font-size: 10px;
  color: var(--ink-fade);
  margin-top: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer .a11y-link {
  font-size: 10px;
  color: var(--ink-fade);
  margin-top: 22px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer .a11y-link a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.footer .a11y-link a:hover {
  color: var(--stamp);
}

kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 1px 6px 0;
  border-radius: 2px;
  font-size: 0.95em;
  box-shadow: 1px 1px 0 var(--ink);
}

/* =============================================================
   REFRESH TOAST
   ============================================================= */
.refresh-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 0;
  padding: 12px 18px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 4px 4px 0 var(--stamp);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.refresh-toast.visible {
  opacity: 1;
  pointer-events: auto;
}

.refresh-toast strong {
  color: var(--stamp);
  font-weight: 700;
}

.refresh-toast button {
  background: var(--stamp);
  color: var(--paper);
  border: none;
  border-radius: 0;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.refresh-toast button:hover {
  background: var(--paper);
  color: var(--ink);
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 960px) {
  .columns {
    grid-template-columns: 1fr 1fr;
    padding: 24px 14px 36px;
  }
  /* Reset 3-col rules — now 2-col */
  .column::after { display: none; }
  .column:nth-child(odd)::after {
    content: "";
    display: block;
    position: absolute;
    top: 8px;
    bottom: 8px;
    right: 0;
    width: 1px;
    background:
      repeating-linear-gradient(180deg,
        var(--rule) 0 6px,
        transparent 6px 10px);
  }
  /* Horizontal rule between rows of 2 (every 3rd row starts at child 3, 5) */
  .column:nth-child(n+4) {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
  }
  .column:nth-child(n+3) {
    padding-top: 22px;
    margin-top: 18px;
    border-top: 1px solid var(--rule);
  }
}

@media (max-width: 700px) {
  body {
    font-size: 16px;
  }
  .header {
    padding: 22px 14px 14px;
  }
  .dateline {
    flex-direction: column;
    text-align: center;
    padding: 8px 14px 0;
    gap: 4px;
  }
  .dateline > * {
    text-align: center;
  }
  .top-story {
    margin-top: 24px;
    padding: 0 16px 22px;
  }
  .top-stories-secondary {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 14px 16px 20px;
  }
  .top-stories-secondary::before {
    display: none;
  }
  .top-stories-secondary .secondary-story:nth-of-type(1),
  .top-stories-secondary .secondary-story:nth-of-type(2) {
    grid-column: 1;
  }
  .top-stories-secondary .secondary-story:nth-of-type(1) {
    border-bottom: 1px dashed var(--rule);
    padding-bottom: 18px;
  }
  .columns {
    grid-template-columns: 1fr;
    padding: 22px 16px 36px;
  }
  .column,
  .column:nth-child(n+3),
  .column:nth-child(n+4) {
    padding: 0;
    margin: 0 0 24px;
    border-top: none;
  }
  .column::after,
  .column:nth-child(odd)::after {
    display: none;
  }
  .column:not(:last-child) {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 12px;
  }
  .theme-toggle {
    top: 14px;
    right: 12px;
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 420px) {
  .header h1 {
    font-size: 54px;
  }
}
