/* ORA Production — Reader styles v2 (T023 redesign) */
/* Extended from v1. Google Fonts loaded by reader.js on chapter pages. */

/* ── Reading theme system ── */
:root {
  --rd-bg: #0f0f0f;
  --rd-surface: #1a1a1a;
  --rd-text: #e8e2d9;
  --rd-muted: #8a8480;
  --rd-border: #2a2724;
  --rd-accent: var(--color-accent, #c97a5a);
  --rd-accent-dark: var(--color-accent-dark, #a85e3e);
  --rd-font-body: 'Lora', Georgia, 'Times New Roman', serif;
  --rd-font-display: 'Playfair Display', Georgia, serif;
  --rd-font-ui: 'Helvetica Neue', Arial, sans-serif;
  --rd-size-body: 19px;
  --rd-size-mobile: 17px;
  --rd-lh: 1.78;
  --rd-col: 65ch;
}

/* ── Theme: sepia ── */
[data-theme="sepia"] {
  --rd-bg: #f4efe8;
  --rd-surface: #ede7de;
  --rd-text: #3a2f22;
  --rd-muted: #7a6d5e;
  --rd-border: #d4cbbf;
}
[data-theme="sepia"] .read-header {
  background: rgba(244,239,232,0.94);
}
[data-theme="sepia"] #read-progress {
  background: var(--rd-accent);
}
[data-theme="sepia"] .read-body em { color: var(--rd-accent); }
[data-theme="sepia"] .paywall {
  background: #ede7de;
  border-color: #d4cbbf;
}

/* ── Theme: light ── */
[data-theme="light"] {
  --rd-bg: #faf8f5;
  --rd-surface: #f0ece6;
  --rd-text: #1a1714;
  --rd-muted: #6b6560;
  --rd-border: #ddd8d2;
}
[data-theme="light"] .read-header {
  background: rgba(250,248,245,0.94);
}
[data-theme="light"] .read-back { color: var(--rd-muted); }
[data-theme="light"] .read-back:hover { color: var(--rd-text); }
[data-theme="light"] .read-ep-label { color: var(--rd-muted); }
[data-theme="light"] .read-body strong { color: var(--rd-text); }
[data-theme="light"] .paywall {
  background: #f0ece6;
  border-color: #ddd8d2;
}
[data-theme="light"] .paywall-headline { color: var(--rd-text); }

/* ── Font size system ── */
[data-font-size="sm"] { --rd-size-body: 16px; --rd-size-mobile: 15px; }
[data-font-size="md"] { --rd-size-body: 19px; --rd-size-mobile: 17px; }
[data-font-size="lg"] { --rd-size-body: 22px; --rd-size-mobile: 19px; }

/* ── Base body override for reader ── */
body {
  background: var(--rd-bg);
  color: var(--rd-text);
  font-family: var(--rd-font-body);
  transition: background 0.25s ease, color 0.25s ease;
}

/* ── Progress bar ── */
#read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--rd-accent);
  z-index: 1100;
  transition: width 0.12s linear;
  transform-origin: left;
}

/* ── Sticky header ── */
.read-header {
  position: sticky;
  top: 3px;
  z-index: 100;
  background: rgba(15,15,15,0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rd-border);
  padding: 0.65rem 0;
  transition: background 0.25s ease;
}
.read-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.read-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--rd-muted);
  font-family: var(--rd-font-ui);
  font-size: 0.8rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}
.read-back:hover { color: var(--rd-text); }
.read-back svg { flex-shrink: 0; }

.read-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--rd-muted);
  text-decoration: none;
  font-size: 0.85em;
  padding: 4px 8px;
  margin-right: 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.read-home:hover {
  color: var(--rd-text);
  background: rgba(255,255,255,0.04);
}
.read-home svg { flex-shrink: 0; }
[data-theme="light"] .read-home { color: var(--rd-muted); }
[data-theme="light"] .read-home:hover { color: var(--rd-text); background: rgba(0,0,0,0.04); }
@media (max-width: 480px) {
  .read-home span { display: none; }
}

