/* Layout: logo (tagline is part of it), centred tabs, theme switch; then one centred column with the player.
   Palette comes from the logo: pink "Punjabi" (#D02A62), charcoal "Junction". */
:root {
  --bg: #f6f4f3;
  --panel: #ffffff;
  --line: #e4dedb;
  --fg: #1d1a1c;
  --muted: #6d6367;
  --accent: #D02A62;      /* brand pink */
  --accent-ink: #ffffff;
  --accent-soft: #fbe7ee;
  --gold: #D02A62;        /* equalizer bars follow the logo's pink */
  --gold-2: #ef7aa3;
  --gold-ink: #a61f4e;
  --screen: #141112;
  --display: "Baloo Paaji 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --logo-light: block;
  --logo-dark: none;
  color-scheme: light;
}
/* Dark theme is dark grey, never pitch black (Randeep's call). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2b2c30; --panel: #36373c; --line: #4a4b51; --fg: #f2f0ef; --muted: #b5b1b2;
    --accent: #e4457d; --accent-ink: #ffffff; --accent-soft: #4b2b38;
    --gold: #e4457d; --gold-2: #f59bbb; --gold-ink: #f59bbb; --screen: #1f2023;
    --logo-light: none; --logo-dark: block; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #2b2c30; --panel: #36373c; --line: #4a4b51; --fg: #f2f0ef; --muted: #b5b1b2;
  --accent: #e4457d; --accent-ink: #ffffff; --accent-soft: #4b2b38;
  --gold: #e4457d; --gold-2: #f59bbb; --gold-ink: #f59bbb; --screen: #1f2023;
  --logo-light: none; --logo-dark: block; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 1280px; margin: 0 auto; padding-block: 16px 32px; display: grid; gap: 18px; }

header { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "logo tabs theme"; align-items: center; gap: 14px 20px; }
.brand { grid-area: logo; display: grid; gap: 2px; justify-items: start; min-width: 0; }
.logo { margin: 0; display: flex; align-items: center; min-width: 0; font-size: inherit; }

.logo img { height: 62px; width: auto; max-width: 100%; }
.logo .l-light { display: var(--logo-light); }
.logo .l-dark { display: var(--logo-dark); }
.tabs { grid-area: tabs; justify-self: center; }
.theme-btn { grid-area: theme; justify-self: end; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 9px 14px; }
@media (max-width: 1000px) {
  header { grid-template-columns: 1fr auto; grid-template-areas: "logo theme" "tabs tabs"; }
}
.stat { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; }
.tab { border: 0; background: transparent; border-radius: 999px; padding: 8px 16px 6px; cursor: pointer; color: var(--fg);
  display: grid; justify-items: center; line-height: 1.05; }
.tab b { font: 700 16px/1 var(--display); }
.tab small { font: 600 12px/1.2 var(--display); color: var(--muted); }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tab[aria-selected="true"] small { color: var(--accent-ink); opacity: .85; }

.banner { border: 1px solid var(--gold); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.banner b { color: var(--accent); }
.banner code { background: var(--panel); padding: 1px 5px; border-radius: 4px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 980px; justify-self: center; }

.stage { display: grid; gap: 14px; min-width: 0; }
.screen { position: relative; aspect-ratio: 16/9; width: 100%; max-width: 100%; background: var(--screen); border-radius: 16px; overflow: hidden; justify-self: center;
  box-shadow: 0 18px 50px -24px color-mix(in srgb, var(--accent) 55%, transparent); }
body.portrait .screen { aspect-ratio: 9/16; width: min(100%, 420px, calc(78vh * 9 / 16)); }
.screen iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.start { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 2; color: #fff;
  background: radial-gradient(120% 90% at 50% 110%, #d02a6270, transparent 60%), var(--screen); }
.start > div { display: grid; gap: 14px; justify-items: center; padding: 20px; }
.start p { margin: 0; color: #d8cfd2; max-width: 40ch; }
.eq-big { display: flex; align-items: flex-end; gap: 6px; height: 54px; }
.eq-big i { width: 9px; border-radius: 6px; background: linear-gradient(var(--gold-2), var(--gold)); height: 40%; }
.bigbtn { font: 800 22px/1 var(--display); padding: 16px 30px 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); }
.bigbtn:disabled { opacity: .55; cursor: progress; }

.now { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.now .meta { min-width: 0; flex: 1 1 300px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; border-radius: 2px; background: var(--gold); height: 40%; }
body.playing .eq i, body.playing .eq-big i { animation: eq 0.9s ease-in-out infinite alternate; }
.eq i:nth-child(2), .eq-big i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3), .eq-big i:nth-child(3) { animation-delay: -.6s; }
.eq i:nth-child(4), .eq-big i:nth-child(4) { animation-delay: -.15s; } .eq-big i:nth-child(5) { animation-delay: -.45s; }
.eq-big i { animation: eq 0.9s ease-in-out infinite alternate; }
@keyframes eq { from { height: 25%; } to { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .eq i, .eq-big i { animation: none !important; height: 70%; } }
.title { font: 700 21px/1.3 var(--display); margin: 2px 0 0; overflow-wrap: anywhere; text-wrap: balance; }
.by { color: var(--muted); font-size: 14px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
button { font: 600 14px/1 var(--body); color: var(--fg); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.live-audio { position: absolute; inset: 0; z-index: 3; background: #000; color: #fff; }
.live-audio img, .live-audio video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.la-video { opacity: 0; transition: opacity .6s ease; }
.la-video.ready { opacity: 1; }
.live-audio::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, #000000d0); pointer-events: none; }
.la-ctrl { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 999px; background: #0000006b; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.la-btn { width: 42px; height: 42px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; border: 0; color: #fff; flex: none; }
.la-btn:hover { background: #ffffff24; border: 0; }
.la-btn:focus-visible { outline: 2px solid #fff; }
.la-btn svg { width: 22px; height: 22px; fill: currentColor; }
.la-btn svg .s { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.la-btn.la-play { width: 48px; height: 48px; background: #fff; color: #1d0a12; }
.la-btn.la-play:hover { background: #fff; box-shadow: 0 0 0 5px #ffffff30; }
.la-vol { margin-left: auto; display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 190px; }
.la-vol input { -webkit-appearance: none; appearance: none; width: 130px; height: 4px; border-radius: 4px; cursor: pointer; margin: 0 8px 0 0;
  background: linear-gradient(to right, #fff var(--v, 100%), #ffffff4d var(--v, 100%)); }
.la-vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0006; transition: transform .15s ease; }
.la-vol input::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.la-vol input:hover::-webkit-slider-thumb { transform: scale(1.25); }
.la-vol input:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.la-cap { position: absolute; left: 20px; right: 20px; bottom: 78px; z-index: 1; display: grid; gap: 4px; justify-items: start; }
@keyframes la-pulse { 50% { opacity: .35; } }
.la-name { font: 700 clamp(18px, 3.4vw, 30px)/1.15 var(--display); text-shadow: 0 2px 10px #0008; }
.la-sub { font-size: 14px; color: #f1e9ec; }
.live-audio.no-img { background: radial-gradient(120% 100% at 30% 0%, #d02a62, #5a1230 55%, #1d0a12); }
.la-khanda { position: absolute; right: 6%; top: 50%; transform: translateY(-50%); font-size: clamp(120px, 26vw, 260px); line-height: 1; color: #ffd27a; opacity: .22; }

/* Gurbani channel menu: a column on the left on wide screens, a swipeable row above the player on phones. */
body.has-menu .main { grid-template-columns: 270px minmax(0, 1fr); max-width: 1260px; gap: 22px; align-items: start; }
.chan-menu { display: grid; gap: 10px; position: sticky; top: 12px; min-width: 0; }
.chan-list { display: grid; gap: 8px; }
.chan { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 11px; text-align: left; width: 100%;
  padding: 11px 12px; border-radius: 14px; line-height: 1.25; cursor: pointer; }
