/* ═══════════════════════════════════════════════════════════════════
   Children Stories — Persistent Player + Story Page Styles
   Import Google Fonts in your theme or add to wp_enqueue_scripts:
   https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Nunito:wght@400;600;700&display=swap
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --cs-ink:      #2c2416;
  --cs-paper:    #fdf8f0;
  --cs-warm:     #c8793a;
  --cs-warm-d:   #a85f25;
  --cs-green:    #3d7a5a;
  --cs-muted:    #8a7a65;
  --cs-border:   #e8dfd0;
  --cs-surface:  #ffffff;
  --cs-free:     #3d7a5a;
  --cs-shadow:   0 4px 24px rgba(44,36,22,.12);
  --cs-player-h: 76px;
  --cs-radius:   14px;
  --cs-font-body: 'Nunito', 'Segoe UI', sans-serif;
  --cs-font-head: 'Lora', Georgia, serif;
}

/* ── Push page content up so player doesn't cover it ── */
body {
  padding-bottom: calc(var(--cs-player-h) + 16px) !important;
}

/* ══════════════════════════════════════════════════
   PERSISTENT BOTTOM PLAYER
   ══════════════════════════════════════════════════ */
.cs-player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  background: var(--cs-ink);
  color: #fff;
  height: var(--cs-player-h);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 32px rgba(44,36,22,.35);
  font-family: var(--cs-font-body);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
.cs-player.visible {
  transform: translateY(0);
}

