/*
 * News Portal Core: front-end styles.
 * Uses the child theme's design tokens when present, with safe fallbacks.
 */

/* ---------- Breaking news ticker ---------- */

.npc-ticker {
  background: var(--bn-paper, #FFFFFF);
  border-top: 1px solid var(--bn-rule, #E5E7EB);
  border-bottom: 1px solid var(--bn-rule, #E5E7EB);
}

.npc-ticker__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--bn-container, 1200px);
  margin: 0 auto;
  padding: 0 16px;
  min-height: 44px;
}

.npc-ticker__label {
  flex: 0 0 auto;
  background: var(--bn-red, #C8202F);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 4px 10px;
  white-space: nowrap;
}

.npc-ticker__viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.npc-ticker__track {
  display: flex;
  width: max-content;
  animation: npc-ticker-scroll var(--npc-duration, 40s) linear infinite;
}

.npc-ticker--paused .npc-ticker__track {
  animation-play-state: paused;
}

.npc-ticker__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.npc-ticker__item {
  white-space: nowrap;
  padding: 10px 28px 10px 0;
  position: relative;
}

.npc-ticker__item::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  background: var(--bn-red, #C8202F);
  border-radius: 50%;
}

.npc-ticker__item a {
  color: var(--bn-ink, #202124);
  font-size: 0.9375rem;
}

.npc-ticker__item a:hover,
.npc-ticker__item a:focus-visible {
  color: var(--bn-red, #C8202F);
}

.npc-ticker__toggle {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--bn-rule, #E5E7EB);
  background: #FFFFFF;
  color: var(--bn-ink, #202124);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.npc-ticker__toggle:focus-visible {
  outline: 2px solid var(--bn-red, #C8202F);
  outline-offset: 2px;
}

@keyframes npc-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Respect reduced motion: stop scrolling, show a static, scrollable list. */
@media (prefers-reduced-motion: reduce) {
  .npc-ticker__track {
    animation: none;
  }
  .npc-ticker__viewport {
    overflow-x: auto;
  }
  .npc-ticker__list[aria-hidden="true"] {
    display: none;
  }
}

/* ---------- Advertisements ---------- */

.npc-ad {
  position: relative;
  margin: 16px auto;
  text-align: center;
  max-width: 100%;
}

.npc-ad__label {
  display: block;
  font-size: 0.75rem;
  color: var(--bn-muted, #5F6368);
  margin-bottom: 4px;
}

.npc-ad__sponsor {
  display: block;
  font-size: 0.75rem;
  color: var(--bn-muted, #5F6368);
  margin-top: 4px;
}

.npc-ad img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Reserve space to limit layout shift while the image loads. */
.npc-ad--header,
.npc-ad--homepage,
.npc-ad--category,
.npc-ad--footer {
  min-height: 90px;
}

.npc-ad--sidebar,
.npc-ad--in_article {
  min-height: 250px;
}

@media (max-width: 600px) {
  .npc-ad--desktop { display: none; }
}

@media (min-width: 601px) {
  .npc-ad--mobile { display: none; }
}

/* ---------- News list grid ---------- */

.npc-news-grid {
  display: grid;
  grid-template-columns: repeat(var(--npc-cols, 3), minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 900px) {
  .npc-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .npc-news-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.npc-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bn-mist, #F5F6F8);
}

.npc-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.npc-card__title {
  font-size: var(--bn-text-lg, 1.375rem);
  line-height: 1.35;
  margin: 12px 0 6px;
}

.npc-card__title a {
  color: var(--bn-ink, #202124);
}

.npc-card__title a:hover,
.npc-card__title a:focus-visible {
  color: var(--bn-red, #C8202F);
}

.npc-card__meta {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--bn-muted, #5F6368);
}
