/* =============================================
   BIBLIOS — Design System
   Aesthetic: Open Library · Learning Platform
   Light theme only
   ============================================= */

:root {
  /* Backgrounds */
  --bg:          #FAFAF8;
  --surface:     #F4F1EB;
  --surface-alt: #ECE8DF;
  --surface-raised: #FFFFFF;

  /* Borders */
  --border:      rgba(80,60,40,0.10);
  --border-med:  rgba(80,60,40,0.18);
  --border-strong: rgba(80,60,40,0.28);

  /* Text */
  --text:        #1C1714;
  --text-muted:  #5C5047;
  --text-dim:    #9A8B7E;

  /* --cream is repurposed as heading color for light theme */
  --cream:       #1A1410;

  /* Accent — library green */
  --accent:      #2D6A4F;
  --accent-light:#52B788;
  --accent-dark: #1B4332;
  --accent-bg:   rgba(45,106,79,0.07);

  /* Gold / amber — secondary accent */
  --gold:        #C17F24;
  --gold-light:  #DDA63A;
  --gold-dark:   #9A6218;

  /* Semantic */
  --error:       #B91C1C;
  --error-bg:    rgba(185,28,28,0.07);
  --success:     #166534;
  --success-bg:  rgba(22,101,52,0.09);

  /* Radii */
  --radius:      6px;
  --radius-md:   12px;
  --radius-lg:   18px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(30,20,10,0.06), 0 1px 2px rgba(30,20,10,0.04);
  --shadow-md:   0 4px 14px rgba(30,20,10,0.09), 0 2px 4px rgba(30,20,10,0.05);
  --shadow-lg:   0 8px 28px rgba(30,20,10,0.12), 0 4px 8px rgba(30,20,10,0.05);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== NOISE TEXTURE ===== */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px;
}

/* ===== HEADER ===== */
.site-header {
  position: relative;
  z-index: 10;
  padding: 1.25rem 2.5rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.logo-link {
  text-decoration: none;
  color: inherit;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -0.02em;
}

.logo-dot { color: var(--accent); }

.logo-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-size: 0.83rem;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 500;
  transition: color 0.15s;
}

.nav-link:hover { color: var(--text); }
.nav-link-dim { color: var(--text-dim); }

.nav-credits {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dark);
  background: var(--accent-bg);
  border: 1px solid rgba(45,106,79,0.2);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-weight: 500;
}

/* ===== MAIN LAYOUT ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 3.5rem 2rem 6rem;
}

/* ===== HERO ===== */
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.12;
  color: var(--cream);
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.hero h1 em {
  color: var(--accent);
  font-style: italic;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

/* ===== ALERT ===== */
.alert {
  border-radius: var(--radius-md);
  padding: 0.85rem 1.2rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid rgba(185,28,28,0.22);
  color: var(--error);
}

.alert-error a { color: var(--accent); text-decoration: underline; }

.alert-success {
  background: var(--success-bg);
  border: 1px solid rgba(22,101,52,0.25);
  color: var(--success);
}

/* ===== FORM ===== */
.prompt-form {
  background: var(--surface-raised);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.form-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.prompt-textarea {
  width: 100%;
  min-height: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  padding: 0.85rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-textarea::placeholder { color: var(--text-dim); }

.prompt-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.2rem;
}

.char-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1.4rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(45,106,79,0.28);
}

.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== STEPS ===== */
.steps {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 160px;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  padding-top: 2px;
  flex-shrink: 0;
  font-weight: 600;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.step-body strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.step-body span {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.step-sep {
  color: var(--border-med);
  font-size: 0.75rem;
  flex-shrink: 0;
  align-self: center;
}

/* ===== SPINNER ===== */
.spinner-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 2.5px solid var(--border-med);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOC PAGE ===== */
.toc-page { padding: 3rem 2rem 6rem; }

.toc-status-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--cream);
  text-align: center;
  margin-bottom: 0.75rem;
}

.toc-status-desc {
  text-align: center;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

.toc-header { margin-bottom: 2.5rem; }

.toc-meta {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.toc-version-badge, .toc-level-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-bg);
  border: 1px solid rgba(45,106,79,0.18);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-weight: 500;
}

.toc-book-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--cream);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.toc-intro {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ===== TOC LIST ===== */
.toc-list {
  list-style: none;
  border-top: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.toc-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  transition: background 0.15s;
  border-radius: 0;
  margin: 0 -0.75rem;
}

.toc-item:hover {
  background: var(--surface);
  border-radius: var(--radius);
}

.toc-item-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  padding-top: 3px;
  flex-shrink: 0;
  width: 22px;
  font-weight: 600;
}

