/* Blue Dot News — newspaper aesthetic, modern and restrained.
   Serif for reading, a quiet sans for labels, one accent per story. */

:root {
  --ink:        #16161a;
  --ink-soft:   #3f4046;
  --muted:      #6c6d76;
  --hair:       #d9d7cf;
  --hair-soft:  #e9e7df;
  --paper:      #fbfaf6;
  --paper-2:    #f4f2ea;
  --accent:     #3a6ea5;
  --serif:      "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --display:    "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans:       "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --measure:    39rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.2rem);
  line-height: 1.72;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute; left: -999px;
}
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: .5rem .75rem; z-index: 10; }

a { color: inherit; }

/* ---------- Masthead ---------- */
.masthead { max-width: 64rem; margin: 0 auto; padding: 2.2rem 1.5rem 0; text-align: center; }
.masthead__rule { height: 2px; background: var(--ink); }
.masthead__rule--double {
  height: 1px; background: var(--ink); position: relative; margin-top: 4px;
}
.masthead__rule--double::before {
  content: ""; position: absolute; top: -4px; left: 0; right: 0; height: 3px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.masthead__wordmark {
  display: block; text-decoration: none; color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.6rem, 1.8rem + 3.6vw, 4.6rem);
  letter-spacing: -0.015em;
  line-height: 1.02;
  margin: 1.4rem 0 0.5rem;
}
.masthead__tagline {
  font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 1rem;
}
.masthead__meta {
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
  padding: 0.55rem 0; margin-bottom: 0.25rem;
}

main { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Shared ---------- */
.kicker {
  font-family: var(--sans); font-weight: 600; font-size: 0.74rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 0.5rem;
}
.byline {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.04em;
  color: var(--muted); margin: 0.6rem 0 0;
}

.hero {
  border-radius: 3px; overflow: hidden; background: #0b0c10;
  aspect-ratio: 20 / 9; margin: 1.4rem 0 0.4rem;
  box-shadow: 0 1px 0 var(--hair);
}
.hero svg { display: block; width: 100%; height: 100%; }
.hero__credit {
  font-family: var(--sans); font-size: 0.68rem; color: var(--muted);
  letter-spacing: 0.05em; margin: 0 0 1.5rem; text-align: right;
}

/* ---------- Front page lead ---------- */
.lead { padding: 2.6rem 0 2rem; border-bottom: 1px solid var(--hair); }
.lead__link { text-decoration: none; color: inherit; display: block; }
.lead .hero { aspect-ratio: 21 / 8; }
.lead__headline {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem);
  line-height: 1.04; letter-spacing: -0.018em; margin: 0.6rem 0 0.8rem;
  max-width: 22ch;
}
.lead__dek {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); color: var(--ink-soft);
  line-height: 1.5; margin: 0; max-width: 46ch; font-style: italic;
}
.lead__link:hover .lead__headline { color: var(--accent); }

/* ---------- Archive list ---------- */
.archive { padding: 2rem 0 1rem; }
.archive__title {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  margin: 0 0 1.4rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--ink);
}
.archive__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.card { border-bottom: 1px solid var(--hair); }
.card__link {
  display: grid; grid-template-columns: 1fr; gap: 0.1rem; padding: 1.5rem 0;
  text-decoration: none; color: inherit;
}
.card__headline {
  font-family: var(--display); font-weight: 500; font-size: 1.5rem;
  line-height: 1.12; letter-spacing: -0.01em; margin: 0.15rem 0 0.4rem; max-width: 30ch;
}
.card__dek { color: var(--ink-soft); margin: 0; max-width: 60ch; font-size: 1.02rem; line-height: 1.55; }
.card__link:hover .card__headline { color: var(--accent); }

