/* ==========================================================================
   Your Daily Lex — site styles (2026)
   ========================================================================== */

:root {
  --bg: #150b2b;
  --bg-2: #1d1040;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #22143f;
  --surface-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);

  --ink: #f1ecfb;
  --ink-2: #cfc4e8;
  --muted: #9a8cc0;

  --accent: #f2b544;          /* warm amber — pulls from the sepia artwork */
  --accent-deep: #d9951f;
  --accent-ink: #2a1a05;
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.16);
  --link: #c9b6ff;

  --glow-accent: rgba(242, 181, 68, 0.22);
  --glow-violet: rgba(139, 92, 246, 0.32);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-art: 0 24px 50px -14px rgba(0, 0, 0, 0.75);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Outfit", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --max: 920px;
  --player-h: 76px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 85% -10%, var(--glow-violet), transparent 65%),
    radial-gradient(700px 420px at -10% 20%, rgba(242, 181, 68, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 520px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "calt";
}
body.has-dock { padding-bottom: calc(var(--player-h) + 24px); }

img { max-width: 100%; height: auto; border: 0; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: rgba(201, 182, 255, 0.4);
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: #fff; text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }

.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;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(21, 11, 43, 0.72);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 58px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; font-size: 16px;
  font-family: var(--display);
}
.brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.nav-links { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-links a {
  display: inline-block; padding: 7px 11px; border-radius: var(--radius-pill);
  color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--surface-2); color: #fff; }
.brand, .brand img { flex: none; }
@media (max-width: 560px) {
  .brand span { display: none; }
  .nav-links a { padding: 7px 8px; font-size: 13.5px; }
  .nav-links li:last-child { display: none; }
}

/* ---------- hero ---------- */

.hero { padding: 56px 0 44px; border-bottom: 1px solid var(--line); }
.hero .wrap {
  display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: center;
}
.hero-art {
  width: 220px; height: 220px; border-radius: 22px; display: block;
  box-shadow: var(--shadow-art), 0 0 0 1px rgba(255,255,255,0.08);
}
.hero h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 800;
  background: linear-gradient(120deg, #fff 0%, #e9defc 55%, var(--accent) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .tagline {
  margin: 0 0 10px; font-size: clamp(17px, 2vw, 20px); line-height: 1.45; color: var(--ink-2); max-width: 560px;
}
.hero .blurb { margin: 0 0 22px; font-size: 15px; color: var(--muted); max-width: 560px; }
.hero .blurb a { color: var(--ink-2); }

.listen-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  font-size: 14px; font-weight: 600; text-decoration: none; line-height: 1;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.12); color: #fff; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px -6px var(--accent); }
.btn-primary:hover { background: #ffc35a; border-color: #ffc35a; color: var(--accent-ink); }

@media (max-width: 720px) {
  .hero { padding: 40px 0 34px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 26px; text-align: center; }
  .hero-art { margin: 0 auto; width: 180px; height: 180px; }
  .hero .tagline, .hero .blurb { margin-left: auto; margin-right: auto; }
  .listen-row { justify-content: center; }
}

/* ---------- sections ---------- */

.section { padding: 36px 0 20px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-family: var(--display); font-size: 22px; letter-spacing: -0.02em; font-weight: 700; }
.section-head .count {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  padding: 3px 8px; border-radius: var(--radius-pill); background: var(--surface-2);
}

/* ---------- episode cards ---------- */

.ep-list { display: grid; gap: 12px; }

.ep {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.ep:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.06); }
.ep.is-playing { border-color: rgba(242, 181, 68, 0.55); box-shadow: 0 0 0 3px var(--glow-accent); }

.ep-head { display: grid; grid-template-columns: 1fr auto; gap: 12px 18px; align-items: start; }
.ep-num {
  display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--violet); background: var(--violet-soft); padding: 3px 8px; border-radius: 6px; margin-bottom: 8px;
}
.ep-title { margin: 0 0 6px; font-size: 18.5px; line-height: 1.3; font-weight: 700; letter-spacing: -0.015em; }
.ep-title a { color: var(--ink); text-decoration: none; }
.ep-title a:hover { color: var(--accent); }
.ep-meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.ep-meta a { color: var(--muted); }
.ep-meta a:hover { color: var(--ink); }

