/* ==========================================================================
   Spotlive — "broadcast studio" design system.
   Dark cinematic canvas · editorial serif (Fraunces) + technical grotesque
   (Archivo) · a single "signal red" reserved for the LIVE tally light & primary
   actions. Hand-crafted, no framework. Mobile-first, AA, Core-Web-Vitals-aware.
   ========================================================================== */

/* ---- Design tokens --------------------------------------------------------- */
:root {
  /* Canvas & surfaces (deep ink with a faint blue cast) */
  --ink:        #0A0B0F;
  --ink-2:      #101218;
  --surface:    #15171F;
  --surface-2:  #1C1F29;
  --line:       rgba(255,255,255,.09);
  --line-2:     rgba(255,255,255,.14);

  /* Type */
  --fg:         #F5F3EE;   /* warm off-white, not pure white */
  --fg-muted:   #A6AAB6;
  --fg-dim:     #6E727E;

  /* Signal palette — used sparingly */
  --live:       #FF3B57;   /* on-air tally */
  --live-soft:  rgba(255,59,87,.14);
  --upcoming:   #FFB23E;   /* amber */
  --upcoming-soft: rgba(255,178,62,.14);
  --replay:     #8FE3D6;   /* cool steel-teal */
  --replay-soft: rgba(143,227,214,.12);

  /* Fonts */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:      "Archivo", system-ui, -apple-system, sans-serif;

  /* Geometry */
  --r-sm: 8px;  --r-md: 14px;  --r-lg: 22px;  --r-pill: 999px;
  --gap: clamp(14px, 2.4vw, 26px);
  --pad-x: clamp(16px, 5vw, 56px);
  --maxw: 1240px;

  /* Elevation */
  --shadow: 0 18px 50px -22px rgba(0,0,0,.8);
  --shadow-lg: 0 40px 90px -30px rgba(0,0,0,.85);

  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---- Reset & base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Atmosphere: a soft signal glow up top + a faint film grain over everything. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1100px 540px at 78% -8%, rgba(255,59,87,.16), transparent 60%),
    radial-gradient(900px 500px at 8% 4%, rgba(143,227,214,.07), transparent 55%),
    var(--ink);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 3px;
  border-radius: 4px;
}

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad-x); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--fg); color: var(--ink); padding: 10px 16px; border-radius: var(--r-sm);
  font-weight: 600; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

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

/* ---- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(140%) blur(14px);
  background: linear-gradient(180deg, rgba(10,11,15,.92), rgba(10,11,15,.66));
  border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.brand-mark {
  display: inline-flex; align-items: center; gap: .5ch;
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem;
  letter-spacing: -.02em; color: var(--fg);
}
.brand-mark em { font-style: italic; color: var(--live); }
.brand-mark__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 rgba(255,59,87,.6); animation: pulse 2.4s var(--ease) infinite;
}
.brand-mark--sm { font-size: 1.2rem; }

.site-nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
.site-nav a {
  font-weight: 500; font-size: .95rem; color: var(--fg-muted);
  transition: color .18s var(--ease);
}
.site-nav a:hover { color: var(--fg); }
.site-nav__search {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill); color: var(--fg-muted);
}
.site-nav__search:hover { color: var(--fg); border-color: var(--fg-muted); }

/* ---- Section heads (program-guide kicker) --------------------------------- */
.section { padding-block: clamp(34px, 5vw, 60px); }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: clamp(16px, 2.4vw, 26px);
}
.section__head h2 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(1.45rem, 3.2vw, 2.1rem); display: flex; align-items: center; gap: .55ch;
}
.section__head a {
  font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-muted); white-space: nowrap;
}
.section__head a:hover { color: var(--live); }
.kicker {
  font-family: var(--font-ui); font-weight: 700; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .18em; color: var(--fg-dim);
}

/* ---- Hero (home spotlight) ------------------------------------------------- */
.spotlight {
  position: relative; margin-top: clamp(20px, 4vw, 40px);
  border-radius: var(--r-lg); overflow: hidden; isolation: isolate;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  aspect-ratio: 16 / 9; max-height: 72vh;
}
.spotlight__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.spotlight::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(8,9,12,.1) 8%, rgba(8,9,12,.55) 55%, rgba(8,9,12,.95) 100%),
              linear-gradient(90deg, rgba(8,9,12,.7), transparent 60%);
}
.spotlight__body {
  position: absolute; left: 0; bottom: 0; padding: clamp(20px, 4vw, 48px);
  max-width: 720px; display: grid; gap: 14px;
}
.spotlight__eyebrow { display: flex; align-items: center; gap: 12px; }
.spotlight__title {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.025em;
  line-height: 1.02; font-size: clamp(1.9rem, 5.4vw, 4rem); text-wrap: balance;
}
.spotlight__brand { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-muted); font-weight: 600; }
.spotlight__brand img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.spotlight__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }

