/* ============================================================================
   STV News — Archive article stylesheet
   Shared, unchanged, across every archived page. Root-relative: /archive.css
   Vanilla CSS. No build step. Re-theme the whole archive from :root below.
   ========================================================================== */

/* --- Self-hosting note --------------------------------------------------- */
/* Inter is loaded via <link> in the HTML head (Google Fonts) for convenience.
   For true long-term permanence, self-host: drop Inter's woff2 files at
   /fonts/ and replace the head <link> with @font-face rules pointing there.
   Either way, --font-sans falls back to the system stack so the page never
   breaks if Inter fails to load. */

/* ============================================================================
   1. Design tokens — edit here to re-theme the entire archive
   ========================================================================== */
:root {
  /* Type ------------------------------------------------------------------ */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  --text-xs:   0.8rem;
  --text-sm:   0.9rem;
  --text-base: clamp(1.1rem, 1.02rem + 0.3vw, 1.2rem);
  --text-lg:   clamp(1.25rem, 1.1rem + 0.6vw, 1.4rem);
  --text-xl:   clamp(1.5rem, 1.25rem + 1vw, 1.8rem);
  --text-2xl:  clamp(1.9rem, 1.5rem + 1.6vw, 2.3rem);
  --text-3xl:  clamp(2.2rem, 1.6rem + 3vw, 3.4rem);

  --leading-tight: 1.15;
  --leading-snug:  1.35;
  --leading-body:  1.65;

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;

  /* Spacing scale --------------------------------------------------------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Measure / widths ------------------------------------------------------ */
  --measure: 46rem;         /* body reading column                           */
  --measure-wide: 56rem;    /* header, notice, footer alignment              */
  --gutter: clamp(1.25rem, 5vw, 3rem);

  /* Colour — near-white ground, dark ink, one solid brand blue ------------ */
  --brand:        #02a1df;
  --brand-strong: #0284b8;
  --brand-ink:    #06617f;

  --paper:        #ffffff;
  --surface:      #ffffff;
  --ink:          #1a1a1a;
  --ink-muted:    #5c5c5c;
  --ink-faint:    #86868a;
  --rule:         #e2e2e4;
  --rule-strong:  #cfcfd2;

  --notice-bg:     #eef1f5;
  --notice-border: #dde1e8;

  --focus: #02a1df;
  --selection-bg: #d3eefb;

  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand:        #3fc3f0;
    --brand-strong: #6ad0f2;
    --brand-ink:    #bfeaf9;

    --paper:        #17181a;
    --surface:      #1d1f23;
    --ink:          #e8e6e1;
    --ink-muted:    #b0ada6;
    --ink-faint:    #86837d;
    --rule:         #2c2e33;
    --rule-strong:  #3a3d43;

    --notice-bg:     #1e2024;
    --notice-border: #2c2e33;

    --focus: #3fc3f0;
    --selection-bg: #223140;
  }
}

/* ============================================================================
   2. Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}

::selection { background: var(--selection-bg); }
img, svg { max-width: 100%; height: auto; }
img { display: block; }
h1, h2, h3, h4, p, ul, ol, blockquote, figure { margin: 0; }

a {
  color: var(--brand-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s var(--ease);
}
a:hover { color: var(--brand-strong); }

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  transform: translateY(-160%);
  z-index: 50;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: transform 0.18s var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

.wrap {
  width: 100%;
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ============================================================================
   3. Masthead
   ========================================================================== */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}
.masthead__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
}
.masthead__logo { height: 30px; width: auto; }
.masthead__word {
  font-size: 1.4rem;
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.masthead__word .accent { color: var(--brand); }
.masthead__home {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--ink);
  white-space: nowrap;
}
.masthead__home:hover { color: var(--brand-ink); }
.masthead__home svg { width: 14px; height: 14px; }

/* ============================================================================
   4. Archived notice — slim, always-visible, never mistaken for current news
   ========================================================================== */
.archived {
  background: var(--notice-bg);
  border-bottom: 1px solid var(--notice-border);
}
.archived__inner {
  padding-block: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
.archived__inner strong { color: var(--ink); font-weight: var(--weight-semi); }
.archived__cta {
  font-weight: var(--weight-semi);
  color: var(--brand-ink);
  white-space: nowrap;
}
.archived__cta:hover { color: var(--brand-strong); }

/* ============================================================================
   5. Article
   ========================================================================== */
.article { padding-block: var(--space-7) var(--space-9); }
.article__header { max-width: var(--measure); margin-inline: auto; }

.article__headline {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.article__dek {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--ink-muted);
  margin-top: var(--space-4);
  text-wrap: pretty;
}

.article__byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-block: var(--space-4);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-sm);
}
.article__byline-meta { line-height: var(--leading-snug); }
.article__author { font-weight: var(--weight-semi); color: var(--ink); }
.article__byline time { display: block; color: var(--ink-muted); }
.article__section {
  font-weight: var(--weight-medium);
  color: var(--ink-muted);
  white-space: nowrap;
}
.article__section a { color: var(--brand-ink); font-weight: var(--weight-semi); }

/* --- Body flow ---------------------------------------------------------- */
.article__body { max-width: var(--measure); margin-inline: auto; margin-top: var(--space-6); }
.article__body > * + * { margin-top: var(--space-5); }
.article__body p { text-wrap: pretty; }

.article__body h2 {
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semi);
  letter-spacing: -0.01em;
  margin-top: var(--space-7);
}
.article__body h3 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semi);
  margin-top: var(--space-6);
}

.article__body ul, .article__body ol { padding-left: var(--space-5); }
.article__body li + li { margin-top: var(--space-2); }

.article__body blockquote {
  border-left: 3px solid var(--rule-strong);
  padding-left: var(--space-5);
  margin-inline: 0;
  color: var(--ink);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-style: normal;
}
.article__body blockquote p { font-weight: var(--weight-medium); }
.article__body blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--ink-muted);
}

.article__body figure { margin-block: var(--space-6); }
.article__body figure img { width: 100%; }
.article__body figcaption {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-faint);
  line-height: var(--leading-snug);
}

.article__body hr { border: 0; border-top: 1px solid var(--rule); margin-block: var(--space-7); }

.article__lead-media { max-width: var(--measure-wide); margin: var(--space-6) auto 0; }
.article__lead-media img { width: 100%; }
.article__lead-media figcaption {
  max-width: var(--measure);
  margin: var(--space-2) auto 0;
  font-size: var(--text-xs);
  color: var(--ink-faint);
}

/* ============================================================================
   6. Back-to-top (JS-enhanced, hidden by default; degrades to nothing)
   ========================================================================== */
.to-top {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.to-top[data-visible="true"] { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ============================================================================
   7. Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper);
  padding-block: var(--space-7);
  color: var(--ink-muted);
  font-size: var(--text-sm);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-6);
  justify-content: space-between;
}
.site-footer__brand { display: inline-flex; align-items: center; gap: var(--space-2); }
.site-footer__logo { height: 22px; width: auto; opacity: 0.9; }
.site-footer__word { font-weight: var(--weight-semi); color: var(--ink); }
.site-footer__word .accent { color: var(--brand); }
.site-footer__copy { line-height: var(--leading-snug); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.site-footer a { font-weight: var(--weight-medium); }

/* ============================================================================
   8. Print — a clean, faithful record on paper too
   ========================================================================== */
@media print {
  .to-top, .masthead__home { display: none; }
  body { background: #fff; color: #000; }
  .article { padding-block: 0; }
  a { color: #000; text-decoration: underline; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