.toc-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.toc-item-title {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
}

.toc-item-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.toc-item-obj {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ===== TOC ACTIONS ===== */
.toc-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ===== PROGRESS PAGE ===== */
.progress-page { padding: 4rem 2rem 6rem; text-align: center; }

.progress-wrap {
  max-width: 480px;
  margin: 2rem auto 0;
}

.progress-bar {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 999px;
  transition: width 0.8s ease;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ===== DONE STATE ===== */
.done-icon {
  font-size: 2.8rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.96); }
}

.done-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.done-sub {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-style: italic;
  font-family: var(--font-display);
}

.done-meta {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 2rem;
  font-weight: 500;
}

/* ===== DONE PAGE LINKS ===== */
.done-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* ===== DELIVERY OPTIONS ===== */
.delivery-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 560px;
  margin: 0 auto 2rem;
}

@media (max-width: 520px) {
  .delivery-options { grid-template-columns: 1fr; }
}

.delivery-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.delivery-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.delivery-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.delivery-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.delivery-body strong {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.delivery-body span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.delivery-card-kindle { border-color: var(--border); }

/* ===== KINDLE FORM ===== */
.kindle-form {
  max-width: 480px;
  margin: 0 auto 2rem;
  text-align: left;
}

.kindle-input-wrap {
  display: flex;
  gap: 0.75rem;
}

.kindle-input {
  flex: 1;
  background: var(--surface-raised);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kindle-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.kindle-input::placeholder { color: var(--text-dim); }

.kindle-msg {
  font-size: 0.82rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

.kindle-msg-ok { color: var(--success); }
.kindle-msg-err { color: var(--error); }

/* Kindle auto-send checkbox */
.kindle-autosend-row { margin: 1.2rem 0 0.8rem; }

.kindle-autosend-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: var(--font-body);
  user-select: none;
}

.kindle-autosend-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.kindle-autosend-label strong { color: var(--accent); font-weight: 600; }
.kindle-autosend-label:hover { color: var(--text); }

/* ===== MISC ===== */
.link-new {
  display: inline-block;
  margin-top: 2rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  transition: color 0.2s;
}

.link-new:hover { color: var(--accent); }

.state-block { animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== AUTH PAGES ===== */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 4rem 2rem 6rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--cream);
  margin-bottom: 0.4rem;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.92rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 0.5rem;
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.auth-input::placeholder { color: var(--text-dim); }

.auth-submit {
  margin-top: 1rem;
  width: 100%;
  justify-content: center;
}

.auth-alt {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.auth-alt a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-alt a:hover { text-decoration: underline; }

/* ===== DASHBOARD ===== */
.dashboard-page { padding: 3rem 2rem 6rem; }

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dash-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--cream);
  margin-bottom: 0.2rem;
}

.dash-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.dash-credits-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.dash-credits-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  font-weight: 700;
}

.dash-credits-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

.dash-actions { margin-bottom: 2.5rem; }

.dash-section { margin-bottom: 3rem; }

.dash-section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-bg);
}

/* ===== BOOK LIST ===== */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.book-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.book-card:hover {
  border-color: var(--border-med);
  box-shadow: var(--shadow-md);
}

.book-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.book-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 600;
}

.book-card-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-weight: 500;
}

.badge-done {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid rgba(22,101,52,0.2);
}

.badge-failed {
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid rgba(185,28,28,0.2);
}

