:root {
  --bg: #e8e4dc;
  --paper: #fdfcf8;
  --paper-edge: #f4f1e8;
  --text: #1a1a1a;
  --muted: #555;
  --rule: #111;
  --card-bg: #fff;
  --card-border: #e8e6e1;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.12);
  --paper-shadow: 0 2px 20px rgba(0, 0, 0, 0.12), 0 0 60px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --gap: 1.5rem;
  --header-pad: 1.5rem;
  --paper-max: 1200px;
  --paper-pad: 2.5rem;
}

/* --- Boot Screen ---------------------------------------------------------- */

.boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.boot-screen.fade-out {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

/* Subtle paper grain on the boot screen */
.boot-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(0,0,0,0.012) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0,0,0,0.01) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(0,0,0,0.012) 0%, transparent 50%);
  pointer-events: none;
}

/* Ink drop effect behind the logo */
.boot-ink {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,26,26,0.06) 0%, rgba(26,26,26,0.02) 40%, transparent 70%);
  opacity: 0;
  animation: bootInkBloom 1.8s ease-out forwards;
}

@keyframes bootInkBloom {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

/* Logo with fade + scale + glow */
.boot-logo {
  position: relative;
  max-width: min(80vw, 700px);
  z-index: 1;
}

.boot-logo img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: scale(0.9);
  filter: drop-shadow(0 0 20px rgba(0,0,0,0.15));
  animation: bootLogoIn 0.8s ease-out 0.1s forwards;
}

@keyframes bootLogoIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
    filter: drop-shadow(0 0 25px rgba(0,0,0,0.25));
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 8px rgba(0,0,0,0.05));
  }
}

/* Boot content container — wraps rule + tagline so font scales with width */
.boot-content {
  width: 80%;
  max-width: 650px;
  container-type: inline-size;
  container-name: boot-content;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Animated newspaper rule */
.boot-rule {
  width: 100%;
  height: 1px;
  background: var(--rule);
  margin-top: -0.5rem;
  animation: bootRuleDraw 0.6s ease-out 0.6s forwards;
  transform: translateX(2px);
}

.boot-rule::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--rule);
  margin-top: 2px;
  width: 100%;
}

@keyframes bootRuleDraw {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

/* Staggered tagline */
.boot-tagline {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.9cqw;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.6rem 0 0;
  z-index: 1;
  text-align: center;
  white-space: nowrap;
  width: 100%;
  transform: translateX(2px);
}

.boot-tagline span {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: bootTaglineIn 0.5s ease-out forwards;
}

.boot-tagline span:nth-child(1) { animation-delay: 1.0s; }
.boot-tagline span:nth-child(2) { animation-delay: 1.05s; }
.boot-tagline span:nth-child(3) { animation-delay: 1.1s; }
.boot-tagline span:nth-child(4) { animation-delay: 1.15s; }
.boot-tagline span:nth-child(5) { animation-delay: 1.2s; }

@keyframes bootTaglineIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduce motion: skip the animation, show immediately */
@media (prefers-reduced-motion: reduce) {
  .boot-screen {
    transition: opacity 0.3s ease;
  }

  .boot-ink {
    animation: none;
    opacity: 0;
  }

  .boot-logo img {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }

  .boot-rule {
    width: 100%;
    animation: none;
  }

  .boot-tagline span {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Mobile boot screen sizing */
@media (max-width: 700px) {
  .boot-logo {
    max-width: 85vw;
  }

  .boot-ink {
    width: 280px;
    height: 280px;
  }

  .boot-content {
    max-width: 85vw;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  padding: 2rem 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.paper {
  max-width: var(--paper-max);
  margin: 0 auto;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: var(--paper-shadow);
  padding: 0 var(--paper-pad) 3rem;
  position: relative;
  overflow: hidden;
}

/* Subtle paper texture using a faint gradient noise effect */
.paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(0,0,0,0.012) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0,0,0,0.01) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(0,0,0,0.012) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.paper > * {
  position: relative;
  z-index: 1;
}

.site-header {
  text-align: center;
  padding: 2rem 0 1rem;
}

.logo-wrap {
  display: inline-block;
  max-width: min(95vw, 1200px);
}

.logo-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
  aspect-ratio: 1005.63 / 297.05;
}

.tagline {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: -0.75rem 0 0;
}

.newspaper-rule {
  height: 1px;
  background: var(--rule);
  margin: 0.75rem auto 0;
  width: 100%;
}

.newspaper-rule::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--rule);
  margin-top: 2px;
}

.newspaper-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.5rem;
  text-transform: capitalize;
}

.newspaper-meta .dot {
  color: #aaa;
}

.newscast-promo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  padding: 0.85rem 0.6rem 0rem 0.6rem;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
}

