/* Kamloops BC — classic newspaper styling.
   Black/white/deep-red palette, serif headlines, sans nav. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #faf8f4;
  color: #1a1a1a;
  font-family: Georgia, "Times New Roman", "Liberation Serif", serif;
  font-size: 17px;
  line-height: 1.55;
}

a { color: #1e4d8b; text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: #4a2a6b; }

img { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid #d8d2c4; margin: 1.25rem 0; }

/* ---- Layout ---- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ---- Masthead ---- */
.masthead {
  background: #fff;
  border-bottom: 1px solid #1a1a1a;
}

/* Hero band: Kamloops valley sunset photo (sepia/grain treatment baked into
   the asset by /tmp/gen_masthead.php) with the wordmark overlaid. */
.masthead-hero {
  position: relative;
  background-color: #1f1814;
  /* Image URL injected by PHP as --masthead-img so the version query can be
     refreshed on each file change (see helpers.php asset()). Falls back to
     the static path if the var isn't set. */
  background-image: var(--masthead-img, url("/assets/img/masthead-kamloops.jpg"));
  background-size: cover;
  background-position: center 55%;
  background-repeat: no-repeat;
  border-top: 2px solid #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Newspaper "distressed" overlay: faint horizontal hairlines + a soft
   vignette to push the eye toward the title. Both rendered in CSS so they
   stay crisp at any density. */
.masthead-hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(20,12,4,0.10) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 50% 55%, transparent 35%, rgba(20,12,4,0.55) 95%);
  pointer-events: none;
  z-index: 0;
}
.masthead-hero-inner {
  position: relative; z-index: 1;
  text-align: center;
  padding: 28px 20px;
  max-width: 1180px;
  width: 100%;
}
.masthead-title {
  display: inline-block;
  font-family: "Playfair Display", "Times New Roman", Georgia, serif;
  font-weight: 900;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  letter-spacing: 0.02em;
  color: #f5ead0;
  line-height: 1;
  /* Off-register print-bleed shadow — gives that ink-on-newsprint feel
     where the impression isn't quite aligned with the registration mark. */
  text-shadow:
     2px  2px 0 rgba(0,0,0,0.85),
     4px  4px 0 rgba(0,0,0,0.35),
    -1px  1px 0 rgba(177,18,27,0.55);
}
.masthead-title:hover { text-decoration: none; color: #fff; }
.masthead-title .mh-name { letter-spacing: 0.02em; }
.masthead-title .mh-tld  {
  font-style: italic;
  font-weight: 800;
  font-size: 0.55em;
  letter-spacing: 0;
  margin-left: 0.08em;
  color: #f5ead0;
  opacity: 0.9;
}
.masthead-hero .masthead-tag {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: #f5ead0;
  opacity: 0.92;
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  margin-top: 10px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.7);
}

/* Slim strip under the hero — small caps kicker + date, like the rule line
   below a vintage newspaper flag. */
.masthead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.masthead-row--slim { padding: 6px 0; }
.masthead-kicker {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #4a4034;
}
.masthead-date {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 0.9rem;
  color: #4a4034;
}
.masthead-rules {
  border-top: 1px solid #1a1a1a;
  border-bottom: 4px double #1a1a1a;
  height: 6px;
  padding: 0;
  margin: 0 auto;
}