.home-intro {
  padding-top: clamp(26px, 4vw, 44px); max-width: 760px;
}
.home-intro .kicker { display: block; margin-bottom: 12px; }
.home-intro h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.025em;
  font-size: clamp(2rem, 5.6vw, 3.6rem); line-height: 1.02; text-wrap: balance;
}
.home-intro p { margin-top: 14px; color: var(--fg-muted); font-size: clamp(1rem,1.6vw,1.18rem); max-width: 60ch; }

/* ---- Rails (horizontal scroll rows) --------------------------------------- */
.rail {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(248px, 78vw); gap: var(--gap);
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 10px; margin-inline: calc(var(--pad-x) * -1); padding-inline: var(--pad-x);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.rail > * { scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }
@media (min-width: 640px) { .rail { grid-auto-columns: minmax(300px, 1fr); } }

/* ---- Grid (catalogue / brand) --------------------------------------------- */
.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ---- Card ------------------------------------------------------------------ */
.card {
  display: flex; flex-direction: column; gap: 12px;
  --stitch: var(--replay);
}
.card--live { --stitch: var(--live); }
.card--upcoming { --stitch: var(--upcoming); }
.card--replay { --stitch: var(--replay); }

.card__media {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter .3s; }
.card:hover .card__img { transform: scale(1.06); }
.card__placeholder { position: absolute; inset: 0; background:
  radial-gradient(circle at 50% 40%, var(--surface-2), var(--surface)); }
.card__scrim { position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,9,12,.35), transparent 38%, transparent 72%, rgba(8,9,12,.55)); }
.card__media::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 0 transparent; transition: box-shadow .25s var(--ease);
}
.card:hover .card__media::after { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--stitch) 70%, transparent); }

.card__dur {
  position: absolute; right: 10px; bottom: 10px;
  font-size: .72rem; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 3px 8px; border-radius: var(--r-sm);
  background: rgba(8,9,12,.72); color: var(--fg); backdrop-filter: blur(4px);
}

.card__body { display: flex; flex-direction: column; gap: 5px; }
.card__brand {
  display: inline-flex; align-items: center; gap: 7px; width: fit-content;
  font-size: .8rem; font-weight: 600; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.card__brand:hover { color: var(--fg); }
.card__brandlogo { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; background: var(--surface-2); }
.card__title {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em;
  font-size: 1.12rem; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__title a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--stitch); }
.card__meta { color: var(--fg-dim); font-size: .85rem; font-variant-numeric: tabular-nums; }
.card__time--soon { color: var(--upcoming); font-weight: 600; }
.card__time.is-now { color: var(--live); }

/* ---- Status chip ----------------------------------------------------------- */
.chip {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(8,9,12,.66); backdrop-filter: blur(6px); border: 1px solid var(--line-2);
}
.chip--live    { color: #fff; background: var(--live-soft); border-color: color-mix(in srgb, var(--live) 55%, transparent); }
.chip--upcoming{ color: var(--upcoming); border-color: color-mix(in srgb, var(--upcoming) 45%, transparent); }
.chip--replay  { color: var(--replay); border-color: color-mix(in srgb, var(--replay) 38%, transparent); }

.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 rgba(255,59,87,.7); animation: pulse 1.8s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,59,87,.6); }
  70%  { box-shadow: 0 0 0 9px rgba(255,59,87,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,87,0); }
}

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: var(--r-pill);
  font-weight: 600; font-size: .95rem; letter-spacing: .01em;
  border: 1px solid var(--line-2); color: var(--fg); background: rgba(255,255,255,.04);
  transition: transform .15s var(--ease), background .2s, border-color .2s;
}
.btn:hover { background: rgba(255,255,255,.09); border-color: var(--fg-muted); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--live); border-color: var(--live); color: #fff;
  box-shadow: 0 14px 34px -12px rgba(255,59,87,.65);
}
.btn--primary:hover { background: #ff5169; border-color: #ff5169; }
.btn--disabled { opacity: .4; pointer-events: none; }

/* ---- Page heads ------------------------------------------------------------ */
.page-head { padding-top: clamp(26px, 4vw, 46px); padding-bottom: 8px; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.025em;
  font-size: clamp(1.8rem, 4.6vw, 3rem); line-height: 1.05; text-wrap: balance;
}
.page-head__count { color: var(--fg-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; margin-top: 8px; }

/* ---- Filters --------------------------------------------------------------- */
.filters {
  position: sticky; top: 64px; z-index: 20;
  margin-block: 22px; padding: 14px;
  background: linear-gradient(180deg, rgba(21,23,31,.92), rgba(21,23,31,.82));
  backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.filters__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters__field { flex: 1 1 180px; min-width: 0; }
.filters__field input, .filters__field select {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--fg);
  background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--r-pill);
  appearance: none;
}
.filters__field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23A6AAB6' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 38px;
}
.filters__field input::placeholder { color: var(--fg-dim); }
.filters__field input:focus, .filters__field select:focus { border-color: var(--live); outline: none; }
.filters .btn { flex: 0 0 auto; }