.newscast-promo .newscast-text {
  margin: 0;
  line-height: 1.4;
}

.newscast-promo .newscast-text strong {
  font-style: normal;
  font-weight: 600;
  color: var(--ink, #222);
}

.newscast-links {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.newscast-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.newscast-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.newscast-link img {
  height: 22px;
  width: auto;
  display: block;
}

.newsroom {
  padding: 1rem 0 0;
}

.skeleton {
  margin-bottom: 2rem;
}

.skeleton-row-large,
.skeleton-row-small {
  display: grid;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.skeleton-row-large {
  grid-template-columns: 1fr 1fr;
}

.skeleton-row-small {
  grid-template-columns: repeat(4, 1fr);
}

.skeleton-card {
  background: #ede9de;
  border-radius: 2px;
  overflow: hidden;
  border-bottom: 1px solid #e0ddd3;
  padding-bottom: var(--gap);
}

.skeleton-card::before {
  content: '';
  display: block;
  padding-top: 56.25%;
  background: linear-gradient(90deg, #ece8df 25%, #f4f1eb 50%, #ece8df 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-card::after {
  content: '';
  display: block;
  height: 80px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.feed {
  display: block;
}

.cycle {
  margin-bottom: 2.5rem;
}

.large-row,
.small-row {
  display: grid;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.large-row {
  grid-template-columns: repeat(2, 1fr);
}

.small-row {
  grid-template-columns: repeat(4, 1fr);
}

.news-card {
  display: flex;
  flex-direction: column;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #e0ddd3;
  padding-bottom: var(--gap);
}

.news-card:hover,
.news-card:focus {
  transform: none;
  box-shadow: none;
}

.news-card:hover .title,
.news-card:focus .title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.news-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #e8e5dc;
  border-radius: 0.5rem;
}

.news-card .thumb-fallback {
  object-fit: contain;
  padding: 1.5rem;
  background: #f0eee8;
}

.news-card.large .thumb {
  aspect-ratio: 16 / 10;
  border-radius: 0.75rem;
}

.news-card .body {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.news-card .title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1.22;
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: var(--text);
}

.news-card.small .title {
  font-size: 1rem;
}

.news-card .excerpt {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0 0 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card.small .excerpt {
  font-size: 0.82rem;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.news-card .meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.news-card .favicon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.news-card .source {
  font-weight: 600;
}

.news-card .time {
  margin-left: auto;
}

.ad-row {
  margin: var(--gap) 0 2.5rem;
  min-height: 90px;
  background: var(--paper-edge);
  border-top: 1px solid #d8d4c8;
  border-bottom: 1px solid #d8d4c8;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  overflow: hidden;
  padding: 0.5rem 0;
}

.ad-row ins.adsbygoogle {
  display: block;
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
  text-align: center;
}

.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #d9d5cc;
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.update-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--text);
  color: #fff;
  font-size: 0.95rem;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.update-banner button {
  background: #fff;
  color: var(--text);
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.update-banner button:hover {
  background: #e8e4dc;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.error {
  text-align: center;
  padding: 3rem 1rem;
  color: #555;
  font-size: 1.1rem;
}

/* Tablet */
@media (max-width: 1100px) {
  .small-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile - Google News style */
@media (max-width: 700px) {
  :root {
    --gap: 1rem;
    --paper-pad: 1rem;
  }

  body {
    padding: 0;
  }

  .paper {
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  .skeleton-row-large,
  .skeleton-row-small,
  .large-row,
  .small-row {
    grid-template-columns: 1fr;
  }

  .news-card {
    flex-direction: row;
    align-items: stretch;
  }

  .news-card .thumb {
    width: 120px;
    min-height: 90px;
    aspect-ratio: auto;
    flex-shrink: 0;
  }

  .news-card .body {
    padding: 0.85rem;
    justify-content: center;
  }

  .news-card .title {
    font-size: 1rem;
    margin-bottom: 0.25rem;
  }

  .news-card .excerpt {
    display: none;
  }

  .news-card .meta {
    margin-top: 0.35rem;
    font-size: 0.7rem;
  }

  .news-card.featured {
    flex-direction: column;
  }

  .news-card.featured .thumb {
    width: 100%;
    height: 200px;
    min-height: auto;
  }

  .news-card.featured .body {
    padding: 1rem;
  }

  .news-card.featured .excerpt {
    display: -webkit-box;
  }

  .news-card.featured .title {
    font-size: 1.2rem;
  }

  .ad-row {
    min-height: 50px;
    max-height: 100px;
  }

  .ad-row ins.adsbygoogle {
    max-width: 100%;
    width: 100%;
    height: 90px !important;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .news-card {
    transition: none;
  }

  .skeleton-card::before {
    animation: none;
  }
}