.play-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; flex: none;
  box-shadow: 0 6px 18px -6px var(--accent);
  transition: transform .15s ease, background .15s ease;
}
.play-btn:hover { transform: scale(1.05); background: #ffc35a; }
.play-btn:active { transform: scale(.97); }
.play-btn > span { display: flex; align-items: center; justify-content: center; line-height: 0; }
.play-btn svg { width: 18px; height: 18px; display: block; }
.play-btn .i-pause { display: none; }
.play-btn.is-playing .i-play { display: none; }
.play-btn.is-playing .i-pause { display: block; }

.notes {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  color: var(--ink-2); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere;
}
.notes p { margin: 0 0 10px; }
.notes p:last-child { margin-bottom: 0; }
.notes ul, .notes ol { margin: 8px 0 10px; padding-left: 22px; }
.notes li { margin: 4px 0; }
.notes img { border-radius: var(--radius-sm); }
.notes .transcript_link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 2px; padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.notes .transcript_link::before { content: "\1F4DD"; font-size: 12px; }
.notes .transcript_link:hover { color: #fff; border-color: rgba(255,255,255,0.35); }

.ep.featured {
  padding: 24px 26px 22px;
  border-color: rgba(242, 181, 68, 0.35);
  background:
    radial-gradient(480px 220px at 100% 0%, var(--glow-accent), transparent 70%),
    var(--surface);
}
.ep.featured .ep-title { font-size: clamp(22px, 3vw, 28px); }
.ep.featured .notes { font-size: 16px; }

@media (max-width: 560px) {
  .ep { padding: 16px 16px 14px; }
  .ep.featured { padding: 20px 18px 18px; }
  .ep .play-btn { width: 40px; height: 40px; }
  .ep-title { font-size: 17px; }
}

/* loading sentinel */
.sentinel {
  text-align: center; padding: 28px 0 20px; color: var(--muted); font-size: 13.5px; min-height: 72px;
}
.sentinel > * { display: none; }
.sentinel[data-state="loading"] .s-loading,
.sentinel[data-state="error"] .s-error,
.sentinel[data-state="done"] .s-done { display: inline-flex; align-items: center; gap: 10px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sentinel button {
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  border-radius: var(--radius-pill); padding: 6px 12px; font-size: 13px; cursor: pointer;
}

/* ---------- player ---------- */

.player {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 12px 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.player .controls { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer; position: relative;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: #fff; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .skip-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -42%);
  font-size: 7.5px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; line-height: 1;
}
.player .track { display: grid; gap: 6px; min-width: 0; }
.player .track-title {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player .track-title a { color: inherit; text-decoration: none; }
.player .track-title a:hover { color: var(--accent); }
.player .bar {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.player input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px;
  background: transparent; margin: 0; cursor: pointer; --pct: 0%;
}
.player input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--pct), var(--line-strong) var(--pct));
}
.player input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: var(--line-strong); }
.player input[type="range"]::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--accent); }
.player input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4.5px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transition: transform .1s ease;
}
.player input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.player input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
.player .extras { display: flex; align-items: center; gap: 4px; }
.speed-btn {
  border: 1px solid var(--line-strong); background: transparent; border-radius: var(--radius-pill);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; padding: 5px 9px;
  color: var(--ink-2); cursor: pointer; min-width: 46px;
  transition: border-color .15s ease, color .15s ease;
}
.speed-btn:hover { border-color: var(--accent); color: var(--accent); }
.player .dl { color: var(--ink-2); text-decoration: none; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(21, 11, 43, 0.7);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
  transform: translateY(110%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.dock.is-open { transform: translateY(0); }
.dock .player { max-width: var(--max); margin: 0 auto; grid-template-columns: auto auto 1fr auto; }
.dock .art { width: 44px; height: 44px; border-radius: 8px; display: block; }

@media (max-width: 640px) {
  .player { grid-template-columns: auto 1fr; }
  .player .extras { grid-column: 1 / -1; justify-content: flex-end; }
  .dock .player { grid-template-columns: auto auto 1fr; }
  .dock .art { display: none; }
  .icon-btn.skip { display: none; }
}

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 28px 0 40px; color: var(--muted); font-size: 13.5px; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; align-items: center; }
.footer ul { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: #fff; }

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