.badge-toc_pending, .badge-chapters_pending, .badge-toc_ready {
  color: var(--gold-dark);
  background: rgba(193,127,36,0.08);
  border: 1px solid rgba(193,127,36,0.2);
}

.book-card-prompt {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.book-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 0.75rem;
}

.book-card-level { color: var(--accent); font-weight: 500; }

.book-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.book-card-failed {
  font-size: 0.82rem;
  color: var(--error);
}

/* ===== TRANSACTION TABLE ===== */
.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tx-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border-med);
}

.tx-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.tx-table tr:hover td { background: var(--surface); }

.tx-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); }
.tx-positive { color: var(--success); font-weight: 600; }
.tx-negative { color: var(--error); }
.tx-detail { font-size: 0.78rem; color: var(--text-dim); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== PROFILE PAGE ===== */
.profile-page { padding: 3rem 2rem 6rem; }

.profile-section {
  margin-top: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.profile-section:last-child { border-bottom: none; }

.profile-section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 1rem;
}

.profile-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.profile-info {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.profile-label { color: var(--text-dim); }
.profile-value { color: var(--text); font-weight: 500; }
.profile-value a { color: var(--accent); text-decoration: none; }

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 480px;
}

.profile-input-row { display: flex; gap: 0.75rem; }

/* ===== CHECKOUT / PRICING ===== */
.checkout-page { padding: 3rem 2rem 6rem; }

.checkout-sub {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.92rem;
}

/* Value anchor callout */
.pricing-anchor {
  background: #e8f0e3;
  border-left: 4px solid #2d5016;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.1rem 1.5rem;
  margin: 0 auto 2rem;
  max-width: 640px;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
}

.pricing-anchor p { margin: 0; }

.price-old {
  color: var(--text-dim);
  text-decoration: line-through;
  font-weight: 400;
}

.price-new {
  color: #2d5016;
  font-weight: 700;
  font-size: 1.05em;
}

.pricing-try-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 1.75rem;
  margin-bottom: 0;
}

.pricing-try-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.pricing-try-link:hover { text-decoration: underline; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  align-items: start;
}

@media (max-width: 700px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

.pricing-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pricing-card-featured, .pricing-featured {
  border-color: var(--accent);
  border-top: 3px solid var(--accent);
  box-shadow: 0 4px 24px rgba(45,106,79,0.13), var(--shadow-md);
  transform: translateY(-4px);
  padding-top: 2.25rem;
}

.pricing-card-featured:hover, .pricing-featured:hover {
  transform: translateY(-6px);
}

.pricing-badge {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.85rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(45,106,79,0.25);
}

.pricing-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pricing-credits {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.1rem;
}

.pricing-credits span {
  font-weight: 600;
}

.pricing-per-book {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin: 0.6rem 0 0.15rem;
  letter-spacing: -0.02em;
}

.pricing-per-book span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0;
}

.pricing-total {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 1rem;
}

.pricing-example {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--bg);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

/* FAQ */
.pricing-faq {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 0.5rem;
}

.pricing-faq-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 1.25rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-raised);
}

.faq-q {
  list-style: none;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.15s;
}

.faq-q::-webkit-details-marker { display: none; }
.faq-q::marker { display: none; }

.faq-q:hover { background: var(--bg); }

.faq-q::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
}

details[open] > .faq-q::after {
  content: '−';
}

.faq-a {
  animation: faq-in 0.18s ease;
}

@keyframes faq-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.faq-a p {
  padding: 0.75rem 1.1rem 0.9rem;
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
  border-top: 1px solid var(--border);
}