/* ---------- Article ---------- */
.article { max-width: var(--measure); margin: 0 auto; padding: 2.8rem 0 1rem; }
.article > .kicker { text-align: left; }
.article__headline {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.8vw, 3.1rem);
  line-height: 1.06; letter-spacing: -0.02em; margin: 0.3rem 0 0.9rem;
}
.article__dek {
  font-size: clamp(1.12rem, 1rem + 0.5vw, 1.35rem); color: var(--ink-soft);
  font-style: italic; line-height: 1.5; margin: 0;
}
.tag-sample {
  font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--paper-2); border: 1px solid var(--hair); border-radius: 2px;
  padding: 0.1rem 0.45rem; color: var(--muted);
}
.article .hero { max-width: none; }

/* Reading-level control */
.levels {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border: 1px solid var(--ink); border-radius: 3px; overflow: hidden;
  margin: 0.6rem 0 2.2rem; background: var(--paper);
}
.levels__btn {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  border-right: 1px solid var(--hair); padding: 0.7rem 0.5rem; text-align: center;
  display: flex; flex-direction: column; gap: 0.15rem; transition: background .15s, color .15s;
  color: var(--ink);
}
.levels__btn:last-child { border-right: 0; }
.levels__name { font-family: var(--sans); font-weight: 600; font-size: 0.92rem; letter-spacing: 0.01em; }
.levels__blurb { font-family: var(--sans); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.02em; }
.levels__btn:hover { background: var(--paper-2); }
.levels__btn.is-active { background: var(--ink); color: var(--paper); }
.levels__btn.is-active .levels__blurb { color: rgba(255,255,255,0.62); }

.prose { margin: 0 0 1.3rem; }
.prose--lead::first-letter {
  font-family: var(--display); font-weight: 600; float: left; line-height: 0.78;
  font-size: 3.6em; padding: 0.06em 0.09em 0 0; color: var(--accent);
}

/* Spark classroom box */
.spark-box {
  border: 1px solid var(--hair); border-left: 3px solid var(--accent);
  background: var(--paper-2); border-radius: 3px; padding: 1.2rem 1.4rem; margin: 1.8rem 0 0.5rem;
}
.spark-box__title {
  font-family: var(--sans); font-weight: 600; font-size: 0.74rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.7rem;
}
.spark-box__list { margin: 0; padding-left: 1.2rem; }
.spark-box__list li { margin: 0 0 0.7rem; line-height: 1.55; }

/* Credits */
.credits { margin: 2.6rem 0 0; padding: 1.6rem 0 0; border-top: 2px solid var(--ink); }
.credits__title {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 1.1rem;
}
.credits__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.credits__person { border-left: 2px solid var(--accent); padding-left: 0.9rem; }
.credits__name { font-family: var(--display); font-weight: 600; font-size: 1.12rem; margin: 0; }
.credits__role { margin: 0.1rem 0 0; color: var(--ink-soft); }
.credits__inst { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); margin: 0.1rem 0 0; }
.credits__source { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin: 1.3rem 0 0; }
.credits__source a { color: var(--accent); }