/* ---- Nav ---- */
.mainnav {
  background: #fff;
  border-bottom: 1px solid #1a1a1a;
}
.mainnav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.mainnav a {
  display: block;
  padding: 12px 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1a1a1a;
}
.mainnav a:hover { background: #f1ece0; color: #b1121b; text-decoration: none; }
.mainnav a.is-active { color: #b1121b; border-bottom: 3px solid #b1121b; }

/* ---- Sponsor spot ---- */
.spot-row {
  background: #f1ece0;
  border-bottom: 1px solid #d8d2c4;
  padding: 14px 0;
}
.spot-wrap { display: flex; justify-content: center; }
.spot { display: flex; flex-direction: column; align-items: center; }
.spot-label {
  display: block;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #6b5a3f;
  margin-bottom: 4px;
}
.spot-h img { max-width: 100%; width: 728px; height: auto; border: 1px solid #d8d2c4; background: #fff; }
.spot-v img { width: 160px; height: 600px; border: 1px solid #d8d2c4; background: #fff; }
.spot-rail { text-align: center; }

/* ---- Main + rail ---- */
.main {
  display: block;
  padding: 22px 18px 40px;
}
.main.with-rail {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 36px;
}
@media (max-width: 900px) {
  .main.with-rail { grid-template-columns: 1fr; gap: 16px; }
  .rail { order: 2; }
}

.main-content section { margin-bottom: 32px; }

.rail {
  border-left: 1px solid #d8d2c4;
  padding-left: 18px;
}
@media (max-width: 900px) { .rail { border-left: 0; padding-left: 0; border-top: 1px solid #d8d2c4; padding-top: 16px; } }
.rail-block { margin-bottom: 26px; }
.rail-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: #6b5a3f;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1a1a1a;
}
.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-list li { padding: 8px 0; border-bottom: 1px dotted #d8d2c4; }
.rail-list li:last-child { border-bottom: 0; }
.rail-list a { font-family: Georgia, serif; font-size: 0.95rem; color: #1a1a1a; }
.rail-list a:hover { color: #b1121b; }
.rail-meta { display: block; font-size: 0.75rem; color: #6b5a3f; margin-top: 2px; }

/* ---- Section headers ---- */
.section-title {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 900;
  font-size: 1.4rem;
  margin: 0 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-kicker {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: #b1121b;
  margin-bottom: 4px;
}

/* ---- Topic cards (homepage lists) ---- */
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-list > li {
  padding: 14px 0;
  border-bottom: 1px solid #d8d2c4;
}
.topic-list > li:last-child { border-bottom: 0; }
.topic-list h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
  margin: 0 0 4px;
  font-weight: 700;
  line-height: 1.25;
}
.topic-list h3 a { color: #111; }
.topic-list h3 a:hover { color: #b1121b; }
.topic-meta {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b5a3f;
}
.topic-desc { margin: 6px 0 0; color: #2a2a2a; font-size: 0.95rem; }

/* ---- Single topic ---- */
.topic-hero h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  margin: 0 0 6px;
  line-height: 1.15;
}
.topic-hero .topic-desc { font-size: 1.05rem; max-width: 70ch; }
.status-pill {
  display: inline-block;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 2px 8px;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  color: #1a1a1a;
}
.status-pill.status-active { color: #1a6b1a; border-color: #1a6b1a; }
.status-pill.status-resolved { color: #4a4a4a; border-color: #888; }
.status-pill.available { color: #1a6b1a; border-color: #1a6b1a; }
.status-pill.missing, .status-pill.broken { color: #b1121b; border-color: #b1121b; }
.status-pill.archived { color: #6b5a3f; border-color: #6b5a3f; background: #faf6ec; }

/* Archived-link styling — visually distinguishes Wayback links from live ones. */
.article-title.is-archived { color: #4a4034; border-bottom: 1px dotted #b8b0a0; }
.article-title.is-archived:hover { color: #b1121b; border-bottom-color: #b1121b; }

.coverage-timeline { list-style: none; padding: 0; margin: 0; border: 1px solid #ecdfdf; }
.coverage-timeline .timeline-row {
  display: grid;
  grid-template-columns: 4.2rem 1fr auto;
  gap: 14px;
  padding: 7px 12px;
  align-items: baseline;
  border-left: 3px solid transparent;
  line-height: 1.35;
}
.coverage-timeline .timeline-row:nth-child(odd)  { background: #faf6ec; }
.coverage-timeline .timeline-row:nth-child(even) { background: #fff; }
.coverage-timeline .timeline-row:hover { border-left-color: #b1121b; background: #fbf1d8; }
.coverage-timeline .timeline-row.is-same-day .t-date { color: #b8b0a0; }
.coverage-timeline .t-date {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b5a3f;
  white-space: nowrap;
}
.coverage-timeline .t-title { min-width: 0; }
.coverage-timeline .t-title .article-title { font-family: Georgia, serif; font-size: 1rem; font-weight: 600; }
.coverage-timeline .t-source {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b5a3f;
  white-space: nowrap;
}
.coverage-timeline .t-source .details-link { margin-left: 6px; }

.linked-articles { list-style: none; padding: 0; margin: 0; }
.linked-articles li { padding: 10px 0; border-bottom: 1px solid #ecdfdf; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline; }
.linked-articles li:last-child { border-bottom: 0; }
.linked-articles .article-title { font-family: Georgia, serif; }
.linked-articles .article-source {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6b5a3f;
}
.linked-articles .article-date { font-size: 0.82rem; color: #4a4034; }

.related-block { background: #f4efe2; border: 1px solid #d8d2c4; padding: 14px 18px; margin-top: 22px; }
.related-block h2 { font-family: Georgia, serif; font-size: 1.05rem; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.1em; }
.related-block h3 { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; color: #b1121b; margin: 10px 0 4px; }
.related-block ul { list-style: disc; padding-left: 22px; margin: 0; }

.byline { color: #4a4034; font-size: 0.9rem; margin-top: 6px; }
.muted { color: #6b5a3f; font-style: italic; }

/* ---- Article page ---- */
.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li { display: grid; grid-template-columns: 11rem 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px dotted #d8d2c4; }
.kv-list li:last-child { border-bottom: 0; }
.kv-list .label {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6b5a3f;
}
.original-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 18px;
  background: #b1121b;
  color: #fff !important;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
}
.original-link:hover { background: #8a0d14; text-decoration: none; }
.original-link:visited { color: #fff !important; }

/* ---- Search form ---- */
.search-form {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px;
}
.search-form input[type="text"], .search-form select, .search-form input[type="date"] {
  font-family: Georgia, serif; font-size: 1rem; padding: 8px 10px;
  border: 1px solid #1a1a1a; background: #fff;
}
.search-form input[type="text"] { flex: 1 1 220px; min-width: 220px; }
.search-form button {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 8px 18px; border: 1px solid #1a1a1a; background: #1a1a1a; color: #fff; cursor: pointer;
}
.search-form button:hover { background: #b1121b; border-color: #b1121b; }

.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.78rem; color: #4a4034; margin-bottom: 14px;
}

/* ---- Pager ---- */
.pager ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; gap: 4px; flex-wrap: wrap; }
.pager li a, .pager li span {
  display: inline-block; padding: 6px 10px; border: 1px solid #d8d2c4; background: #fff;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.82rem;
}
.pager li.current span { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.pager li.gap { padding: 6px 4px; color: #6b5a3f; }

/* ---- Flash ---- */
.flash { padding: 10px 14px; margin: 12px 0; border-left: 4px solid #6b5a3f; background: #f4efe2; }
.flash-success { border-left-color: #1a6b1a; }
.flash-error   { border-left-color: #b1121b; background: #fbeeee; }

/* ---- Footer ---- */
.site-footer {
  background: #1a1a1a; color: #d8d2c4; padding: 24px 0 30px; margin-top: 40px;
  font-size: 0.85rem;
}
.site-footer a { color: #fff; }
.site-footer .transparency { font-style: italic; max-width: 70ch; }
.site-footer .footer-meta { margin-top: 8px; }
.site-footer .tiny { font-size: 0.72rem; color: #a09684; margin-top: 14px; }

/* ---- Article-title link affordances ---- */
.article-title { font-weight: 600; }
.article-title.broken { color: #6b5a3f; font-style: italic; font-weight: 500; }
.article-title .ext-arrow {
  color: #b1121b; font-weight: 700; font-size: 0.85em;
  margin-left: 2px; vertical-align: 0.05em;
  opacity: 0.7; transition: opacity 0.15s;
}
.article-title:hover .ext-arrow { opacity: 1; }
.details-link {
  color: #6b5a3f; font-size: 0.78em;
  text-decoration: underline; text-decoration-style: dotted;
}
.details-link:hover { color: #b1121b; }

/* Improve readability of the by-source list groupings */
.source-group-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #6b5a3f;
  margin: 22px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #d8d2c4;
}

/* ---- Topic hero card on homepage ---- */
.topic-hero-card {
  background: linear-gradient(180deg, #fff 0%, #fbf7ec 100%);
  border: 1px solid #d8d2c4;
  border-left: 5px solid #b1121b;
  padding: 20px 24px 22px;
  margin-bottom: 22px;
}
.topic-hero-card-meta {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6b5a3f;
  margin-bottom: 8px;
}
.topic-hero-card-meta .tag { margin-right: 6px; }
.topic-hero-card-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  margin: 0 0 10px;
}
.topic-hero-card-title a { color: #111; }
.topic-hero-card-title a:hover { color: #b1121b; text-decoration: none; }
.topic-hero-card-desc {
  font-size: 1.02rem;
  color: #2a2a2a;
  margin: 0 0 14px;
  max-width: 60ch;
}
.topic-hero-card-cta {
  display: inline-block;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #b1121b;
  font-weight: 700;
}
.topic-hero-card-cta:hover { color: #8a0d14; text-decoration: none; }

/* ---- Tiny utilities ---- */
.tiny { font-size: 0.72rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.lede { font-size: 1.05rem; color: #2a2a2a; }
.empty {
  padding: 18px;
  text-align: center;
  border: 1px dashed #d8d2c4;
  background: #faf8f4;
  color: #6b5a3f;
  font-style: italic;
}
.tag {
  display: inline-block; font-size: 0.7rem; padding: 1px 6px; margin: 0 4px 4px 0;
  background: #f1ece0; border: 1px solid #d8d2c4; color: #4a4034;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.08em;
}

/* ---- About / static content ---- */
.prose { max-width: 70ch; }
.prose h2 { font-family: "Playfair Display", Georgia, serif; font-size: 1.3rem; margin-top: 1.4em; }
.prose p { margin: 0 0 0.9em; }
.prose ul { padding-left: 22px; }
.prose code { background: #f1ece0; padding: 1px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

/* ---- Mobile polish (≤700px) ---- */
@media (max-width: 700px) {
  body { font-size: 16.5px; }                      /* slightly larger base */
  /* Keep the photo proportionally tall enough that the sunset + mountains
     read as a hero photo, not a thin letterbox. min-height was 130 → 190;
     the title clamp's lower bound is bumped from 2.4rem to 2.8rem so the
     wordmark still dominates the smaller canvas. */
  .masthead-hero { min-height: 190px; background-position: 40% 40%; }
  .masthead-hero-inner { padding: 22px 14px; }
  .masthead-title { font-size: clamp(2.8rem, 10vw, 3.6rem); }
  .masthead-title .mh-tld { font-size: 0.5em; }
  .masthead-hero .masthead-tag { font-size: 0.92rem; margin-top: 8px; }
  .masthead-row--slim { padding: 4px 0; }
  .masthead-date { font-size: 0.78rem; }
  .masthead-kicker { font-size: 0.65rem; letter-spacing: 0.18em; }

  .mainnav a { padding: 11px 14px; font-size: 0.72rem; letter-spacing: 0.12em; }
  .spot-row { padding: 10px 0; }                  /* less vertical waste */
  .spot-h img { width: 100%; max-width: 360px; height: auto; }

  .main { padding-top: 14px; padding-bottom: 24px; }

  .section-title { font-size: 1.2rem; }
  .topic-list h3 { font-size: 1.1rem; line-height: 1.25; }
  .topic-list > li { padding: 11px 0; }
  .topic-meta { font-size: 0.7rem; letter-spacing: 0.08em; }

  .linked-articles li {
    grid-template-columns: 1fr;                   /* stack title and status */
    gap: 4px; padding: 12px 0;
  }
  .article-title { font-size: 1.02rem; line-height: 1.3; display: inline-block; }

  .coverage-timeline .timeline-row {
    grid-template-columns: 1fr;                   /* stack date · title · source */
    gap: 2px; padding: 9px 10px;
  }
  .coverage-timeline .t-date { font-size: 0.68rem; }
  .coverage-timeline .t-source { font-size: 0.68rem; }

  .kv-list li { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
  .kv-list .label { font-size: 0.65rem; }

  .topic-hero-card { padding: 16px 16px 18px; }
  .topic-hero-card-title { font-size: 1.3rem; }
  .topic-hero-card-desc { font-size: 0.98rem; }

  .original-link { display: block; text-align: center; }
  .search-form input[type="text"] { min-width: 0; width: 100%; }
}
