/* Red River Dispatch — Design Polish Layer
   Load after styles.css. Deduplicates, adds polish, improves UX.
   v20260529 */

/* ===== DEDUPLICATED LAYOUT RULES ===== */
/* These replace the 4+ duplicate definitions in styles.css */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin: 8px 0 18px;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  padding: 26px 0 40px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.compact-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 14px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}

.compact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 20, 25, 0.12);
}

/* ===== CARD ENHANCEMENTS ===== */
.card {
  transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(15, 20, 25, 0.12);
}

.card-media, .stack-media, .compact-media {
  transition: transform .22s ease;
  overflow: hidden;
}

.card:hover .card-media,
.stack-card:hover .stack-media,
.compact-card:hover .compact-media {
  transform: scale(1.03);
}

.card-title a, .compact-title a, .stack-title a {
  transition: color .12s ease;
}

.card-title a:hover, .compact-title a:hover, .stack-title a:hover {
  color: var(--red);
  text-decoration: underline;
}

/* ===== NAV ENHANCEMENTS ===== */
.nav-link {
  transition: color .12s ease, border-color .12s ease;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--red);
  transition: width .18s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ===== TYPOGRAPHY & SPACING ===== */
.section-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin: 0;
  line-height: 1.15;
}

.section-deck {
  color: var(--ink-soft);
  max-width: 720px;
  font-size: .96rem;
  line-height: 1.5;
}

.card-summary {
  line-height: 1.55;
  font-size: .95rem;
}

.meta {
  font-size: .88rem;
  line-height: 1.4;
}

/* ===== SIDEBAR POLISH ===== */
.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.sidebar-card {
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.trending-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--surface-border);
  transition: opacity .12s ease;
}

.trending-item:hover {
  opacity: .82;
}

.trending-item:first-of-type {
  border-top: none;
}

.trending-rank {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
}

/* ===== BUTTON ENHANCEMENTS ===== */
.button, .header-pill {
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(185, 28, 28, 0.25);
}

.header-pill:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ===== TICKER POLISH ===== */
.ticker-content {
  animation: tickerMove 40s linear infinite;
}

.ticker-item {
  transition: opacity .1s ease;
}

.ticker-item:hover {
  opacity: .8;
}

/* ===== ARTICLE PAGE POLISH ===== */
.story-hero-media {
  transition: opacity .3s ease;
}

.story-body p {
  font-size: 1.08rem;
  line-height: 1.65;
  margin: 0 0 20px;
}

.story-body p:first-child {
  font-size: 1.15rem;
  color: var(--ink-mid);
}

/* ===== IMAGE LOADING SHIMMER ===== */
.media-fill, .hero-media, .card-media, .stack-media, .compact-media {
  position: relative;
  overflow: hidden;
}

.media-fill::before, .hero-media::before, .card-media::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: shimmer 2s infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0% { left: -50%; }
  100% { left: 150%; }
}

/* ===== FOCUS STATES (accessibility) ===== */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== TOAST POLISH ===== */
.toast {
  backdrop-filter: blur(8px);
  background: rgba(11, 16, 24, .92);
}

/* ===== NEWSLETTER / DONATION PROMPT ===== */
.paywall-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(15, 20, 25, 0.2);
  padding: 28px;
  max-width: 420px;
  margin: 20px auto;
  text-align: center;
}

.paywall-card .kicker {
  display: inline-block;
  margin-bottom: 8px;
}

.paywall-card h3 {
  font-family: Georgia, serif;
  font-size: 1.35rem;
  margin: 0 0 12px;
}

.paywall-card p {
  color: var(--ink-mid);
  font-size: .95rem;
  margin: 0 0 18px;
  line-height: 1.5;
}

.paywall-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 20, 25, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== HERO SECTION POLISH ===== */
.hero-card {
  transition: box-shadow .18s ease;
}

.hero-card:hover {
  box-shadow: 0 16px 50px rgba(15, 20, 25, 0.12);
}

