/* ─────────────────────────────────────────────────────────────────────────
   Football Intelligence — News page + widget styles
   Design tokens from design-system.css (must be loaded first).
   No betting overlays on any news content. Purely informational.
   ───────────────────────────────────────────────────────────────────────── */


/* === Page shell =========================================================== */

.news-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 900px;
}

.news-page__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.news-page__eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.news-page__disclaimer {
  border-top: 1px solid var(--divider);
  padding-top: var(--space-2);
  color: var(--text-tertiary);
  font-size: 0.75rem;
  line-height: 1.5;
}


/* === Filter bar ============================================================ */

.news-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
}

.news-filters__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}

.news-filters__source {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  transition: border-color var(--duration-fast) var(--easing-out);
}
.news-filters__source:focus-visible {
  border-color: var(--accent);
}

.news-filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-out),
              background var(--duration-fast) var(--easing-out),
              color var(--duration-fast) var(--easing-out);
  line-height: 1;
  font-family: var(--font-sans);
}
.news-filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.news-filter-chip--active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
}


/* === Category + source chips ============================================== */

.news-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  line-height: 1.6;
  white-space: nowrap;
}

.news-chip--source {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
}

.news-chip--transfer {
  background: var(--accent-soft);
  border: 1px solid rgba(0, 229, 160, 0.25);
  color: var(--accent);
}

.news-chip--injury {
  background: rgba(255, 184, 0, 0.08);
  border: 1px solid rgba(255, 184, 0, 0.25);
  color: #d9a820;
}

.news-chip--match {
  background: rgba(56, 182, 255, 0.08);
  border: 1px solid rgba(56, 182, 255, 0.25);
  color: #56b8ff;
}

.news-chip--manager {
  background: rgba(181, 122, 255, 0.08);
  border: 1px solid rgba(181, 122, 255, 0.25);
  color: #c088ff;
}

.news-chip--general {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
}

.news-chip--xs {
  font-size: 0.65rem;
  padding: 1px 6px;
}


/* === News grid ============================================================= */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-2);
}

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


/* === News card ============================================================= */

.news-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--duration-base) var(--easing-out),
              box-shadow   var(--duration-base) var(--easing-out);
  /* fi-chroma variables for cursor-follow glow (set by app.js initChroma) */
  --mx: 50%;
  --my: 50%;
  position: relative;
  overflow: hidden;
}

.news-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120px circle at var(--mx) var(--my),
    rgba(0, 229, 160, 0.05) 0%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}

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

.news-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.news-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.news-card__time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-left: auto;
}

.news-card__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

.news-card__link {
  color: inherit;
  text-decoration: none;
  display: block;
  /* Stretch link touch target to full card on mobile */
}
.news-card__link:hover { color: var(--accent); }
.news-card__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.news-card__ext-icon {
  display: inline-block;
  font-size: 0.75em;
  vertical-align: super;
  opacity: 0.5;
  margin-left: 2px;
}

.news-card__excerpt {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card__footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.news-card__source-link {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--duration-fast);
}
.news-card__source-link:hover { color: var(--text-secondary); }


/* === Hero image =========================================================== */

/* Cards with a hero image get no top padding — image bleeds to the card edge. */
.news-card--has-hero {
  padding-top: 0;
}

.news-card__hero {
  margin: 0;
  /* Card already has overflow:hidden + border-radius — hero clips to it. */
  /* Negative margins cancel the card's padding on three sides so image edge-bleeds. */
  margin-left: calc(-1 * var(--space-2));
  margin-right: calc(-1 * var(--space-2));
  /* aspect-ratio keeps height proportional while width flexes with grid column. */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-3);
  position: relative;
  /* Round only top corners (bottom corners handled by card overflow). */
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

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

.news-card__hero-caption {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  padding: 2px 8px 0;
  text-align: right;
  position: absolute;
  bottom: 4px;
  right: 0;
  left: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 100%);
  padding-top: 8px;
}

/* Mobile (<480px): switch hero card to row layout — 80px thumb on left */
@media (max-width: 480px) {
  .news-card--has-hero {
    flex-direction: row;
    align-items: flex-start;
    padding-top: var(--space-2);
  }

  .news-card--has-hero .news-card__hero {
    flex-shrink: 0;
    width: 80px;
    aspect-ratio: 1 / 1;
    margin: 0;
    margin-right: var(--space-1);
    border-radius: var(--radius-md);
    align-self: flex-start;
  }

  .news-card--has-hero .news-card__hero-caption {
    display: none;
  }
}


/* === Skeleton card ======================================================== */

.news-card--skeleton {
  pointer-events: none;
  animation: news-skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
  background: var(--surface-3);
  border-radius: 4px;
}
.skeleton-line--short  { width: 45%; }
.skeleton-line--medium { width: 70%; }

@keyframes news-skeleton-pulse {
  0%, 100% { opacity: 0.9; }
  50%       { opacity: 0.45; }
}


/* === Empty state =========================================================== */

.news-empty {
  grid-column: 1 / -1;
  padding: var(--space-4) var(--space-2);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}


/* === Dashboard widget ===================================================== */

.news-widget {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.news-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
}

.news-widget__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.news-widget__more {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--duration-fast);
}
.news-widget__more:hover { opacity: 0.8; }

.news-widget__body {
  display: flex;
  flex-direction: column;
}

.news-widget__item {
  /* B1: two-column grid — thumb left, text right */
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--divider);
  text-decoration: none;
  transition: background var(--duration-fast) var(--easing-out);
  cursor: pointer;
}
.news-widget__item:last-child { border-bottom: none; }
.news-widget__item:hover { background: var(--surface-2); }
.news-widget__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* B1: thumbnail square */
.news-widget__thumb {
  margin: 0;
  padding: 0;
  width: 56px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-3);
  flex-shrink: 0;
}
.news-widget__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-widget__item-body {
  min-width: 0; /* prevents overflow in grid cell */
}

.news-widget__item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.news-widget__item-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-left: auto;
}

.news-widget__item-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* B1 — Footer strip: hero-on-top card layout (items stacked, not side-thumb).
   The footer's 4-column grid already handles horizontal distribution.
   Each item becomes a card with a 16/9 hero on top + text below. */
.app-footer__newsstrip .news-widget {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}
.app-footer__newsstrip .news-widget__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
}
.app-footer__newsstrip .news-widget__item {
  /* Override: single column — thumb on top, text below */
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
}
.app-footer__newsstrip .news-widget__item:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.app-footer__newsstrip .news-widget__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0;
}
.app-footer__newsstrip .news-widget__item-body {
  padding: 8px 12px 10px;
}
.app-footer__newsstrip .news-widget__item-title {
  -webkit-line-clamp: 2;
}


/* === Accessibility helpers =============================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