/* References — textbook bibliography style; every fact carries a citation */
.refs { margin: 2.6rem 0 0; padding: 1.6rem 0 0; border-top: 2px solid var(--ink); }
.refs__title {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 0.5rem;
}
.refs__intro { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); line-height: 1.55; margin: 0 0 1.3rem; max-width: 60ch; }
.refs__list { margin: 0; padding: 0 0 0 1.7rem; list-style: decimal; }
.refs__list li::marker { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); }
.refs__item { margin: 0 0 1rem; padding-left: 0.35rem; }
.refs__claim { display: block; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.refs__cite { display: block; font-family: var(--sans); font-size: 0.78rem; font-style: normal; margin-top: 0.25rem; }
.refs__cite a { color: var(--accent); text-decoration: none; }
.refs__cite a::before { content: "\2197\00a0"; }
.refs__cite a:hover { text-decoration: underline; }

.sample-note {
  font-family: var(--sans); font-size: 0.8rem; color: var(--muted); line-height: 1.5;
  background: var(--paper-2); border: 1px solid var(--hair); border-radius: 3px;
  padding: 0.9rem 1.1rem; margin: 1.8rem 0 0;
}
.back { font-family: var(--sans); font-size: 0.85rem; margin: 2rem 0 0; }
.back a { color: var(--accent); text-decoration: none; }
.back a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.footer { margin-top: 3rem; border-top: 2px solid var(--ink); background: var(--paper-2); }
.footer__inner { max-width: 44rem; margin: 0 auto; padding: 2.6rem 1.5rem 3rem; text-align: center; }
.footer__mark { font-family: var(--display); font-weight: 600; font-size: 1.5rem; margin: 0 0 0.6rem; }
.footer__mission { font-size: 1.08rem; color: var(--ink-soft); margin: 0 auto 1rem; max-width: 40ch; }
.footer__note, .footer__transparency {
  font-family: var(--sans); font-size: 0.82rem; color: var(--muted); line-height: 1.6;
  margin: 0 auto 0.6rem; max-width: 52ch;
}

/* ---------- Top / footer nav ---------- */
.topnav {
  display: flex; justify-content: center; gap: 1.6rem; flex-wrap: wrap;
  padding: 0.85rem 0 0;
}
.topnav a, .footer__nav a {
  font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); text-decoration: none;
}
.topnav a:hover, .footer__nav a:hover { color: var(--accent); }
.footer__nav { display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap; margin: 1.4rem 0 1rem; }

/* ---------- Epigraph (Sagan quote) ---------- */
.epigraph {
  max-width: 34rem; margin: 2rem auto 0.5rem; padding: 1.3rem 1rem 1.6rem;
  text-align: center; border-bottom: 1px solid var(--hair);
}
.epigraph__quote {
  font-family: var(--display); font-weight: 500; font-style: italic;
  font-size: clamp(1.15rem, 0.95rem + 1vw, 1.6rem); line-height: 1.3;
  letter-spacing: -0.01em; color: var(--ink); margin: 0; text-wrap: balance;
}
.epigraph__by {
  font-family: var(--sans); font-size: 0.76rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin-top: 1.3rem;
}
.epigraph__rule { display: block; width: 34px; height: 2px; background: var(--accent); margin: 0 auto 0.9rem; }
.epigraph__work { text-transform: none; letter-spacing: 0.02em; }

/* ---------- Share / use ---------- */
.share {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin: 2.4rem 0 0; padding: 1.4rem 0 0; border-top: 1px solid var(--hair);
}
.share__btn {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer; color: var(--ink);
  background: var(--paper); border: 1px solid var(--ink); border-radius: 3px;
  padding: 0.5rem 0.9rem; transition: background .15s, color .15s;
}
.share__btn:hover { background: var(--paper-2); }
.share__btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.share__btn--primary:hover { filter: brightness(0.94); background: var(--accent); }
.share__reuse {
  flex-basis: 100%; font-family: var(--sans); font-size: 0.78rem; color: var(--muted);
  line-height: 1.5; margin: 0.4rem 0 0;
}
.share__reuse a, .footer__license a { color: var(--accent); }
.footer__license { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin: 0.4rem auto 0; max-width: 50ch; }

/* ---------- Static pages (Educators) ---------- */
.page { max-width: var(--measure); margin: 0 auto; padding: 2.8rem 0 1rem; }
.page__headline {
  font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  line-height: 1.07; letter-spacing: -0.02em; margin: 0.3rem 0 0.8rem;
}
.page__dek { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); color: var(--ink-soft); font-style: italic; line-height: 1.5; margin: 0 0 1.6rem; }
.page__h2 {
  font-family: var(--display); font-weight: 600; font-size: 1.45rem; letter-spacing: -0.01em;
  margin: 2.1rem 0 0.6rem; padding-top: 1.1rem; border-top: 1px solid var(--hair);
}
.page p { margin: 0 0 1.1rem; }
.page__list { margin: 0 0 1.2rem; padding-left: 1.2rem; }
.page__list li { margin: 0 0 0.6rem; line-height: 1.55; }

