/* ===== Text Mask Effect - Applied to text outside card ===== */
h1, h2, h3, h4, h5, h6,
p, span, li, a:not(.cta-button),
.hero-title,
.hero-subtitle,
.section-title,
.section-intro,
.statement-text,
.statement-italic,
.feature-item span:not(.gold-dot),
footer {
  background-image: url('aged-parchment.png');
  background-size: 400px 400px;
  background-position: center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ===== Card Text - Solid colors, no texture ===== */
.parchment-card p,
.parchment-card span,
.card-intro,
.card-emphasis,
.card-body,
.card-intro .hebrew,
.episode-card h5,
.episode-card p,
.episode-card-title,
.episode-card-subtitle {
  background-image: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: currentColor;
}

/* ===== CSS Custom Properties ===== */
:root {
  /* Colors */
  --bg-dark: #0a2035;
  --bg-darker: #071828;
  --text-primary: #f3f5f8;
  --text-secondary: #c5ccd6;
  --text-muted: #9aa5b4;
  --gold-light: #d4a84b;
  --gold-mid: #c69540;
  --gold-dark: #b8842f;
  --parchment-light: #f8f4eb;
  --parchment-dark: #e8dcc8;
  --card-text: #2a3340;
  --card-text-light: #4a5568;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 40px;
  --space-xl: 64px;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Libre Baskerville', Georgia, serif;
  --h1-size: 42px;
  --h2-size: 32px;
  --body-size: 17px;
  --small-size: 15px;

  /* Effects */
  --shadow-card: 0 20px 50px rgba(0,0,0,0.35);
  --radius-card: 16px;
  --radius-button: 8px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  background: 
    /* Subtle light glow from top */
    radial-gradient(ellipse 900px 400px at 50% -100px, rgba(255,255,255,0.08), transparent 70%),
    /* Warm gold ambient glow left */
    radial-gradient(ellipse 600px 500px at 15% 40%, rgba(212,168,75,0.06), transparent 60%),
    /* Warm gold ambient glow right */
    radial-gradient(ellipse 600px 500px at 85% 60%, rgba(212,168,75,0.05), transparent 60%),
    /* Main gradient */
    linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
  background-attachment: fixed;
}

body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.7;
  color: var(--text-primary);
  min-height: 100vh;
}

/* ===== Page Wrapper ===== */
.page {
  min-height: 100vh;
}

/* ===== Layout Containers ===== */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.reading {
  max-width: 700px;
  margin: 0 auto;
}

/* ===== Hero Section ===== */
.hero {
  padding: var(--space-xl) 0 var(--space-lg);
  text-align: center;
}

/* Torah Scroll SVG Container */
.scroll-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.scroll-svg {
  width: 320px;
  height: auto;
  filter: drop-shadow(0 15px 35px rgba(0,0,0,0.4));
}

/* Hero Title */
.hero-title {
  font-family: var(--font-display);
  font-size: var(--h1-size);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
  letter-spacing: 0.01em;
}

.hero-title br {
  display: block;
}

.hero-title-line {
  white-space: nowrap;
  display: inline-block;
  padding-right: var(--space-sm);
}

/* Hero Subtitle */
.hero-subtitle {
  font-family: var(--font-body);
  font-size: var(--body-size);
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto var(--space-md);
  line-height: 1.75;
}

/* CTA Button */
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  background: linear-gradient(90deg, #c78a2a 0%, #d89a3a 40%, #e2ad4c 70%, #c78a2a 100%);
  border: none;
  border-radius: var(--radius-button);
  box-shadow: 
    0 8px 24px rgba(139,94,30,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 12px 32px rgba(139,94,30,0.5),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

.cta-button:active {
  transform: translateY(0);
}

.cta-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ===== Parchment Card Section ===== */
.section {
  padding: var(--space-lg) 0;
}

.parchment-card {
  background-image: url('aged-parchment.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  color: var(--card-text);
}

.card-intro {
  font-size: var(--body-size);
  line-height: 1.8;
  margin-bottom: var(--space-sm);
  color: var(--card-text);
}

.card-intro .hebrew {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--gold-dark);
  margin-right: 4px;
}

.card-emphasis {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--card-text);
  margin: var(--space-md) 0;
}

.card-body {
  font-size: var(--body-size);
  line-height: 1.8;
  color: var(--card-text-light);
  margin-bottom: var(--space-sm);
}

.card-body:last-child {
  margin-bottom: 0;
}

/* ===== Who This Is For Section ===== */
.section-title {
  font-family: var(--font-display);
  font-size: var(--h2-size);
  font-weight: 500;
  text-align: center;
  margin-bottom: var(--space-xs);
}

.section-intro {
  font-family: var(--font-body);
  font-size: var(--body-size);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-md);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  font-size: var(--body-size);
  color: var(--text-secondary);
  line-height: 1.6;
}