.read-ep-label {
  font-family: var(--rd-font-ui);
  font-size: 0.72rem;
  color: var(--rd-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.read-header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Settings button ── */
.read-settings-btn {
  background: none;
  border: 1px solid var(--rd-border);
  border-radius: 6px;
  color: var(--rd-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.read-settings-btn:hover {
  color: var(--rd-text);
  border-color: var(--rd-accent);
}
.read-settings-btn svg { display: block; }

/* ── Settings panel ── */
.read-settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: 10px;
  padding: 1rem;
  width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
}
.read-settings-panel.open { display: block; }
.settings-label {
  font-family: var(--rd-font-ui);
  font-size: 0.68rem;
  color: var(--rd-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: block;
}
.settings-group { margin-bottom: 1rem; }
.settings-group:last-child { margin-bottom: 0; }
.settings-btn-row {
  display: flex;
  gap: 0.4rem;
}
.settings-opt-btn {
  flex: 1;
  background: var(--rd-bg);
  border: 1px solid var(--rd-border);
  border-radius: 5px;
  color: var(--rd-muted);
  cursor: pointer;
  font-family: var(--rd-font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.25rem;
  text-align: center;
  transition: all 0.15s;
}
.settings-opt-btn:hover { border-color: var(--rd-accent); color: var(--rd-text); }
.settings-opt-btn.active {
  background: var(--rd-accent);
  border-color: var(--rd-accent);
  color: #fff;
}

/* ── Chapter header / meta ── */
.read-main {
  padding: 2.5rem 0 5rem;
  min-height: 60vh;
}
.read-meta {
  margin-bottom: 2.5rem;
  text-align: center;
}
.read-byline {
  font-family: var(--rd-font-ui);
  font-size: 0.72rem;
  color: var(--rd-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.read-ep-title {
  font-family: var(--rd-font-display);
  color: var(--rd-text);
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0.35rem 0 0.75rem;
}
.read-reading-time {
  font-family: var(--rd-font-ui);
  font-size: 0.75rem;
  color: var(--rd-muted);
  letter-spacing: 0.04em;
}
.read-divider {
  width: 48px;
  height: 1px;
  background: var(--rd-border);
  margin: 1.5rem auto 0;
}

/* ── Article body ── */
.read-body {
  font-family: var(--rd-font-body);
  font-size: var(--rd-size-body);
  line-height: var(--rd-lh);
  color: var(--rd-text);
  max-width: var(--rd-col);
  margin: 0 auto;
  transition: font-size 0.2s ease;
}
.read-body p {
  margin-bottom: 1.5em;
  font-size: inherit;
  color: var(--rd-text);
}
.read-body h2 {
  font-family: var(--rd-font-display);
  color: var(--rd-text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 2.5em 0 1em;
  opacity: 0.6;
}
.read-body h3 {
  font-family: var(--rd-font-display);
  color: var(--rd-text);
  font-size: 1rem;
  margin: 2em 0 0.6em;
}
.read-body em {
  color: var(--rd-accent);
  font-style: italic;
}
.read-body strong { color: #fff; font-weight: 600; }
.read-body hr {
  border: none;
  text-align: center;
  margin: 2.5em 0;
  color: var(--rd-muted);
  font-size: 1.1rem;
  letter-spacing: 0.5em;
}
.read-body hr::after { content: '·  ·  ·'; }
.read-body blockquote {
  border-left: 2px solid var(--rd-accent);
  padding: 0.25rem 0 0.25rem 1.25rem;
  color: var(--rd-muted);
  font-style: italic;
  margin: 1.75em 0;
}

/* ── Paragraph read tracking hook ── */
.read-body p[data-para-tracked] { /* no visual change, just hook */ }

/* ── Chapter nav (footer) ── */
.read-nav {
  border-top: 1px solid var(--rd-border);
  padding: 2rem 0;
  margin-top: 1rem;
}
.read-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--rd-font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rd-accent);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s, transform 0.15s;
}
.nav-link:hover { color: var(--rd-accent-dark); transform: translateX(-2px); }
.nav-link.next:hover { transform: translateX(2px); }
.nav-link-label {
  font-size: 0.7rem;
  color: var(--rd-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.15rem;
}

/* ── Paywall — redesigned ── */
.paywall-preview {
  position: relative;
  max-height: 20em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}
.paywall-preview p:last-child {
  filter: blur(3px);
  opacity: 0.5;
}

.paywall {
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: 14px;
  margin: 2.5rem auto 2rem;
  max-width: var(--rd-col);
  padding: 2.5rem 1.5rem;
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.paywall.paywall-visible {
  opacity: 1;
  transform: translateY(0);
}
.paywall-inner { max-width: 420px; margin: 0 auto; }
.paywall-cover {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 180px;
  width: 55%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.paywall-eyebrow {
  font-family: var(--rd-font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rd-accent);
  margin-bottom: 0.6rem;
}
.paywall-headline {
  font-family: var(--rd-font-display);
  color: var(--rd-text);
  font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  font-weight: 700;
  margin: 0 0 0.6rem;
  line-height: 1.25;
}
.paywall-copy {
  color: var(--rd-muted);
  font-family: var(--rd-font-ui);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 0.75rem;
}
.paywall-value-props {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.paywall-value-props li {
  font-family: var(--rd-font-ui);
  font-size: 0.82rem;
  color: var(--rd-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.paywall-value-props li::before {
  content: '✓';
  color: var(--rd-accent);
  font-weight: 700;
  font-size: 0.85rem;
}
.paywall-buy {
  background: var(--rd-accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: block;
  font-family: var(--rd-font-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  min-height: 52px;
  padding: 0.9rem 2rem;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.paywall-buy:hover {
  background: var(--rd-accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.paywall-buy:active { transform: translateY(0); }
.paywall-fineprint {
  color: var(--rd-muted);
  font-family: var(--rd-font-ui);
  font-size: 0.75rem;
  margin: 0.75rem 0 0;
  line-height: 1.5;
}
.paywall-back-link {
  display: block;
  margin-top: 0.85rem;
  font-family: var(--rd-font-ui);
  font-size: 0.78rem;
  color: var(--rd-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.paywall-back-link:hover { color: var(--rd-text); }

/* ── Episode list / TOC ── */
.ep10-cta {
  background: var(--rd-surface);
  border-top: 1px solid var(--rd-border);
}
.ep-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ep-link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.ep-link:hover {
  border-color: var(--rd-accent);
  background: rgba(255,255,255,0.02);
  transform: translateX(3px);
}
.ep-num {
  font-family: var(--rd-font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rd-accent);
  white-space: nowrap;
  min-width: 3.5rem;
}
.ep-title {
  font-family: var(--rd-font-body);
  color: var(--rd-text);
  font-size: 0.95rem;
}
.ep-lock {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--rd-muted);
  flex-shrink: 0;
}

/* ── TOC page header ── */
.toc-hero {
  padding: 3rem 0 2rem;
  text-align: center;
}
.toc-cover {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 160px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.toc-title {
  font-family: var(--rd-font-display);
  color: var(--rd-text);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.toc-author {
  font-family: var(--rd-font-ui);
  font-size: 0.8rem;
  color: var(--rd-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.toc-tagline {
  font-family: var(--rd-font-body);
  font-style: italic;
  color: var(--rd-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}
.toc-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--rd-accent);
  color: #fff;
  font-family: var(--rd-font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.85rem 2rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.toc-start-btn:hover { background: var(--rd-accent-dark); transform: translateY(-1px); }

/* ── Mini CTA (floating) ── */
#mini-cta {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 200;
  max-width: 280px;
}
#mini-cta-toggle {
  background: var(--rd-accent);
  border: none;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-family: var(--rd-font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: 0.02em;
}
#mini-cta-toggle:hover { background: var(--rd-accent-dark); transform: translateY(-1px); }
#mini-cta-form {
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  padding: 1rem;
}
#mini-cta-form p {
  font-size: 0.82rem;
  color: var(--rd-muted);
  margin-bottom: 0.6rem;
  font-family: var(--rd-font-ui);
}
#mini-cta-form input[type="email"] {
  background: var(--rd-bg);
  border: 1px solid var(--rd-border);
  border-radius: 5px;
  color: var(--rd-text);
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s;
}
#mini-cta-form input[type="email"]:focus {
  border-color: var(--rd-accent);
  outline: none;
}
#mini-cta-form button[type="submit"] {
  background: var(--rd-accent);
  border: none;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font-family: var(--rd-font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  width: 100%;
  transition: background 0.2s;
}
#mini-cta-form button[type="submit"]:hover { background: var(--rd-accent-dark); }
#mc-thanks { color: var(--rd-accent); font-size: 0.82rem; margin-top: 0.5rem; text-align: center; font-family: var(--rd-font-ui); }

/* ── Footer ── */
footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--rd-muted);
  font-family: var(--rd-font-ui);
  font-size: 0.75rem;
  border-top: 1px solid var(--rd-border);
}

/* ── Signup section (ep10) ── */
.signup-section {
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: 10px;
  padding: 2.5rem 2rem;
  text-align: center;
}
.signup-section h2 {
  font-family: var(--rd-font-display);
  color: var(--rd-text);
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}
.signup-section p {
  color: var(--rd-muted);
  font-family: var(--rd-font-ui);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.signup-section input[type="email"] {
  background: var(--rd-bg);
  border: 1px solid var(--rd-border);
  border-radius: 6px;
  color: var(--rd-text);
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.signup-section input[type="email"]:focus { border-color: var(--rd-accent); }
.signup-section input[type="email"]::placeholder { color: var(--rd-muted); }

/* ── Mobile responsive ── */
@media (max-width: 640px) {
  .read-body { font-size: var(--rd-size-mobile); }
  .read-main { padding: 2rem 0 4rem; }
  .paywall { padding: 2rem 1rem; border-radius: 10px; }
  .read-ep-title { font-size: clamp(1.4rem, 6vw, 1.9rem); }
  .read-back { font-size: 0.75rem; }
  .toc-title { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  #mini-cta { bottom: 1rem; left: 1rem; }
}

/* ── Chapter load fade-in ── */
@keyframes rd-fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.read-meta {
  animation: rd-fadein 0.35s ease both;
  animation-delay: 0.05s;
}
.read-body {
  animation: rd-fadein 0.45s ease both;
  animation-delay: 0.12s;
}
