/* Flint Hills Life Channel - web / PWA
   Theme tokens below are defaults; config.json palettes override them at runtime. */

@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("../fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }

:root {
  /* light palette */
  --bg: #F4F6F3;
  --surface: #FFFFFF;
  --surface-2: #E9EEE8;
  --text: #1E2A55;
  --muted: #56627A;
  --line: #D5DCD3;
  --accent: #F2B544;        /* gold fills */
  --on-accent: #1E2A55;
  --accent-ink: #9A6408;    /* gold-family text that passes contrast on light */
  --green: #2E8B4A;
  --green-ink: #22703A;

  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif-condensed, system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);

  --radius-lg: 14px;
  --radius-sm: 6px;
  --gutter: clamp(1rem, 0.5rem + 2vw, 2rem);
  --maxw: 1320px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1A30;
    --surface: #16253F;
    --surface-2: #1E3150;
    --text: #F3EFE4;
    --muted: #A9B3C4;
    --line: #2A3D5E;
    --accent: #F2B544;
    --on-accent: #0E1A30;
    --accent-ink: #F2B544;
    --green: #3F9A5C;
    --green-ink: #6CC28A;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.5;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

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

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 50;
  background: var(--accent); color: var(--on-accent);
  padding: .5rem .9rem; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Masthead ---------- */
.masthead {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(.9rem + env(safe-area-inset-top)) var(--gutter) .9rem;
}
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; min-width: 0; }
.brand-art img { height: clamp(44px, 30px + 3vw, 68px); width: auto; }
.brand-word {
  font-family: var(--display); font-weight: 800; font-size: 1.55rem; line-height: 1;
  letter-spacing: .01em; color: var(--text);
}
.brand.has-logo .brand-word {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
/* A logo made for light backgrounds, shown in dark mode without a dark variant, sits on a plate */
@media (prefers-color-scheme: dark) {
  .brand-art.needs-plate img { background: #F3EFE4; padding: 6px 10px; border-radius: 10px; }
}
.masthead-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.btn-quiet {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: .4rem .95rem; font-weight: 500; cursor: pointer;
}
.btn-quiet:hover { border-color: var(--muted); }
.btn-solid {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px;
  padding: .55rem 1.3rem; font-weight: 600; cursor: pointer;
}

/* ---------- Stage: player + now panel ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 3rem; }
.stage {
  display: grid; gap: var(--gutter);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 980px) {
  .stage { grid-template-columns: minmax(0, 2.1fr) minmax(300px, 1fr); align-items: stretch; }
}

/* Player */
.player {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #05090F; border-radius: var(--radius-lg); overflow: hidden;
  outline-offset: 3px;
}
.player video { width: 100%; height: 100%; object-fit: contain; background: #05090F; }
.player:fullscreen { border-radius: 0; aspect-ratio: auto; }
.player:-webkit-full-screen { border-radius: 0; }

@media (max-width: 719px) {
  /* Phones: the video stays pinned while the schedule scrolls under it.
     display: contents lets the sticky player use all of <main> as its range. */
  .stage { display: contents; }
  .player {
    position: sticky; top: 0; z-index: 10; border-radius: 0;
    width: calc(100% + 2 * var(--gutter)); margin: 0 calc(var(--gutter) * -1);
  }
}

.player-spinner {
  position: absolute; inset: 0; margin: auto; width: 44px; height: 44px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: #F2B544;
  animation: spin .9s linear infinite; opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.player[data-state="loading"] .player-spinner,
.player[data-state="buffering"] .player-spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-bigplay {
  position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%;
  background: rgba(14,26,48,.72); border: 2px solid #F2B544; cursor: pointer;
  display: grid; place-items: center;
}
.player-bigplay svg { width: 40px; height: 40px; fill: #F2B544; margin-left: 4px; }

.player-unmute {
  position: absolute; top: .9rem; left: .9rem;
  display: flex; align-items: center; gap: .45rem;
  background: #F2B544; color: #0E1A30; border: 0; border-radius: 999px;
  padding: .45rem .95rem .45rem .7rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.player-unmute svg { width: 20px; height: 20px; fill: currentColor; }

/* Off-air slate: the logo's tallgrass bars along the bottom edge */
.slate {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: #F3EFE4; padding: 1.5rem;
  background-color: #091222;
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 100" fill="%232E7A44"%3E%3Crect x="2" y="45" width="6" height="59" rx="3"/%3E%3Crect x="12" y="18" width="6" height="86" rx="3"/%3E%3Crect x="22" y="60" width="6" height="44" rx="3"/%3E%3Crect x="32" y="4" width="6" height="100" rx="3"/%3E%3Crect x="42" y="34" width="6" height="70" rx="3"/%3E%3Crect x="52" y="70" width="6" height="34" rx="3"/%3E%3Crect x="62" y="14" width="6" height="90" rx="3"/%3E%3Crect x="72" y="50" width="6" height="54" rx="3"/%3E%3Crect x="82" y="28" width="6" height="76" rx="3"/%3E%3Crect x="92" y="56" width="6" height="48" rx="3"/%3E%3Crect x="102" y="8" width="6" height="96" rx="3"/%3E%3Crect x="112" y="40" width="6" height="64" rx="3"/%3E%3C/svg%3E');
  background-repeat: repeat-x;
  background-position: left bottom;
  background-size: auto 30%;
}
.slate.has-image { background-image: var(--slate-image); background-size: cover; background-position: center; }
.slate-inner { max-width: 32rem; padding-bottom: 8%; }
.slate.has-image .slate-inner { background: rgba(14,26,48,.78); padding: 1.2rem 1.5rem; border-radius: var(--radius-lg); }
.slate-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 1rem + 3vw, 3rem); line-height: 1; margin: 0 0 .5rem; color: #F2B544; }
.slate-sub, .slate-next { margin: .25rem 0; color: #D7DCE5; }
.slate-next { color: #F3EFE4; font-weight: 600; }

/* Controls */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: .25rem;
  padding: 2.5rem .6rem .55rem;
  background: linear-gradient(transparent, rgba(5,9,15,.82));
  color: #fff; opacity: 1; transition: opacity .25s;
}
.player.controls-hidden .controls { opacity: 0; pointer-events: none; }
.player.controls-hidden { cursor: none; }
.player[data-state="offline"] .controls,
.player[data-state="loading"] .controls { opacity: 0; pointer-events: none; }
.ctl {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.ctl:hover { background: rgba(255,255,255,.12); }
.ctl svg { width: 24px; height: 24px; fill: #fff; }
.ctl[aria-pressed="true"] svg { fill: #F2B544; }
.ctl-spacer { flex: 1; }

.player .i-play, .player.is-paused .i-pause { display: none; }
.player.is-paused .i-play { display: block; }
.player .i-muted, .player.is-muted .i-sound { display: none; }
.player.is-muted .i-muted { display: block; }
.player .i-fs-exit, .player.is-fullscreen .i-fs { display: none; }
.player.is-fullscreen .i-fs-exit { display: block; }

.volume { width: 84px; accent-color: #F2B544; }
@media (hover: none) { .volume { display: none; } }

.live-btn {
  display: flex; align-items: center; gap: .4rem; margin-left: .35rem;
  background: rgba(255,255,255,.12); border: 0; border-radius: 999px;
  padding: .3rem .75rem; color: #fff; font-family: var(--display); font-weight: 700; font-size: 1rem;
  letter-spacing: .02em; cursor: pointer;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #8a93a3; }
.player.at-live .live-dot { background: #E5484D; }
.player.at-live .live-btn { cursor: default; }
.player:not(.at-live) .live-btn { background: #F2B544; color: #0E1A30; }

/* Now panel */
.now {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.1rem, .8rem + 1vw, 1.75rem);
  display: flex; flex-direction: column; min-width: 0;
}
@media (max-width: 719px) {
  .now {
    border-radius: 0; border-left: 0; border-right: 0; border-top: 0;
    padding: 1.1rem var(--gutter); margin: 0 calc(var(--gutter) * -1);
  }
}
.now-label {
  display: flex; align-items: center; gap: .5rem; margin: 0 0 .35rem;
  font-weight: 600; color: var(--green-ink); font-size: var(--step--1);
}
.now-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
.now-title {
  font-family: var(--display); font-weight: 800; font-size: var(--step-3); line-height: .95;
  margin: 0; letter-spacing: -.005em; text-wrap: balance; overflow-wrap: anywhere;
}
.now-sub { margin: .45rem 0 0; font-size: var(--step-1); font-weight: 500; color: var(--muted); }
.now-year { font-family: var(--display); font-weight: 600; color: var(--muted); font-size: .7em; margin-left: .35rem; letter-spacing: .02em; }
.now-meter { margin-top: 1.1rem; }
.now-times {
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; margin-bottom: .4rem;
}
.now-times #now-left { color: var(--muted); font-weight: 600; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .6s ease; }
.now-desc {
  margin: 1rem 0 0; color: var(--text); opacity: .88; max-width: 60ch;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.up-next { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
@media (min-width: 980px) { .up-next { margin-top: auto; } }
.up-next-label { margin: 0; font-size: var(--step--1); color: var(--muted); font-weight: 500; }
.up-next-label time { font-family: var(--display); font-weight: 700; color: var(--text); font-size: 1.05rem; margin-left: .3rem; }
.up-next-title { margin: .1rem 0 0; font-family: var(--display); font-weight: 700; font-size: var(--step-2); line-height: 1.05; }

/* ---------- Schedule ---------- */
.schedule { margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }
.schedule h2 {
  font-family: var(--display); font-weight: 800; font-size: var(--step-2); margin: 0 0 .25rem;
}
.guide-empty { color: var(--muted); }
.day { margin-top: 1.5rem; }
.day-label {
  position: sticky; top: 0; z-index: 2;
  margin: 0; padding: .55rem 0;
  background: var(--bg);
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--muted);
  border-bottom: 2px solid var(--line);
}
@media (max-width: 719px) {
  /* below the pinned player on phones */
  .day-label { top: calc(100vw * 9 / 16); }
}
.rows { list-style: none; margin: 0; padding: 0; }
.row { border-bottom: 1px solid var(--line); }
.row-main {
  width: 100%; display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .25rem 1.1rem;
  padding: .9rem 0; background: none; border: 0; text-align: left; cursor: default;
}
.row-main[aria-expanded] { cursor: pointer; }
.row-time {
  font-family: var(--display); font-weight: 700; font-size: 1.2rem; line-height: 1.25;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.row-time, .row-body, .row-title, .row-sub, .row-dur, .row-onnow { display: block; }
.row-body { min-width: 0; }
.row-title { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1.15; margin: 0; }
.row-year { font-weight: 600; color: var(--muted); margin-left: .35rem; font-size: .85em; }
.row-sub { margin: .1rem 0 0; font-weight: 500; color: var(--muted); }
.row-desc {
  margin: .35rem 0 0; color: var(--text); opacity: .82; max-width: 75ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-main[aria-expanded="true"] .row-desc { -webkit-line-clamp: unset; display: block; }
.row-dur { margin-top: .3rem; font-size: var(--step--1); color: var(--muted); }

/* The airing on now: gold rule + progress underline */
.row.is-now { position: relative; }
.row.is-now .row-main { padding-left: .85rem; }
.row.is-now::before {
  content: ""; position: absolute; left: 0; top: .7rem; bottom: .7rem; width: 4px;
  border-radius: 2px; background: var(--accent);
}
.row.is-now .row-time { color: var(--accent-ink); }
.row-onnow { font-family: var(--body); font-weight: 600; font-size: var(--step--1); color: var(--green-ink); }
.row.is-past { display: none; }

@media (max-width: 480px) {
  .row-main { grid-template-columns: 4.6rem minmax(0, 1fr); gap: .2rem .8rem; }
  .row-time { font-size: 1.1rem; }
  .row-title { font-size: 1.2rem; }
}

/* ---------- Footer + dialogs ---------- */
.site-foot {
  max-width: var(--maxw); margin: 0 auto; padding: 1.5rem var(--gutter) calc(2rem + env(safe-area-inset-bottom));
  color: var(--muted); font-size: var(--step--1); border-top: 1px solid var(--line);
}
.site-foot p { margin: .25rem 0; max-width: 70ch; }
.preview-flag { color: var(--accent-ink); font-weight: 600; }
.preview-flag a { color: inherit; }

.sheet {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text);
  padding: 1.5rem; width: min(30rem, calc(100vw - 2rem));
}
.sheet::backdrop { background: rgba(5, 9, 15, .6); }
.sheet h2 { font-family: var(--display); font-weight: 800; font-size: var(--step-2); margin: 0 0 .5rem; }
.sheet form { margin-top: 1.25rem; display: flex; justify-content: flex-end; }
.about-links { padding-left: 1.1rem; }
.about-links a { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