.gold-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-top: 8px;
  background: var(--gold-mid);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(212,168,75,0.5);
}

/* ===== Statement Section ===== */
.statement {
  padding: var(--space-xl) 0;
  text-align: center;
}

.statement-text {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: var(--space-md);
}

.statement-text em {
  font-style: italic;
}

.statement-italic {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 22px;
  margin-bottom: var(--space-md);
}

.divider {
  width: 200px;
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--text-muted), transparent);
}

/* ===== Dedication Section ===== */
.dedication {
  background-image: url('aged-parchment.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: var(--space-md) var(--space-md);
  text-align: center;
}

.dedication-text {
  font-family: var(--font-body);
  font-size: var(--small-size);
  font-style: italic;
  color: var(--card-text-light);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
  background-image: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: var(--card-text-light);
}

/* ===== Footer ===== */
footer {
  padding: var(--space-lg) 0;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--small-size);
}

/* ===== Listening Drawer ===== */
.listening-drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-out, opacity 0.4s ease-out, margin 0.5s ease-out;
  opacity: 0;
  margin-top: 0;
}

.listening-drawer.expanded {
  max-height: 1200px;
  opacity: 1;
  margin-top: var(--space-lg);
}

@media (prefers-reduced-motion: reduce) {
  .listening-drawer {
    transition: none;
  }
}

.drawer-inner {
  padding-top: var(--space-md);
}

/* Drawer Context */
.drawer-context {
  text-align: center;
  margin-bottom: var(--space-md);
}

.drawer-context-label {
  font-family: var(--font-body);
  font-size: var(--small-size);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-style: italic;
}

.drawer-episode-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.drawer-episode-desc {
  font-family: var(--font-body);
  font-size: var(--body-size);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* Audio Player */
.drawer-player {
  background-image: url('aged-parchment.png');
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-card);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-md) auto;
  max-width: 600px;
  box-shadow: var(--shadow-card);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.player-speed-btn {
  background: transparent;
  border: 1px solid var(--gold-dark);
  color: var(--gold-dark);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  min-width: 42px;
}

.player-speed-btn:hover {
  background: var(--gold-dark);
  color: var(--parchment-light);
}

.player-time {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--card-text-light);
  min-width: 45px;
  text-align: center;
  background: none;
  -webkit-text-fill-color: var(--card-text-light);
}

.player-scrub-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.player-scrub-bar {
  flex: 1;
  height: 6px;
  background: var(--parchment-dark);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  overflow: visible;
}

.player-scrub-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-mid));
  border-radius: 3px;
  position: relative;
  width: 0%;
  transition: width 0.1s linear;
}

.player-scrub-handle {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--gold-mid);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.player-play-btn {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--gold-mid), var(--gold-dark));
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(139,94,30,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.player-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(139,94,30,0.5);
}

.player-play-btn svg {
  width: 24px;
  height: 24px;
  fill: #ffffff;
}

.player-time-total {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--card-text-light);
  min-width: 45px;
  text-align: center;
  background: none;
  -webkit-text-fill-color: var(--card-text-light);
}

/* Episode Browser */
.drawer-browser {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.drawer-browser-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  text-align: center;
  margin-bottom: var(--space-md);
}

.episode-scroll-container {
  position: relative;
}

.episode-scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(10, 32, 53, 0.9);
  border: 1px solid var(--gold-mid);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  pointer-events: none;
}

.episode-scroll-container:hover .episode-scroll-arrow {
  opacity: 1;
  pointer-events: auto;
}

.episode-scroll-arrow:hover {
  background: var(--gold-mid);
}

.episode-scroll-arrow:hover svg {
  fill: var(--bg-darker);
}

.episode-scroll-arrow svg {
  width: 20px;
  height: 20px;
  fill: var(--gold-mid);
  transition: fill 0.2s ease;
}

.episode-scroll-arrow.arrow-left {
  left: -8px;
}

.episode-scroll-arrow.arrow-right {
  right: -8px;
}

.episode-scroll-arrow.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

.episode-scroll {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-xs) 0 var(--space-md);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.episode-scroll::-webkit-scrollbar {
  display: none;
}

.episode-card {
  flex: 0 0 280px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: var(--space-md);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.episode-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(212,168,75,0.3);
}

.episode-card.active {
  border-color: var(--gold-mid);
  background: rgba(212,168,75,0.08);
}

.episode-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  line-height: 1.3;
  color: var(--text-primary) !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