.checkout-info {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ===== LANDING PAGE ===== */
.landing-header {
  position: relative;
  z-index: 10;
  padding: 1.25rem 2.5rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.landing-logo {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.landing-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.landing-nav .nav-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.landing-nav .nav-link:hover { color: var(--text); }

.landing-main { padding: 0; }

/* ── Hero: split two-column layout ───────────────────────────────────────── */

.landing-hero {
  padding: 5.5rem 2.5rem 5rem;
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg) 65%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.hero-split {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: 3rem;
  align-items: center;
}

.hero-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: #2d5016;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.35rem;
}

.landing-hero h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1.12;
  color: var(--cream);
  letter-spacing: -0.03em;
  margin-bottom: 1.35rem;
}

.landing-hero h1 em {
  color: var(--accent);
  font-style: italic;
}

.landing-hero h1 .h1-green {
  color: #2d5016;
  font-style: normal;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.72;
  margin-bottom: 2.25rem;
  max-width: 460px;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.hero-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.18s;
  white-space: nowrap;
}

.hero-link:hover { color: var(--accent); }

.hero-cta-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ── Right column: Kindle mockup ─────────────────────────────────────────── */

.hero-right {
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-14px); }
}

.kindle-mockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: float 3s ease-in-out infinite;
}

.kindle-device {
  width: 100%;
  max-width: 320px;
  background: #1c1a18;
  border-radius: 18px;
  padding: 14px 14px 18px;
  transform: perspective(800px) rotateY(-5deg);
  box-shadow:
    0 20px 60px rgba(0,0,0,0.15),
    0 0 0 1px rgba(255,255,255,0.06),
    0 0 0 2px #111,
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.kindle-screen {
  background: #0e0d0b;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1a1916;
}

/* Cover section */
.kindle-cover {
  padding: 1.4rem 1.2rem 1.1rem;
  text-align: center;
  border-bottom: 1px solid #1e1c18;
  background: linear-gradient(180deg, #131210 0%, #0e0d0b 100%);
}

.kindle-cover-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9a96e 30%, #c9a96e 70%, transparent);
  margin: 0.55rem auto;
  width: 60%;
  opacity: 0.6;
}

.kindle-book-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: #f0ead8;
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin: 0.15rem 0 0.4rem;
}

.kindle-book-sub {
  font-size: 0.65rem;
  color: #c9a96e;
  line-height: 1.55;
  letter-spacing: 0.03em;
}

.kindle-book-meta {
  margin-top: 0.55rem;
  font-size: 0.56rem;
  color: #5a5040;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* TOC section */
.kindle-toc {
  padding: 0.85rem 1.2rem 0.7rem;
}

.kindle-toc-header {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: #c9a96e;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  padding-bottom: 0.45rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #1e1c18;
}

.kindle-toc-item {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-size: 0.76rem;
  color: #b8b0a2;
  line-height: 1.55;
  padding: 0.22rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.kindle-toc-item:last-child { border-bottom: none; }

.kindle-ch {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: #c9a96e;
  flex-shrink: 0;
  width: 1.8rem;
  text-align: right;
}

/* Page footer */
.kindle-pg {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1.2rem;
  font-size: 0.54rem;
  color: #3d3830;
  font-family: var(--font-mono);
  border-top: 1px solid #131210;
}

.kindle-pg span { color: #3d3830; }

/* Stats label below device */
.kindle-stats {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin: 0;
}

.landing-section {
  padding: 4.5rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--cream);
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-size: 1rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== BEFORE / AFTER COMPARISON ===== */

.vs-section {
  background: var(--bg);
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.vs-section .section-title { margin-bottom: 2rem; }

.vs-grid {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
}

/* ── Column cards ── */
.vs-col {
  padding: 2rem 2rem 1.75rem;
}

.vs-col-old {
  background: #eae7e0;
  border: 1px solid #d5d0c8;
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.vs-col-old .vs-item {
  color: #8a8375;
}

.vs-col-old .vs-icon {
  color: #b5705a;
}

/* Subtle diagonal strikethrough — reinforces "deprecated" feel */
.vs-col-old::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -55deg,
    transparent,
    transparent 28px,
    rgba(0,0,0,0.028) 28px,
    rgba(0,0,0,0.028) 29px
  );
  pointer-events: none;
}

.vs-col-new {
  background: #ffffff;
  border: 1px solid #d5d0c8;
  border-left: 4px solid #2d5016;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: 0 4px 24px rgba(45,80,22,0.08), var(--shadow-md);
}

.vs-col-new .vs-item {
  color: #1a1a1a;
}

.vs-col-new .vs-icon {
  color: #2d5016;
  font-weight: 700;
}

/* ── Column labels ── */
.vs-col-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  padding-bottom: 0.8rem;
  margin-bottom: 1.5rem;
}

.vs-col-old .vs-col-label {
  color: #9a9285;
  border-bottom: 2px solid #ddd8cf;
}

.vs-col-new .vs-col-label {
  color: #2d5016;
  border-bottom: 2px solid #2d5016;
}

/* ── Lists ── */
.vs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0;
}

.vs-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

.vs-bad  { color: #8a8375; }
.vs-good { color: #1a1a1a; }

.vs-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.vs-bad  .vs-icon { background: rgba(181,112,90,0.12); color: #b5705a; }
.vs-good .vs-icon { background: rgba(45,80,22,0.1);    color: #2d5016; }

/* ── Vertical divider ── */
.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3.25rem; /* aligns VS badge near label height */
}

.vs-divider-line {
  width: 1px;
  flex: 1;
  min-height: 40px;
  background: var(--border-med);
}

.vs-vs {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--surface-alt);
  border: 1px solid var(--border-med);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}


.landing-example {
  background: var(--surface);
}

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

.example-content h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--cream);
  margin-bottom: 1.5rem;
}

.example-content blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin: 0 0 1.75rem;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.65;
  opacity: 0.75;
}