/* ---------- Print (classroom handout) ---------- */
@media print {
  .topnav, .footer__nav, .footer__license, .levels, .share, .hero__credit,
  .masthead__tagline, .masthead__meta, .back, .epigraph { display: none !important; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .level[hidden] { display: none !important; }
  .article, .page { max-width: 100%; }
  a { color: #000; text-decoration: none; }
  .hero { box-shadow: none; }
}

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .card__link { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .levels { grid-template-columns: 1fr; }
  .levels__btn { border-right: 0; border-bottom: 1px solid var(--hair); flex-direction: row; justify-content: space-between; align-items: baseline; }
  .levels__btn:last-child { border-bottom: 0; }
}

/* ===================================================================
   ENHANCEMENTS — buttons, reading time, accessibility, dark mode
   =================================================================== */

/* ---------- Buttons (calls-to-action on static pages) ---------- */
.btn {
  display: inline-block; font-family: var(--sans); font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0.01em; line-height: 1; padding: 0.85em 1.4em;
  border: 1px solid var(--accent); border-radius: 2px; color: var(--accent);
  background: transparent; text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn:hover, .btn:focus { background: var(--accent); color: var(--paper); }
.btn--primary { color: var(--paper); background: var(--accent); }
.btn--primary:hover, .btn--primary:focus { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--disabled {
  color: var(--muted); border-color: var(--hair); background: var(--paper-2);
  cursor: default; pointer-events: none;
}

/* ---------- Reading-time badge (inside each reading level) ---------- */
.readtime {
  display: block; margin: 0.2rem 0 1.2rem;
  font-family: var(--sans); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Keyboard focus (visible, on-brand) ---------- */
a:focus-visible, button:focus-visible, .levels__btn:focus-visible,
.share__btn:focus-visible, .topnav a:focus-visible, .footer__nav a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px;
}
.levels__btn.is-active:focus-visible { outline-color: var(--paper); }

/* ---------- Quiet polish ---------- */
::selection { background: var(--paper-2); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* ---------- Dark mode (warm newspaper inversion) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink:       #ece9e0;
    --ink-soft:  #c2bfb6;
    --muted:     #8f8d85;
    --hair:      #34332f;
    --hair-soft: #26251f;
    --paper:     #16161a;
    --paper-2:   #1f1f23;
    --accent:    #7fa9d4;
  }
  .masthead__rule, .masthead__rule--double { background: var(--ink-soft); }
  .masthead__rule--double::before { border-top-color: var(--ink-soft); border-bottom-color: var(--ink-soft); }
  /* Lift per-article accent TEXT so it stays legible on a dark ground
     (the inline --accent is per-story; color-mix lightens whatever it is). */
  .kicker, .back a, .credits__source a, .refs__cite a, .footer__license a,
  .share__reuse a, .grounding__source a, .card__link:hover .card__headline,
  .lead__link:hover .lead__headline {
    color: color-mix(in srgb, var(--accent), white 36%);
  }
  .prose--lead::first-letter { color: color-mix(in srgb, var(--accent), white 36%); }
}

/* ---------- Archive page rows + homepage "browse more" ---------- */
.archive__row { margin: 0 0 0.7rem; line-height: 1.4; }
.archive__row a { font-family: var(--display); font-size: 1.08rem; color: var(--ink); text-decoration: none; }
.archive__row a:hover { color: var(--accent); }
.archive__date { display: block; font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted); margin-top: 0.1rem; }
.archive__more { margin: 1.6rem 0 0; }
.archive__more a { font-family: var(--sans); font-size: 0.85rem; color: var(--accent); text-decoration: none; }
.archive__more a:hover { text-decoration: underline; }

/* ---------- Print: hide placeholders/badges ---------- */
@media print { .btn, .readtime { display: none !important; } }