/* ===== STACK CARD POLISH ===== */
.stack-card {
  transition: transform .18s ease, box-shadow .18s ease;
}

.stack-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 20, 25, 0.12);
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 1100px) {
  .grid-main, .article-layout, .grid-3, .feature-row {
    grid-template-columns: 1fr;
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .compact-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-search {
    min-width: 0;
    width: 100%;
  }
  
  .brand-name {
    font-size: 1.7rem;
  }
  
  .nav-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-weather {
    display: none;
  }
}

/* ===== STORY LAYOUT POLISH ===== */
.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 26px;
  margin-top: 24px;
}

@media (max-width: 1100px) {
  .story-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== WORKER HOMEPAGE APP POLISH ===== */
.worker-homepage-app .feature-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.worker-homepage-app .feature-media {
  min-height: 260px;
}

.worker-homepage-app .feature-copy {
  padding: 22px;
}

@media (max-width: 1100px) {
  .worker-homepage-app .feature-row {
    grid-template-columns: 1fr;
  }
}

/* ===== FLASH-OF-STALE-CONTENT FIX ===== */
.rrd-loading .hero-grid,
.rrd-loading .grid-main,
.rrd-loading #liveScores,
.rrd-loading #oddsBoard,
.rrd-loading #sportsStories,
.rrd-loading #dynamicStory,
.rrd-loading #deskGrid,
.rrd-loading .latest-list,
.rrd-loading .compact-grid,
.rrd-loading .weather-page,
.rrd-loading #forecastGrid,
.rrd-loading #hourlyScroll,
.rrd-loading #alertsList,
.rrd-loading #weatherStories,
.rrd-loading #sunMoon,
.rrd-loading .radar-container {
  opacity: 0;
  transition: opacity .15s ease;
}

.rrd-loaded .hero-grid,
.rrd-loaded .grid-main,
.rrd-loaded #liveScores,
.rrd-loaded #oddsBoard,
.rrd-loaded #sportsStories,
.rrd-loaded #dynamicStory,
.rrd-loaded #deskGrid,
.rrd-loaded .latest-list,
.rrd-loaded .compact-grid,
.rrd-loaded .weather-page,
.rrd-loaded #forecastGrid,
.rrd-loaded #hourlyScroll,
.rrd-loaded #alertsList,
.rrd-loaded #weatherStories,
.rrd-loaded #sunMoon,
.rrd-loaded .radar-container {
  opacity: 1;
}


/* ===== FLASH PREVENTION — CATCH ALL ===== */
.rrd-loading .site-shell {
  opacity: 0;
  transition: none;
}

.rrd-loaded .site-shell {
  opacity: 1;
  transition: opacity .12s ease;
}


/* ===== REVENUE / ADS ===== */
.rrd-ad{margin:22px 0;padding:10px;border:1px solid var(--surface-border);border-radius:18px;background:var(--surface-alt);text-align:center;overflow:hidden}
.rrd-ad-label{font-size:.68rem;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-soft);margin-bottom:8px}
.rrd-ad-leaderboard{min-height:110px;display:flex;flex-direction:column;justify-content:center}
.rrd-ad-inarticle,.rrd-ad-sidebar{min-height:250px;display:flex;flex-direction:column;justify-content:center}
.rrd-house-ad{display:flex;gap:10px;align-items:center;justify-content:center;flex-wrap:wrap;color:var(--ink);font-size:.92rem}
.rrd-house-ad strong{font-family:Georgia,serif;font-size:1.05rem}
.rrd-house-ad span{color:var(--ink-soft)}
.rrd-house-ad a{color:var(--red);font-weight:800;text-decoration:none}
@media(max-width:760px){.rrd-ad{border-radius:14px;margin:16px 0}.rrd-house-ad{flex-direction:column}}

/* Hide legacy internal attribution/source-note scraps from old generated static cards. */
.card-source{display:none!important}
