/* ==========================================================================
   Election Impact: shared styles
   Used by index.html and every article. Article navigation styles are at the bottom.
   ========================================================================== */

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-muted: #5a616b;
  --line: #d5d8dc;
}

body {
  margin: 0;
  background-color: #f4f4f4;
  color: #111;
  font-family: var(--font-sans);
}

/* background photo: wide screens only. phones never see it, so they never download it.
   a fixed pseudo-element keeps it still while scrolling without the repaint cost of background-attachment: fixed */
@media (min-width: 1001px) {
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), url(https://d2z65klgtz99km.cloudfront.net/SMSINS/election-impact-bg.webp);
      background: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)), url(https://d2z65klgtz99km.cloudfront.net/SMSINS/election-impact-bg.webp);
    background-size: contain;
    background-repeat: repeat;
  }
}

/* the hidden attribute must always hide, even when another rule (like an ad's own display setting) says otherwise */
[hidden] {
  display: none !important;
}

a:focus-visible {
  outline: 3px solid #1a5fd0;
  outline-offset: 3px;
}

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

/* ---------- page card ---------- */
.page {
  max-width: 1000px;
  margin: 0 auto;
  background-color: #fff;
}

@media (min-width: 1001px) {
  .page {
    margin: 1.5rem auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.22);
  }
}

/* ---------- masthead (single image: swaps between a phone and a wide version) ---------- */
.masthead-link {
  display: block;
}

.masthead {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- content area ---------- */
.wrapper {
  padding: 1rem;
}

@media (min-width: 769px) {
  .wrapper {
    padding: 1.5rem 2rem;
  }
}

.wrapper p {
  font-size: 1rem;
  line-height: 1.55;
}

/* ---------- article ---------- */
.back-to-articles-container {
  border-bottom: 1px solid var(--line);
}

.back-to-articles {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #4a515a;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    color 0.2s ease,
    gap 0.2s ease;
}

.back-to-articles span {
  font-size: 1rem;
  line-height: 1;
}

.back-to-articles:hover,
.back-to-articles:focus-visible {
  color: #111;
  gap: 12px;
}

.wrapper > .post-date {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wrapper .post-title {
  margin-top: 0.25rem;
  font-size: clamp(28px, 7vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: left;
  text-wrap: balance;
}

/* subheads inside an article (direct children only, so the index's article titles are not affected) */
.wrapper > h2,
.wrapper > h3 {
  margin-top: 1.5rem;
  font-size: clamp(22px, 5.5vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  text-wrap: balance;
}

/* ---------- index: article list ---------- */
.post-preview {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.post-preview:first-child {
  padding-top: 0.5rem;
}

/* divider between new posts and the Midterm Countdown archive */
.archive {
  margin-top: 1.5rem;
}

.archive-heading {
  margin: 0 -1rem 0.5rem; /* cancels the .wrapper side padding so the banner spans the full page width */
  padding: 0.7rem 1rem;
  background: #1c2433;
  border-top: 4px solid #c00;
  color: #fff;
  font-size: 15px;
  font-size: clamp(.75rem, 4.2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

@media (min-width: 769px) {
  .archive-heading {
    margin-left: -2rem;
    margin-right: -2rem;
  }
}

/* archived posts: slightly quieter than new ones */
.archive .post-preview h2 a,
.archive .post-preview p {
  color: #4a5059;
}

.archive .post-preview h2 a:hover {
  color: #111;
}

.post-preview a {
  color: inherit;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-preview .post-date {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.latest-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #c00;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-preview h2 {
  margin-top: 0.25rem;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-align: left;
  text-wrap: balance;
}

.post-preview h2 a {
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-preview h2 a:hover {
  color: #555;
}

.wrapper .post-preview p {
  color: #4d535b;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 0.5rem;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: gap 0.2s ease;
}

.read-more:hover,
.read-more:focus-visible {
  gap: 12px;
}

/* ---------- article navigation (Newer / Older) ---------- */
.article-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.article-nav[hidden],
.article-nav-link[hidden] {
  display: none;
}

.article-nav-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 12px 0;
  color: #111;
  text-decoration: none;
}

.article-nav-link.older {
  margin-left: auto;
  justify-content: flex-end;
  text-align: right;
}

.nav-arrow {
  flex-shrink: 0;
  font-size: 1.2rem;
  line-height: 1.4;
  transition: transform 0.2s ease;
}

.article-nav-link small {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-nav-link strong {
  display: block;
  max-width: 300px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.article-nav-link:hover .nav-arrow {
  transform: translateX(-4px);
}

.article-nav-link.older:hover .nav-arrow {
  transform: translateX(4px);
}

@media (max-width: 600px) {
  .article-nav {
    flex-direction: column;
    gap: 5px;
  }

  .article-nav-link,
  .article-nav-link.older {
    margin-left: 0;
    justify-content: flex-start;
    text-align: left;
  }

  .article-nav-link.older .nav-arrow {
    order: 2;
  }
}