.chan-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.chan-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.chan-ic svg .f { fill: currentColor; stroke: none; }
.chan-txt { display: grid; gap: 1px; min-width: 0; }
.chan-head { display: block; }
.chan-marks { display: inline-flex; align-items: center; gap: 7px; margin-left: 7px; white-space: nowrap; vertical-align: 1px; }
.chan { position: relative; }
.chan .live-dot { position: absolute; right: 12px; bottom: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #e0282e; animation: live-ring 1.6s ease-out infinite; }
@keyframes live-ring { 0% { box-shadow: 0 0 0 0 #e0282e80; } 100% { box-shadow: 0 0 0 7px #e0282e00; } }
.live-pill { display: inline-flex; align-items: center; gap: 5px; font: 800 10.5px/1 var(--body); letter-spacing: .08em; color: #fff; background: #e0282e; padding: 3px 7px 3px 6px; border-radius: 999px; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: la-pulse 1.4s ease-in-out infinite; }
.live-pill.big { font-size: 12px; padding: 5px 10px 5px 8px; gap: 7px; box-shadow: 0 2px 10px #0006; }
.live-pill.big i { width: 8px; height: 8px; }
.chan-name { font-weight: 700; font-size: 14.5px; }
.chan-sub { font-size: 12.5px; color: var(--muted); }
.chan .flag { width: 16px; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.chan[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.chan[aria-pressed="true"] .chan-ic { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 900px) {
  body.has-menu .main { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .chan-menu { position: static; }
  .chan-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; padding-bottom: 6px; margin-inline: -4px; padding-inline: 4px; scrollbar-width: thin; }
  .chan { flex: 0 0 min(78%, 260px); scroll-snap-align: start; }
  .chan[aria-pressed="true"] { box-shadow: none; }
}

.sources { display: grid; gap: 10px; }
.section-h { margin: 0; font: 700 12.5px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-weight: 500; }
.chip[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.chip .n { color: var(--gold-ink); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; }
.chip .x { color: var(--muted); padding-left: 2px; }
.add { display: flex; gap: 8px; flex-wrap: wrap; }
.add input { flex: 1 1 260px; min-width: 0; font: 14px var(--body); color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 0; }
.msg { font-size: 13px; color: var(--gold-ink); min-height: 1.2em; }

.empty { color: var(--muted); font-size: 13px; }
#harvest { position: fixed; left: -10000px; top: 0; width: 320px; height: 180px; }
footer { color: var(--muted); font-size: 12.5px; }
footer a { color: inherit; }
.about { width: 100%; max-width: 980px; justify-self: center; display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); }
.about h2 { margin: 6px 0 0; font: 700 18px/1.3 var(--display); color: var(--fg); text-wrap: balance; }
.about h3 { margin: 0 0 4px; font: 700 16px/1.3 var(--display); color: var(--fg); }
.about h3 span { color: var(--accent); font-weight: 600; }
.about p { margin: 0; font-size: 14px; max-width: 75ch; }
.about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 800px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .wrap { padding-block: 10px 24px; gap: 14px; }
  .logo img { height: auto; width: min(100%, 250px); }

  .theme-btn { padding: 8px 12px; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 8px 4px 6px; }
  .tab b { font-size: 14.5px; }
  .screen { border-radius: 12px; }
  .title { font-size: 18px; }
  .controls { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .controls button { padding: 12px 4px; font-size: 13px; }
  .la-cap { left: 12px; right: 12px; bottom: 54px; gap: 2px; }
  .la-ctrl { left: 8px; right: 8px; bottom: 8px; gap: 2px; padding: 3px; }
  .la-btn { width: 38px; height: 38px; min-height: 38px; }
  .la-btn.la-play { width: 42px; height: 42px; }
  .la-vol input { width: 100%; }
  .la-sub { display: none; }
  .la-sub { font-size: 13px; }
  .add button { flex: 1 1 100%; }
  .chip { font-size: 13.5px; }
}
@media (hover: none) { button, .tab { min-height: 44px; } }

/* ---------- Micro-interactions ---------- */
a.tab { text-decoration: none; }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.about h3 a { color: inherit; text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: background-size .25s ease; }
.about h3 a:hover { background-size: 100% 2px; }

button { transition: transform .15s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease; }
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.96); }
button.primary:hover { box-shadow: 0 8px 20px -10px var(--accent); }

/* Sliding pill behind the selected tab. */
.tabs { position: relative; isolation: isolate; }
.tabs::before { content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 0; width: var(--ind-w, 0); border-radius: 999px;
  background: var(--accent); transform: translateX(var(--ind-x, 0)); opacity: 0; transition: transform .35s cubic-bezier(.3,1.3,.5,1), width .35s ease; }
.tabs.ind-ready::before { opacity: 1; }
.tabs.ind-ready .tab[aria-selected="true"] { background: transparent; }
.tab { transition: color .25s ease, transform .15s ease; }
.tab:active { transform: scale(.95); }
.tab:not([aria-selected="true"]):hover b { color: var(--accent); }

/* Channel cards lift on hover; the playing card's icon gently pulses. */
.chan { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease; }
.chan:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -16px color-mix(in srgb, var(--accent) 70%, transparent); }
.chan .flag { transition: transform .25s ease; }
.chan:hover .flag { transform: rotate(-6deg) scale(1.12); }
body.playing .chan[aria-pressed="true"] .chan-ic { animation: chan-pulse 1.8s ease-out infinite; }
@keyframes chan-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Chips spring when toggled. */
.chip { transition: transform .15s ease, background-color .2s ease, border-color .2s ease, opacity .2s ease; }
.chip:active { transform: scale(.94); }

/* Start screen: the button breathes. */
.bigbtn:not(:disabled) { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 18%, transparent); } }

/* Live audio screen fades in, and the photo drifts slowly while it plays. */
.live-audio { animation: fade-in .45s ease both; }
body.playing .live-audio img { animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.08) translate(-1.5%, -1%); } }
.la-cap > * { animation: rise .5s ease both; }
.la-cap > :nth-child(2) { animation-delay: .08s; } .la-cap > :nth-child(3) { animation-delay: .16s; }

/* Now-playing title slides in when it changes. */
.title.swap { animation: rise .4s ease both; }

/* Page entrance. */
header, .main, .about { animation: rise .55s ease both; }
.main { animation-delay: .08s; } .about { animation-delay: .16s; }

/* Theme toggle icon spins. */
#themeIcon { display: inline-block; transition: transform .45s ease; }
.theme-btn:hover #themeIcon { transform: rotate(-30deg); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

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