/* Created with Claude */
/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --bg:        #1a1a1a;
  --surface:   #242424;
  --surface2:  #2c2c2c;
  --border:    #333333;
  --accent:    #c0392b;
  --accent-hv: #e74c3c;
  --text:      #e8e8e8;
  --text-muted:#999999;
  --radius:    6px;
  --logo-h:    2rem;
}

/* System default: light */
@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f5f5f5;
    --surface:   #ffffff;
    --surface2:  #f0f0f0;
    --border:    #dddddd;
    --accent:    #c0392b;
    --accent-hv: #a93226;
    --text:      #1a1a1a;
    --text-muted:#666666;
  }
}

/* Explicit overrides — applied via data-theme attribute by JS.
   These beat the media query above, so cookie preference wins. */
[data-theme="dark"] {
  --bg:        #1a1a1a;
  --surface:   #242424;
  --surface2:  #2c2c2c;
  --border:    #333333;
  --accent:    #c0392b;
  --accent-hv: #e74c3c;
  --text:      #e8e8e8;
  --text-muted:#999999;
}
[data-theme="light"] {
  --bg:        #f5f5f5;
  --surface:   #ffffff;
  --surface2:  #f0f0f0;
  --border:    #dddddd;
  --accent:    #c0392b;
  --accent-hv: #a93226;
  --text:      #1a1a1a;
  --text-muted:#666666;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hv); }

/* ── HEADER ─────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 0.75rem 1.25rem;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.logo-link img {
  height: var(--logo-h);
  width: auto;
  display: block;
  transition: opacity 0.2s;
}
.logo-link:hover img { opacity: 0.75; }

.header-title {
  flex: 1;
  text-align: center;
}
.header-title h1 {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.header-title p {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.back-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.back-link:hover { color: var(--text); }

/* ── THEME TOGGLE BUTTON ─────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.3rem 0.45rem;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* The button shows the icon for the mode you will switch TO.
   Default (no data-theme): follow system. */
.theme-toggle .icon-to-light { display: none; }
.theme-toggle .icon-to-dark  { display: inline; }

/* System is light → currently light → offer dark */
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .theme-toggle .icon-to-light { display: none;   }
  html:not([data-theme]) .theme-toggle .icon-to-dark  { display: inline; }
}
/* System is dark → currently dark → offer light */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle .icon-to-light { display: inline; }
  html:not([data-theme]) .theme-toggle .icon-to-dark  { display: none;   }
}

/* Cookie overrides system */
[data-theme="dark"]  .theme-toggle .icon-to-light { display: inline; }
[data-theme="dark"]  .theme-toggle .icon-to-dark  { display: none;   }
[data-theme="light"] .theme-toggle .icon-to-light { display: none;   }
[data-theme="light"] .theme-toggle .icon-to-dark  { display: inline; }

/* ── MAIN ────────────────────────────────────────────────── */
main {
  max-width: 900px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
}

/* ── PODCAST HERO ────────────────────────────────────────── */
.podcast-hero {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.podcast-cover {
  flex-shrink: 0;
  width: clamp(100px, 20vw, 180px);
}
.podcast-cover img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.podcast-info { flex: 1; min-width: 0; }
.podcast-info h2 {
  font-size: clamp(1.2rem, 4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.podcast-info .description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ── SUBSCRIBE BAR ───────────────────────────────────────── */
.subscribe-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.subscribe-bar span {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  flex-shrink: 0;
}
.subscribe-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  transition: background 0.2s;
  white-space: nowrap;
}
.subscribe-btn:hover { background: var(--accent-hv); color: #fff !important; }
.subscribe-btn.outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted) !important;
}
.subscribe-btn.outline:hover { border-color: var(--accent); color: var(--text) !important; }

/* ── EPISODES ────────────────────────────────────────────── */
.section-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.episode {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.episode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  gap: 1rem;
}
.episode-header:hover { background: var(--surface2); }

.episode-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  flex-shrink: 0;
}
.episode-date, .episode-duration {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.episode-chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.episode-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.episode-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0.75rem 0 1rem;
}
.episode-description p { margin-top: 0.5rem; }
.episode-description p:first-child { margin-top: 0; }

audio.episode-player {
  width: 100%;
  display: block;
  border-radius: 4px;
  accent-color: var(--accent);
  outline: none;
}
audio { display: block; }

/* Details/summary toggle (used by feed.xsl) */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ── FOOTER ─────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 540px) {
  .podcast-hero { flex-direction: column; }
  .podcast-cover { width: 120px; }
  .episode-title { white-space: normal; }
}