.example-result-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  margin-top: 1.5rem;
}

.example-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
}

.example-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.example-stat-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: #2d5016;
  line-height: 1;
  letter-spacing: -0.02em;
}

.example-stat-unit {
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 0.15rem;
}

.example-stat-label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: #8a8375;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.example-stat-divider {
  width: 1px;
  height: 40px;
  background: #d5d0c8;
  flex-shrink: 0;
}

.example-cost {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #8a8375;
}

/* ===== "SEE WHAT YOU GET" DEMO SECTION ===== */

.demo-section { background: var(--surface); }
.demo-section .section-title   { margin-bottom: 0.5rem; }
.demo-section .section-subtitle { margin-bottom: 2.5rem; }

/* Outer elevated card */
.demo-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ── Metadata bar ── */
.demo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.4rem 2rem;
  background: linear-gradient(90deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.demo-meta-left { flex: 1; min-width: 0; }

.demo-book-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -0.02em;
  margin-bottom: 0.45rem;
}

.demo-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.demo-level-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(45,106,79,0.2);
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
}

.demo-stats {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}


/* ── Two-column body ── */
.demo-body {
  display: grid;
  grid-template-columns: 2fr 3fr;
}

/* ── TOC column ── */
.demo-toc-col {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.demo-col-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-dim);
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.demo-toc-list {
  list-style: none;
  overflow-y: visible;
}

/* Chapter rows */
.demo-ch { border-bottom: 1px solid var(--border); }
.demo-ch:last-child { border-bottom: none; }

/* Active/selected chapter row */
.demo-ch.is-active > .demo-ch-btn,
.demo-ch.is-active.demo-ch-plain {
  border-left: 3px solid #2d5016;
  padding-left: calc(1.5rem - 3px);
  background: rgba(45,80,22,0.05);
}
.demo-ch.is-active .demo-ch-text strong {
  font-weight: 700;
  color: var(--accent);
}
.demo-ch.is-active .demo-ch-num {
  color: #2d5016;
}

/* Expandable chapter — button */
.demo-ch-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  padding: 0.65rem 1.5rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.demo-ch-btn:hover { background: var(--surface); }

/* Plain (non-expandable) chapter */
.demo-ch-plain {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.65rem 1.5rem;
  opacity: 0.65;
}

.demo-ch-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  width: 1.1rem;
  text-align: right;
  padding-top: 0.15rem;
}