/* Progress bar */
.cs-player__progress-wrap {
  height: 4px;
  background: rgba(255,255,255,.15);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.cs-player__progress {
  height: 100%;
  position: relative;
  width: 100%;
}
.cs-player__progress-fill {
  height: 100%;
  background: var(--cs-warm);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
  transition: width .4s linear;
}
.cs-player__progress-thumb {
  position: absolute;
  top: 50%; right: auto;
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  left: 0%;
}
.cs-player__progress-wrap:hover .cs-player__progress-thumb { opacity: 1; }

/* Body row */
.cs-player__body {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

/* Track (cover + info) */
.cs-player__track {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.cs-player__cover {
  width: 44px; height: 44px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.cs-player__cover img {
  width: 100%; height: 100%; object-fit: cover;
}
.cs-player__info { min-width: 0; }
.cs-player__title {
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.cs-player__time {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  margin-top: 2px;
}

/* Controls */
.cs-player__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.cs-btn-icon {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.cs-btn-icon svg { width: 22px; height: 22px; }
.cs-btn-icon:hover { background: rgba(255,255,255,.12); color: #fff; }

.cs-btn-play {
  background: var(--cs-warm);
  border: none;
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.cs-btn-play svg { width: 26px; height: 26px; }
.cs-btn-play:hover { background: var(--cs-warm-d); }
.cs-btn-play:active { transform: scale(.93); }

.cs-btn-speed {
  background: rgba(255,255,255,.12);
  border: none;
  color: rgba(255,255,255,.8);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  font-family: var(--cs-font-body);
}
.cs-btn-speed:hover { background: rgba(255,255,255,.2); color: #fff; }

/* Preview progress bar accent */
.cs-player.is-preview .cs-player__progress-fill {
  background: #f59e0b;
}

/* ══════════════════════════════════════════════════
   STORY PAGE  (single-story.php)
   ══════════════════════════════════════════════════ */
.cs-story-page {
  font-family: var(--cs-font-body);
  color: var(--cs-ink);
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* Hero row */
.cs-story-hero {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 32px;
}
@media (max-width: 560px) {
  .cs-story-hero { flex-direction: column; align-items: center; text-align: center; }
}

.cs-story-cover {
  width: 180px;
  height: 180px;
  border-radius: var(--cs-radius);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--cs-shadow);
}
.cs-story-cover-placeholder {
  width: 180px; height: 180px;
  border-radius: var(--cs-radius);
  background: linear-gradient(135deg, #f3e9d8, #e8d5b7);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  flex-shrink: 0;
}

.cs-story-header { flex: 1; min-width: 0; }
.cs-story-header h1 {
  font-family: var(--cs-font-head);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--cs-ink);
}
.cs-story-meta {
  color: var(--cs-muted);
  font-size: .9rem;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
}
.cs-story-meta .sep { color: var(--cs-border); }

.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.cs-tag {
  background: #f3e9d8;
  color: var(--cs-warm-d);
  border-radius: 20px;
  padding: 3px 11px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}
.cs-tag:hover { background: #e8d5b7; }
.cs-tag.free { background: #d1fae5; color: var(--cs-green); }

/* ── Play button on story page ── */
.cs-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--cs-warm);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--cs-font-body);
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(200,121,58,.35);
  text-decoration: none;
}
.cs-play-btn:hover { background: var(--cs-warm-d); box-shadow: 0 6px 20px rgba(200,121,58,.45); }
.cs-play-btn:active { transform: scale(.97); }
.cs-play-btn svg { width: 20px; height: 20px; }
.cs-play-btn.preview { background: #f59e0b; box-shadow: 0 4px 16px rgba(245,158,11,.35); }
.cs-play-btn.preview:hover { background: #d97706; }

/* Resume label */
.cs-resume-hint {
  display: inline-block;
  font-size: .8rem;
  color: var(--cs-muted);
  margin-left: 14px;
  vertical-align: middle;
}

/* ── Paywall box ── */
.cs-paywall {
  background: linear-gradient(135deg, #fdf3e7, #fef9f2);
  border: 1.5px solid #f3d9b5;
  border-radius: var(--cs-radius);
  padding: 28px 24px;
  text-align: center;
  margin: 8px 0 24px;
}
.cs-paywall__icon { font-size: 2.5rem; margin-bottom: 10px; }
.cs-paywall h3 {
  font-family: var(--cs-font-head);
  font-size: 1.2rem;
  margin: 0 0 8px;
}
.cs-paywall p {
  color: var(--cs-muted);
  font-size: .9rem;
  margin: 0 0 20px;
  line-height: 1.6;
}
.cs-paywall__plans {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cs-plan {
  background: #fff;
  border: 1.5px solid var(--cs-border);
  border-radius: 10px;
  padding: 12px 18px;
  text-align: center;
  min-width: 110px;
  transition: border-color .15s, box-shadow .15s;
}
.cs-plan:hover { border-color: var(--cs-warm); box-shadow: 0 2px 12px rgba(200,121,58,.15); }
.cs-plan .price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cs-warm);
  font-family: var(--cs-font-head);
}
.cs-plan .period { font-size: .75rem; color: var(--cs-muted); margin-top: 2px; }
.cs-plan.popular { border-color: var(--cs-warm); background: #fffaf5; }
.cs-plan.popular .period::before { content: '⭐ '; }

.cs-btn-join {
  display: inline-block;
  background: var(--cs-warm);
  color: #fff;
  border-radius: 50px;
  padding: 12px 32px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  transition: background .15s;
  font-family: var(--cs-font-body);
}
.cs-btn-join:hover { background: var(--cs-warm-d); color: #fff; }

.cs-login-hint {
  margin-top: 12px;
  font-size: .82rem;
  color: var(--cs-muted);
}
.cs-login-hint a { color: var(--cs-warm); }

/* ── Preview notice ── */
.cs-preview-notice {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: .85rem;
  color: #92400e;
  margin: 0 0 16px;
}
.cs-preview-notice a { color: var(--cs-warm); font-weight: 700; }

/* ── Story description ── */
.cs-story-description {
  font-family: var(--cs-font-head);
  font-size: 1.05rem;
  line-height: 1.75;
  color: #3d3325;
  margin: 28px 0;
  border-left: 3px solid var(--cs-border);
  padding-left: 20px;
  font-style: italic;
}

/* ── Story content (full WP content) ── */
.cs-story-content {
  font-size: .95rem;
  line-height: 1.75;
  color: var(--cs-ink);
}

/* ── Related stories ── */
.cs-related { margin-top: 40px; }
.cs-related h2 {
  font-family: var(--cs-font-head);
  font-size: 1.15rem;
  margin-bottom: 16px;
  color: var(--cs-ink);
}
.cs-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

/* ── Story card (used in related) ── */
.cs-card {
  background: var(--cs-surface);
  border-radius: var(--cs-radius);
  box-shadow: var(--cs-shadow);
  overflow: hidden;
  text-decoration: none;
  color: var(--cs-ink);
  display: block;
  transition: transform .15s, box-shadow .15s;
}
.cs-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(44,36,22,.16); }
.cs-card__cover {
  width: 100%; aspect-ratio: 1;
  background: linear-gradient(135deg, #f3e9d8, #e8d5b7);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  position: relative;
  overflow: hidden;
}
.cs-card__cover img { width:100%; height:100%; object-fit:cover; }
.cs-card__lock {
  position: absolute; top:6px; right:6px;
  background: rgba(44,36,22,.6);
  border-radius: 6px; padding: 2px 6px;
  color: #fff; font-size: .65rem;
}
.cs-card__body { padding: 8px 10px 12px; }
.cs-card__title {
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-card__meta { font-size: .72rem; color: var(--cs-muted); margin-top: 3px; }

/* ── PJAX loading indicator ── */
.cs-loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--cs-warm);
  z-index: 99999;
  width: 0%;
  transition: width .3s ease, opacity .3s;
  opacity: 0;
}
.cs-loading-bar.loading {
  opacity: 1;
  width: 70%;
  transition: width 1.5s ease;
}
.cs-loading-bar.done {
  width: 100%;
  transition: width .15s ease;
}

/* ── Donation / support bar ── */
.cs-support-bar {
  background: var(--cs-paper);
  border-top: 1.5px solid var(--cs-border);
  padding: 16px 20px;
  text-align: center;
  font-size: .85rem;
  color: var(--cs-muted);
  margin-top: 40px;
}
.cs-support-bar a { color: var(--cs-warm); font-weight: 700; }
