/* Podcasts — light, dense iPhone-first design following the El Salvador app (single fixed light theme).
   Tokens: grey page, white cards with thin grey border, serif display titles, sans body, ONE accent (blue). */
:root {
  --bg:#F5F6F8; --card:#FFFFFF; --ink:#0F1729; --muted:#586474; --line:#E0E5EB; --track:#EEF0F3;
  --acc:#094CAA; --acc-soft:#094caa14; --acc-soft2:#094caa24; --danger:#B42318;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --r:12px; --sat:env(safe-area-inset-top); --sab:env(safe-area-inset-bottom); --sal:env(safe-area-inset-left); --sar:env(safe-area-inset-right);
  color-scheme: light;
}
* { box-sizing:border-box; }
html { background:var(--bg); -webkit-text-size-adjust:100%; }
html, body { margin:0; color:var(--ink); font:14px/1.4 var(--sans); -webkit-font-smoothing:antialiased; font-variant-numeric:tabular-nums; }
body { background:var(--bg); min-height:100vh; min-height:100dvh; padding-bottom:calc(24px + var(--sab)); -webkit-tap-highlight-color:transparent; }
body:has(#player:not([hidden])) { padding-bottom:calc(128px + var(--sab)); }
a { color:var(--acc); }

/* ---------- sticky white header: (back) + serif title, segmented tabs below */
#top { position:sticky; top:0; z-index:5; background:#fff; border-bottom:1px solid var(--line);
  padding:var(--sat) calc(12px + var(--sar)) 8px calc(12px + var(--sal)); }
.toprow { display:flex; align-items:center; gap:8px; height:44px; }
.brand { font:500 24px/1 var(--serif); letter-spacing:-.01em; color:var(--ink); }
.backbtn { flex:0 0 auto; width:36px; height:36px; margin:4px 0; border-radius:50%; background:var(--track); display:grid; place-items:center; position:relative; }
.backbtn::after { content:""; position:absolute; inset:-4px; } /* 44px tap area */
.backbtn[hidden] { display:none; }
.backbtn i, .ico { display:inline-block; width:16px; height:16px; background:currentColor; -webkit-mask:var(--m) center/contain no-repeat; mask:var(--m) center/contain no-repeat; flex:0 0 auto; }
.backbtn i { color:var(--ink); --m:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M10 3 5 8l5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* segmented controls: grey track, white selected pill, blue text */
#tabs, .seg { display:flex; gap:2px; padding:3px; background:var(--track); border-radius:10px; }
#tabs[hidden] { display:none; }
#tabs a, .seg button { flex:1 1 0; display:flex; align-items:center; justify-content:center; gap:5px; min-height:34px; padding:0 8px;
  border:0; border-radius:8px; background:transparent; color:var(--muted); font:500 14px/1 var(--sans); text-decoration:none; box-shadow:none; }