.demo-ch-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.demo-ch-text strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.demo-ch-text span {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.demo-ch-caret {
  font-size: 1rem;
  color: var(--text-dim);
  flex-shrink: 0;
  align-self: center;
  transition: transform 0.22s ease, color 0.15s;
  line-height: 1;
}

.demo-ch-btn[aria-expanded="true"] .demo-ch-caret {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Excerpt slide-down */
.demo-ch-excerpt {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.demo-ch-excerpt.is-open {
  max-height: 260px;
  opacity: 1;
}

.demo-ch-excerpt p {
  margin: 0;
  padding: 0.75rem 1.5rem 0.9rem 3rem;
  font-size: 0.77rem;
  line-height: 1.72;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Page preview column ── */
.demo-page-col {
  display: flex;
  flex-direction: column;
  background: #faf8f3;
  position: relative;
}

/* Right-edge page-depth shadow */
.demo-page-col::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(to left, rgba(40,30,20,0.09), transparent);
  pointer-events: none;
  z-index: 1;
}

.demo-page {
  flex: 1;
  padding: 2rem 2.5rem 3rem;
  overflow-y: visible;
  min-height: 450px;
  position: relative;
  background: #faf8f3;
}

/* Fade-to-white bottom — implies "there's more" */
.demo-page::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, transparent, #faf8f3);
  pointer-events: none;
}

/* Page typography — mirrors the real ePub output */
.demo-pg-chap {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.demo-pg-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1209;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.demo-pg-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: #1a1209;
  letter-spacing: 0;
  margin: 1.4rem 0 0.5rem;
}

.demo-pg-body {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: #2c2416;
  line-height: 1.78;
  margin-bottom: 0.85rem;
}

.demo-pg-body strong { color: #1a1209; font-weight: 600; }
.demo-pg-body em { font-style: italic; color: #44341e; }
.demo-pg-body:last-child { margin-bottom: 0; }

/* Mobile inline page preview (inside excerpt) */
.demo-ch-mobile-page {
  padding: 1.25rem 1.5rem 1.25rem 3rem;
  background: #faf8f3;
  border-top: 1px solid var(--border);
}
.demo-ch-mobile-page .demo-pg-chap  { font-size: 0.55rem; margin-bottom: 0.3rem; }
.demo-ch-mobile-page .demo-pg-title { font-size: 1.05rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; }
.demo-ch-mobile-page .demo-pg-heading { font-size: 0.88rem; margin-top: 0.9rem; }
.demo-ch-mobile-page .demo-pg-body { font-size: 0.81rem; line-height: 1.72; margin-bottom: 0.6rem; }

/* ── CTA footer ── */
.demo-footer-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1.75rem 2rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(to right, var(--surface) 0%, var(--bg) 50%, var(--surface) 100%);
}

.demo-footer-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.landing-cta-final {
  padding: 5.5rem 2.5rem 5rem;
  text-align: center;
  background: linear-gradient(160deg, #faf8f3 0%, #f0ead8 100%);
  border-top: 1px solid #e0ddd5;
}

.cta-inner {
  max-width: 560px;
  margin: 0 auto;
}

.landing-cta-final h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1209;
  margin-bottom: 0.75rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.landing-cta-final p {
  color: #6b5f4a;
  font-size: 1.05rem;
  margin-bottom: 2rem;
  line-height: 1.55;
}

.cta-btn {
  display: inline-flex;
  margin: 0 auto 1.75rem;
}

.cta-trust {
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  font-size: 0.81rem;
  color: #8a7a62;
}

.cta-trust span { display: flex; align-items: center; gap: 0.35rem; }

/* Footer */
.landing-footer {
  padding: 1.25rem 2.5rem;
  border-top: 1px solid #e0ddd5;
  background: #faf8f3;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: #1a1209;
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  font-size: 0.82rem;
  color: #8a7a62;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover { color: #1a1209; }

.footer-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: #8a7a62;
  flex-shrink: 0;
}

.footer-meta span + span::before {
  content: '·';
  margin-right: 0.6rem;
}

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
  .footer-nav { justify-content: center; }
  .footer-meta { justify-content: center; }
  .landing-cta-final h2 { font-size: 1.9rem; }
  .cta-trust { gap: 1rem; font-size: 0.77rem; }
}

/* ===== RESPONSIVE ===== */

/* ── 900px: hero collapses to single column ── */
@media (max-width: 900px) {
  .hero-split { grid-template-columns: 1fr; gap: 3.5rem; }
  .hero-subtitle { max-width: 100%; }
  .hero-right { order: 2; display: flex; flex-direction: column; align-items: center; }
  .kindle-device { width: 280px; max-width: 280px; transform: none; }
  /* Demo section: hide right pane, TOC becomes accordion */
  .demo-body { grid-template-columns: 1fr; }
  .demo-page-col { display: flex; border-top: 1px solid var(--border); }
  .demo-page { min-height: 350px; padding: 1.5rem 1.5rem 3rem; }
  .demo-toc-col { border-right: none; }
}

/* ── 700px: landing page adjustments ── */
@media (max-width: 700px) {
  .landing-header { flex-direction: column; gap: 1.25rem; }
  .landing-nav { width: 100%; justify-content: space-between; gap: 0.75rem; }
  .landing-hero { padding: 3.5rem 1.5rem 4rem; }
  .landing-hero h1 { font-size: 1.8rem; }
  .kindle-device { max-width: 260px; }
  .hero-cta-row { flex-direction: column; align-items: stretch; gap: 0.9rem; }
  .hero-cta-row .btn-primary { width: 100%; justify-content: center; }
  .hero-link { text-align: center; }
  .landing-section { padding: 3rem 1.5rem; }
  .section-title { font-size: 1.65rem; }

  /* VS section — stack columns */
  .vs-grid { grid-template-columns: 1fr; max-width: 480px; }
  .vs-col-old {
    border: 1px solid #ddd8cf;
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .vs-col-new {
    border: 1px solid rgba(45,80,22,0.18);
    border-top: none;
    border-left: 4px solid #2d5016;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  .vs-divider {
    flex-direction: row;
    padding: 0;
    height: 44px;
    border-left: 1px solid var(--border-med);
    border-right: 1px solid rgba(45,106,79,0.2);
    background: var(--surface-alt);
  }
  .vs-divider-line { flex: 1; height: 1px; width: auto; min-height: 0; }

  .demo-ch-excerpt p { padding-left: 1.5rem; }
}

/* ── 600px: general app/inner-page overrides ── */
@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  .header-left { flex-direction: column; gap: 0.2rem; }
  .header-nav { gap: 0.75rem; flex-wrap: wrap; }
  main { padding: 2.5rem 1.25rem 5rem; }
  .toc-actions { justify-content: stretch; flex-direction: column-reverse; }
  .toc-actions form, .toc-actions button { width: 100%; }
  .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
  .steps { flex-direction: column; gap: 1rem; }
  .step-sep { display: none; }
  .dash-top { flex-direction: column; }
  .profile-input-row { flex-direction: column; }
  .profile-info { flex-direction: column; gap: 0.15rem; }
  .auth-card { padding: 1.75rem; }
  /* Book card */
  .book-card-header { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .book-card-meta { flex-wrap: wrap; gap: 0.5rem; }
  .book-card-actions { flex-direction: column; }
  .book-card-actions .btn-primary,
  .book-card-actions .btn-secondary { width: 100%; justify-content: center; }
  /* Dashboard page */
  .dashboard-page { padding: 2rem 1.25rem 5rem; }
  /* Kindle email input */
  .kindle-input-wrap { flex-direction: column; }
  /* Transaction table */
  .tx-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Auth page spacing */
  .auth-page { padding: 2.5rem 1.25rem 5rem; }
}

/* ===== SCROLL & HERO ANIMATIONS ===== */

html { scroll-behavior: smooth; }

/* Scroll-reveal base state */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

/* Hero sequential animation — same mechanic, no scroll trigger */
.hero-animate {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s ease, transform 0.65s ease;
  will-change: transform;
}

.hero-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

/* Mockup slides in from a bit further */
.hero-right.hero-animate { transform: translateY(32px); }

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal,
  .hero-animate {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
  }

  /* Kill float animation on Kindle mockup */
  .kindle-mockup { animation: none !important; }

  /* Kill pulse on progress bar */
  .progress-fill { animation: none !important; }

  /* Kill spin on spinner */
  .spinner { animation: none !important; }

  /* All other transitions: keep subtle color/bg ones, kill motion */
  .btn-primary,
  .btn-secondary,
  .pricing-card,
  .delivery-card,
  .book-card {
    transition: background 0.15s, border-color 0.15s !important;
    transform: none !important;
  }

  .btn-primary:hover,
  .btn-secondary:hover {
    transform: none !important;
  }

  .pricing-card:hover,
  .pricing-featured:hover,
  .pricing-card-featured:hover {
    transform: none !important;
  }
}

/* ===== LANDING: ANONYMOUS TRY FORM (#try) ===== */

.landing-try {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.try-form {
  max-width: 680px;
  margin: 0 auto;
}

.try-textarea {
  width: 100%;
  min-height: 140px;
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  font-size: 0.97rem;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface-raised);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.try-textarea:focus { border-color: var(--accent); }
.try-textarea::placeholder { color: var(--text-dim); }

.try-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  gap: 1rem;
}

.try-char-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.try-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== PREVIEW PAGE ===== */

.preview-page { padding: 0; }

.preview-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: calc(100vh - 64px);
  align-items: start;
}

/* ── TOC sidebar ─────────────────────────────────────────────────────────── */

.preview-toc {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1.25rem 3rem;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.preview-toc-head { margin-bottom: 1.25rem; }

.preview-book-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream);
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.preview-level {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(45,106,79,0.2);
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
}

.preview-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.preview-toc-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  font-size: 0.82rem;
  transition: background 0.12s;
}

.preview-toc-item.is-unlocked {
  color: var(--text);
  font-weight: 500;
  background: var(--accent-bg);
}

.preview-toc-item.is-locked {
  color: var(--text-dim);
  opacity: 0.55;
}

.preview-toc-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.preview-toc-title { flex: 1; line-height: 1.35; }

.preview-lock { font-size: 0.72rem; flex-shrink: 0; }

.preview-toc-foot {
  margin-top: 1.5rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-align: center;
}

/* ── Chapter content ─────────────────────────────────────────────────────── */

.preview-main {
  padding: 3rem 3.5rem 0;
  max-width: 780px;
}

.preview-chapter-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.preview-chapter {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
}

.preview-chapter h1,
.preview-chapter h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cream);
  margin: 2rem 0 0.75rem;
  line-height: 1.2;
}