.episode-card-subtitle {
  font-family: var(--font-body);
  font-size: var(--small-size);
  color: var(--text-muted) !important;
  line-height: 1.5;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

/* Platform Links */
.drawer-platforms {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

.drawer-platforms-intro {
  font-family: var(--font-body);
  font-size: var(--small-size);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.platform-buttons {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.platform-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: var(--small-size);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-button);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.platform-btn svg {
  width: 20px;
  height: 20px;
}

.platform-btn-spotify {
  background: #1DB954;
  color: #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, -webkit-text-fill-color 0.2s ease;
}

.platform-btn-spotify svg {
  fill: #ffffff;
}

.platform-btn-spotify:hover {
  transform: translateY(-2px);
  background: linear-gradient(90deg, #c78a2a 0%, #d89a3a 40%, #e2ad4c 70%, #c78a2a 100%);
  color: var(--bg-darker);
  -webkit-text-fill-color: var(--bg-darker);
  box-shadow: 
    0 8px 24px rgba(139,94,30,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.platform-btn-spotify:hover svg {
  fill: #ffffff;
}

.platform-btn-apple {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, -webkit-text-fill-color 0.2s ease;
}

.platform-btn-apple svg {
  fill: #ffffff;
}

.platform-btn-apple:hover {
  transform: translateY(-2px);
  background: linear-gradient(90deg, #c78a2a 0%, #d89a3a 40%, #e2ad4c 70%, #c78a2a 100%);
  border-color: transparent;
  color: var(--bg-darker);
  -webkit-text-fill-color: var(--bg-darker);
  box-shadow: 
    0 8px 24px rgba(139,94,30,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.platform-btn-apple:hover svg {
  fill: #ffffff;
}

/* Minimized Bar */
.mini-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-darker);
  border-top: 1px solid rgba(212,168,75,0.2);
  padding: 12px var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.4s ease-out;
}

.mini-player.visible {
  transform: translateY(0);
}

.mini-player-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--body-size);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold-mid), var(--gold-dark));
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mini-player-btn svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

.mini-player-expand {
  background: transparent;
  border: 1px solid var(--gold-mid);
  color: var(--gold-mid);
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: var(--small-size);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.mini-player-expand:hover {
  background: var(--gold-mid);
  color: var(--bg-darker);
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.player-play-btn:focus,
.player-speed-btn:focus,
.episode-card:focus,
.platform-btn:focus,
.mini-player-btn:focus,
.mini-player-expand:focus {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

/* Drawer Responsive */
@media (max-width: 768px) {
  .drawer-episode-title {
    font-size: 24px;
  }

  .drawer-player {
    padding: var(--space-sm) var(--space-md);
  }

  .player-play-btn {
    width: 48px;
    height: 48px;
  }

  .player-play-btn svg {
    width: 20px;
    height: 20px;
  }

  .episode-card {
    flex: 0 0 240px;
  }

  .episode-card-title {
    font-size: 16px;
  }

  .drawer-browser-title {
    font-size: 20px;
  }
}

@media (max-width: 375px) {
  .player-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .player-scrub-container {
    order: 3;
    width: 100%;
    margin-top: var(--space-sm);
  }

  .episode-card {
    flex: 0 0 200px;
  }

  .platform-buttons {
    flex-direction: column;
    align-items: center;
  }

  .platform-btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
}

/* ===== Responsive Styles ===== */
@media (max-width: 768px) {
  :root {
    --h1-size: 32px;
    --h2-size: 26px;
    --body-size: 16px;
    --space-lg: 32px;
    --space-xl: 48px;
  }

  .scroll-svg {
    width: 260px;
  }

  .parchment-card {
    padding: var(--space-md);
  }

  .card-emphasis {
    font-size: 20px;
  }

  .statement-text {
    font-size: 22px;
  }
}

@media (max-width: 375px) {
  :root {
    --h1-size: 28px;
    --h2-size: 24px;
    --body-size: 15px;
    --space-md: 20px;
    --space-lg: 28px;
    --space-xl: 40px;
  }

  .container {
    padding: 0 var(--space-sm);
  }

  .scroll-svg {
    width: 220px;
  }

  .hero-title {
    font-size: var(--h1-size);
  }

  .cta-button {
    width: 100%;
    padding: 14px 24px;
  }

  .parchment-card {
    padding: var(--space-md);
    border-radius: 12px;
  }

  .card-intro .hebrew {
    font-size: 20px;
  }

  .card-emphasis {
    font-size: 18px;
  }

  .statement-text {
    font-size: 20px;
  }

  .feature-item {
    font-size: var(--small-size);
  }
}