#tabs a.on, .seg button.on { background:#fff; color:var(--acc); font-weight:600; box-shadow:0 1px 2px rgb(15 23 41 / 10%), 0 0 0 .5px rgb(15 23 41 / 6%); }
.badge { background:var(--acc); color:#fff; border-radius:9px; min-width:18px; height:18px; padding:0 5px; font:600 11px/18px var(--sans); text-align:center; }
.badge:empty { display:none; }

main { max-width:760px; margin:0 auto; padding:10px calc(12px + var(--sar)) 0 calc(12px + var(--sal)); }
h1 { font:500 22px/1.15 var(--serif); letter-spacing:-.01em; margin:4px 0 8px; }
h2 { font:600 15px/1.3 var(--sans); margin:4px 0 8px; }
.muted { color:var(--muted); } .center { text-align:center; } .small { font-size:13px; }
p { margin:6px 0; }

/* page head: serif title left, filter segment right (one line) */
.pagehead { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:2px 0 8px; }
.pagehead h1 { margin:0; }
.pagehead .seg { margin:0; flex:0 0 auto; }
.pagehead .seg button { min-height:30px; padding:0 12px; font-size:13px; }
.seg { margin:8px 0; }

/* ---------- cards */
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:10px; margin:0 0 8px; box-shadow:0 1px 2px rgb(0 0 0 / 4%); }
.meta { font-size:12px; color:var(--muted); line-height:1.35; }
.meta a { color:inherit; text-decoration:none; font-weight:500; }
.etitle { font:600 15px/1.3 var(--sans); color:var(--ink); margin:2px 0 3px; cursor:pointer; word-break:break-word; }
.desc { white-space:pre-wrap; font-size:13px; color:#3b4656; max-height:240px; overflow:auto; margin:2px 0 4px; padding:8px; background:var(--bg); border-radius:8px; }

/* episode card: artwork + text on top, buttons full-width below (played button pinned right on every card) */
.ep { display:grid; grid-template-columns:auto 1fr; column-gap:10px; row-gap:0; align-items:start; }
.ep > div { display:contents; }
.ep > img { grid-column:1; grid-row:1 / span 3; }
.ep > div > * { grid-column:2; min-width:0; }
.ep > div > .desc, .ep > div > .btnrow, .ep > div > .vnote { grid-column:1 / -1; }
.ep > div > .btnrow { margin-top:8px; }
.ep img, .show img { width:64px; height:64px; object-fit:cover; border-radius:8px; background:var(--track); display:block; }
.ep img.wide { width:96px; height:54px; }
.ep.played .etitle { color:var(--muted); font-weight:500; }
.chip { display:inline-block; font-size:11px; font-weight:500; line-height:16px; padding:0 6px; border-radius:5px; background:var(--track); color:var(--muted); margin-right:3px; }

/* ---------- buttons (black text + one blue accent) */
button, .btn { font:500 14px/1 var(--sans); min-height:40px; display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border:1px solid var(--line); background:#fff; color:var(--ink); border-radius:10px; padding:0 12px; cursor:pointer; text-decoration:none; box-shadow:none; }
button:active, .btn:active { background:var(--track); }
button.small, .btn.small { font-size:13px; }
button.primary { background:var(--acc); border-color:var(--acc); color:#fff; font-weight:600; }
button.danger { color:var(--danger); border-color:#f3d4d1; }
.btns { display:flex; flex-wrap:wrap; gap:6px; }
.pf { background:var(--acc-soft); border-color:transparent; color:var(--acc); font-weight:600; padding:0 11px; }
.pf:active { background:var(--acc-soft2); }
.pf::before, a.btn[target=_blank]::before { content:""; width:12px; height:12px; background:currentColor; -webkit-mask:var(--m) center/contain no-repeat; mask:var(--m) center/contain no-repeat;
  --m:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 1.2v9.6L10.5 6z' fill='black'/%3E%3C/svg%3E"); }
.pf.rss::before { --m:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 10V8a5.5 5.5 0 0 1 11 0v2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Crect x='1.5' y='9' width='3.5' height='5.5' rx='1.2'/%3E%3Crect x='11' y='9' width='3.5' height='5.5' rx='1.2'/%3E%3C/svg%3E"); width:14px; height:14px; }
a.btn[target=_blank]::before { --m:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 2h6v6M10 2 2.5 9.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); width:11px; height:11px; color:var(--muted); }
.btnrow { display:flex; align-items:flex-start; gap:6px; }
.btnrow > .btns { flex:1 1 auto; min-width:0; }
.btnrow > .playedbtn { flex:0 0 auto; width:116px; margin-left:auto; }

/* hold-to-confirm: bar fills in 3 s; no iOS callout / selection / scrolling while holding */
.hold { position:relative; overflow:hidden; -webkit-touch-callout:none; -webkit-user-select:none; user-select:none; touch-action:none; -webkit-tap-highlight-color:transparent; }
.hold .fill { position:absolute; left:0; top:0; bottom:0; width:0; background:var(--acc-soft2); pointer-events:none; }
.hold .lbl { position:relative; pointer-events:none; }
.hold.holding { border-color:var(--acc); color:var(--acc); }
.vnote { font-size:12px; line-height:1.3; color:var(--muted); margin-top:6px; }

/* ---------- shows */
.show { display:grid; grid-template-columns:48px 1fr auto; gap:10px; align-items:center; text-decoration:none; color:inherit; padding:8px 10px; }
.show img { width:48px; height:48px; }
.show .etitle { margin:0 0 2px; font-size:14px; }
a.card.show { position:relative; padding-right:34px; }
a.card.show::after { content:""; position:absolute; right:10px; top:50%; width:16px; height:16px; margin-top:-8px; background:#9aa3af;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3l5 5-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3l5 5-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.count { background:var(--acc-soft); color:var(--acc); border-radius:11px; min-width:26px; height:22px; padding:0 8px; font:600 12px/22px var(--sans); text-align:center; }
.count.zero { background:var(--track); color:var(--muted); }
.hdr { display:grid; grid-template-columns:72px 1fr; gap:12px; align-items:center; margin:2px 0 8px; }
.hdr img { width:72px; height:72px; border-radius:10px; object-fit:cover; background:var(--track); }
.hdr h1 { margin:0 0 4px; }
.note { font-size:13px; color:var(--muted); background:#fff; border:1px solid var(--line); border-radius:10px; padding:8px 10px; margin:6px 0; }
main > .btn, main > .btns { margin:0 0 8px; }
main > .btn + .btns { margin-left:6px; display:inline-flex; }

/* ---------- forms */
input[type=text], input[type=email], input[type=password], input[type=search], select { font:16px/1.2 var(--sans); min-height:44px; padding:0 12px; border:1px solid var(--line); border-radius:10px; width:100%; background:#fff; color:var(--ink); }
input:focus, select:focus { outline:2px solid var(--acc-soft2); border-color:var(--acc); }
form .row, .row { display:flex; gap:6px; margin:6px 0; align-items:center; }
.row > span { flex:1; min-width:0; }
label { font-size:13px; color:var(--muted); }
.err { color:var(--danger); } .ok { color:#1B7A3D; }
.src { border-top:1px solid var(--line); padding:10px 0; }
.src code { font-size:12px; word-break:break-all; color:var(--muted); }
.login { max-width:380px; margin:24px auto; padding:16px; }
.login button[type=submit] { width:100%; margin-top:4px; }

/* ---------- audio player: white bar, edge-to-edge with safe area */
#player { position:fixed; left:0; right:0; bottom:0; z-index:10; background:#fff; border-top:1px solid var(--line); box-shadow:0 -1px 3px rgb(0 0 0 / 4%);
  padding:8px calc(12px + var(--sar)) calc(8px + var(--sab)) calc(12px + var(--sal)); }
#player[hidden], #video[hidden] { display:none; }
.ptitle { font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--ink); font-weight:600; }
#pshow { color:var(--muted); font-weight:500; }
#pseek { width:100%; height:24px; margin:2px 0; accent-color:var(--acc); }
.pctl { display:flex; align-items:center; justify-content:space-between; gap:6px; }
.pctl button { width:44px; min-width:44px; height:44px; min-height:44px; padding:0; border-radius:50%; border:0; background:var(--acc-soft); color:var(--acc); font:600 13px/1 var(--sans); }
.pctl button.big { width:48px; min-width:48px; height:48px; background:var(--acc); color:#fff; font-size:17px; }
#pclose { background:var(--track); color:var(--muted); font-size:15px; }
.pctl select { width:auto; min-height:36px; height:36px; padding:0 10px; border:0; border-radius:18px; background:var(--track); color:var(--ink); font:600 13px/1 var(--sans); }
.ptime { font-size:12px; min-width:76px; color:var(--muted); }

/* ---------- video: full-screen sheet */
#video { position:fixed; inset:0; z-index:20; background:#fff; display:flex; flex-direction:column; padding:var(--sat) var(--sar) var(--sab) var(--sal); }
.vbar { display:flex; gap:8px; align-items:center; padding:6px 12px; min-height:56px; border-bottom:1px solid var(--line); }
.vbar > span#vtitle { flex:1; min-width:0; font-size:13px; font-weight:600; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.vbar #vclose { width:36px; min-width:36px; height:36px; min-height:36px; padding:0; border:0; border-radius:50%; background:var(--track); color:var(--ink); font-size:15px; }
.vbar .hold { width:116px; }
.vframe { position:relative; width:100%; max-width:960px; margin:0 auto; aspect-ratio:16/9; background:#000; }
.vframe iframe { position:absolute; inset:0; width:100%; height:100%; border:0; }
#vnote { text-align:center; padding:10px 12px; }
#vnote:empty { display:none; }
#vnote button { margin-left:4px; }