/* ---- Pager ----------------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding-block: clamp(28px,4vw,48px); }
.pager__pos { color: var(--fg-muted); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- Live detail (cinematic) ---------------------------------------------- */
.breadcrumb { padding-top: 20px; color: var(--fg-dim); font-size: .85rem; }
.breadcrumb a:hover { color: var(--fg); }
.breadcrumb [aria-current] { color: var(--fg-muted); }

.live { padding-top: 18px; padding-bottom: clamp(40px,6vw,80px); }
.live__stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); background: #000;
  aspect-ratio: 16 / 9; margin-bottom: clamp(20px, 3vw, 34px);
}
.player { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.player--still { object-fit: cover; }
.player--empty { display: grid; place-items: center; background:
  radial-gradient(circle at 50% 40%, var(--surface-2), var(--ink)); color: var(--fg-dim); }
.live__stage--still::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 50%, rgba(8,9,12,.7));
}

.live__head { display: grid; gap: 14px; max-width: 860px; }
.live__head h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.025em;
  font-size: clamp(1.7rem, 4.4vw, 3.1rem); line-height: 1.04; text-wrap: balance;
}
.live__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.live__chips .chip { position: static; }
.live__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.live__brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; color: var(--fg); }
.live__brandlogo { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; }
.live__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

.live__desc { margin-top: 30px; max-width: 70ch; color: var(--fg-muted); font-size: 1.05rem; line-height: 1.7; }
.live__desc p { white-space: pre-line; }

.live__rewards { margin-top: 32px; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); max-width: 70ch; }
.live__rewards h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; margin-bottom: 12px; }
.live__rewards ul { list-style: none; display: grid; gap: 8px; }
.live__rewards li { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.live__rewards li::before { content: "★"; color: var(--upcoming); }

/* ---- Brand head ------------------------------------------------------------ */
.brand-head { display: flex; align-items: center; gap: 18px; padding-top: clamp(26px,4vw,46px); padding-bottom: 8px; }
.brand-head__logo { width: 72px; height: 72px; border-radius: var(--r-md); object-fit: cover; border: 1px solid var(--line); background: var(--surface); }
.brand-head h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(1.8rem,4.4vw,2.8rem); }
.brand-head__count { color: var(--fg-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; margin-top: 4px; }

/* ---- Brands index ---------------------------------------------------------- */
.brand-grid { list-style: none; display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); padding-block: 22px; }
.brand-tile a {
  display: grid; justify-items: center; gap: 8px; text-align: center;
  padding: 26px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); transition: transform .18s var(--ease), border-color .2s, background .2s;
}
.brand-tile a:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-2); }
.brand-tile img { width: 56px; height: 56px; border-radius: var(--r-md); object-fit: cover; background: var(--surface-2); }
.brand-tile__placeholder { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-md);
  background: var(--surface-2); font-family: var(--font-display); font-weight: 700; color: var(--fg-muted); }
.brand-tile__name { font-weight: 600; }
.brand-tile__count { font-size: .78rem; color: var(--fg-dim); text-transform: uppercase; letter-spacing: .08em; }

/* ---- Empty / 404 ----------------------------------------------------------- */
.empty { padding: 48px 0; text-align: center; color: var(--fg-muted); font-size: 1.05rem; }
.notfound { padding-block: clamp(60px,12vw,140px); text-align: center; max-width: 540px; margin-inline: auto; }
.notfound h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(2rem,8vw,3.4rem); }
.notfound p { color: var(--fg-muted); margin-top: 14px; }
.notfound .hero__cta { margin-top: 26px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- Footer ---------------------------------------------------------------- */
.site-footer { margin-top: clamp(50px,8vw,100px); border-top: 1px solid var(--line); background: var(--ink-2); }
.site-footer__inner { display: grid; gap: 14px; padding-block: clamp(34px,5vw,56px); }
.site-footer__tag { color: var(--fg-dim); max-width: 50ch; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer nav a { color: var(--fg-muted); font-weight: 500; }
.site-footer nav a:hover { color: var(--live); }

/* ---- Entrance choreography ------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .section, .spotlight, .home-intro { animation: rise .7s var(--ease) both; }
  .section:nth-of-type(2) { animation-delay: .06s; }
  .section:nth-of-type(3) { animation-delay: .12s; }
  .section:nth-of-type(4) { animation-delay: .18s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .card:hover .card__img { transform: none; }
}

/* ---- Responsive tweaks ----------------------------------------------------- */
@media (max-width: 560px) {
  .site-nav { gap: 14px; }
  .filters { top: 60px; }
  .filters .btn { width: 100%; }
  .brand-head { gap: 14px; }
  .brand-head__logo { width: 58px; height: 58px; }
}