.preview-chapter h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.75rem 0 0.5rem;
}

.preview-chapter p { margin: 0 0 1.1rem; }

.preview-chapter strong { font-weight: 600; color: var(--text); }

.preview-chapter em { font-style: italic; color: var(--text-muted); }

.preview-chapter ul,
.preview-chapter ol {
  padding-left: 1.5rem;
  margin: 0 0 1.1rem;
}

.preview-chapter li { margin-bottom: 0.4rem; }

.preview-chapter blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.25rem 0;
  padding: 0.5rem 1rem;
  background: var(--accent-bg);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--text-muted);
}

/* ── Paywall gate ────────────────────────────────────────────────────────── */

.preview-gate {
  position: relative;
  margin-top: -6rem; /* overlap the chapter content */
  padding-top: 6rem;
}

.preview-gate-fade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

.preview-gate-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 4rem;
  box-shadow: var(--shadow-md);
}

.preview-gate-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.preview-gate-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.preview-gate-sub {
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.5;
  margin-bottom: 2rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.preview-gate-cta { display: inline-flex; margin-bottom: 1rem; }

.preview-gate-buylink {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-top: 0.25rem;
  transition: color 0.15s;
}

.preview-gate-buylink:hover { color: var(--accent); }

.preview-gate-login {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
}

.preview-gate-login a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.preview-gate-login a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .preview-layout { grid-template-columns: 1fr; }
  .preview-toc {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .preview-main { padding: 2rem 1.5rem 0; }
}
