:root {
  --bg-stage: #EAE4D8;
  --paper: #FCF9F2;
  --cover-bg: #171A21;
  --cover-fg: #FAF6EE;
  --ink: #181A20;
  --muted: #5B616E;
  --accent: #B45309;
  --border: rgba(24, 26, 32, 0.12);
}

html[data-theme="obsidian"] {
  --bg-stage: #07090E;
  --paper: #121620;
  --cover-bg: #0B0E14;
  --cover-fg: #F8FAFC;
  --ink: #F1F5F9;
  --muted: #94A3B8;
  --accent: #38BDF8;
  --border: rgba(255, 255, 255, 0.12);
}

html[data-theme="sage"] {
  --bg-stage: #DCE5DF;
  --paper: #F5F8F5;
  --cover-bg: #1B2E24;
  --cover-fg: #F0F7F2;
  --ink: #13221A;
  --muted: #4C6457;
  --accent: #15803D;
  --border: rgba(19, 34, 26, 0.12);
}

html[data-theme="crimson"] {
  --bg-stage: #141115;
  --paper: #FFFFFF;
  --cover-bg: #160A0E;
  --cover-fg: #FFFFFF;
  --ink: #0F172A;
  --muted: #475569;
  --accent: #E60012;
  --border: rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-stage);
  color: var(--ink);
  transition: background 0.35s ease, color 0.35s ease;
}
a { color: inherit; text-decoration: none; }

.folio-topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.folio-brand { display: flex; align-items: center; gap: 12px; }
.folio-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 900; font-size: 16px;
}
.folio-brand strong { display: block; font-size: 14px; font-weight: 800; letter-spacing: 0.8px; }
.folio-brand small { font-size: 11px; color: var(--muted); font-weight: 600; }

.folio-controls { display: flex; align-items: center; gap: 14px; }
.theme-pills { display: flex; gap: 8px; align-items: center; }
.theme-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  transition: transform 0.2s;
}
.theme-dot[data-theme-set="ivory"] { background: #FAF6EE; border-color: #CBD5E1; }
.theme-dot[data-theme-set="obsidian"] { background: #0C0E14; border-color: #475569; }
.theme-dot[data-theme-set="sage"] { background: #1B2E24; }
.theme-dot[data-theme-set="crimson"] { background: #E60012; }
.theme-dot.active { transform: scale(1.18); box-shadow: 0 0 0 2px var(--accent); }

.folio-buy-btn {
  padding: 9px 18px; border-radius: 8px; background: var(--ink); color: var(--paper);
  font-size: 12.5px; font-weight: 700; transition: opacity 0.2s;
}
.folio-buy-btn:hover { opacity: 0.88; }

.folio-stage {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 24px 44px;
  perspective: 1800px;
}

.book-shell {
  position: relative;
  min-height: 580px;
}

.book-spread {
  display: none;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.18);
  transform-origin: center center;
}
.book-spread.is-active {
  display: grid;
}
@media (prefers-reduced-motion: no-preference) {
  .book-spread.is-active {
    animation: spreadFlipIn 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }
}
@keyframes spreadFlipIn {
  from { opacity: 0; transform: rotateY(-12deg) scale(0.985); }
  to { opacity: 1; transform: rotateY(0deg) scale(1); }
}

.page-leaf {
  padding: 40px 42px;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.page-left {
  border-right: 1px solid var(--border);
  box-shadow: inset -18px 0 28px -18px rgba(0, 0, 0, 0.12);
}
.page-right {
  box-shadow: inset 18px 0 28px -18px rgba(0, 0, 0, 0.08);
}

.cover-leaf {
  background: var(--cover-bg);
  color: var(--cover-fg);
  justify-content: space-between;
  border-right: none;
}
.cover-ornament { width: 88px; height: 88px; color: var(--accent); margin-bottom: 12px; }
.folio-kicker { font-size: 11px; font-weight: 800; letter-spacing: 2px; opacity: 0.75; }
.serif-display {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 400;
  line-height: 1.05;
  margin: 12px 0;
}
.cover-role { font-size: 14.5px; opacity: 0.85; line-height: 1.55; max-width: 340px; }
.cover-footer { margin-top: auto; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 12px; opacity: 0.72; }

.page-header-meta {
  display: flex; justify-content: space-between; font-size: 11px; font-weight: 800;
  letter-spacing: 1.6px; color: var(--muted); margin-bottom: 22px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.serif-heading {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(28px, 2.8vw, 38px);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 16px;
}
.lead-copy { font-size: 15px; line-height: 1.7; color: var(--muted); margin-bottom: 20px; }
.body-copy { font-size: 14px; line-height: 1.75; color: var(--muted); margin-bottom: 22px; }

.availability-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 12px; font-weight: 700;
  margin-bottom: 24px; width: fit-content;
}
.avail-dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; }

.toc-list { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.toc-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 10px;
  background: transparent; border: 1px solid var(--border);
  color: inherit; font-family: inherit; text-align: left; cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.toc-item:hover { border-color: var(--accent); transform: translateX(4px); }
.toc-item span { font-size: 11px; font-weight: 800; color: var(--accent); }
.toc-item strong { flex: 1; font-size: 13.5px; font-weight: 700; }
.toc-item em { font-style: normal; opacity: 0.6; }

.editorial-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.editorial-list li {
  padding-left: 18px; position: relative; font-size: 13.5px; font-weight: 600;
}
.editorial-list li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 7px; height: 7px; border-radius: 2px; background: var(--accent);
}

.works-stack { display: flex; flex-direction: column; gap: 12px; }
.work-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
}
.work-row h4 { font-size: 14.5px; font-weight: 800; margin-bottom: 3px; }
.work-row small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.work-metric {
  font-size: 11px; font-weight: 800; padding: 5px 10px; border-radius: 6px;
  background: rgba(180, 83, 9, 0.12); color: var(--accent); white-space: nowrap;
}

.skills-stack { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.skill-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.skill-track { height: 7px; border-radius: 999px; background: var(--border); overflow: hidden; }
.skill-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.quotes-stack { display: flex; flex-direction: column; gap: 16px; }
.editorial-quote {
  padding: 16px 18px; border-left: 3px solid var(--accent);
  background: rgba(128, 128, 128, 0.05); border-radius: 0 10px 10px 0;
}
.editorial-quote p { font-size: 13.5px; line-height: 1.65; margin-bottom: 8px; }
.editorial-quote footer { font-size: 11.5px; font-weight: 700; color: var(--muted); }

.back-cta-box { margin-top: auto; padding-top: 20px; }
.folio-cta-primary {
  display: inline-block; width: 100%; text-align: center; padding: 13px 20px;
  border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 13.5px; font-weight: 800;
}

.folio-pager {
  margin-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.pager-btn {
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--paper); color: var(--ink); font-family: inherit;
  font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-dots { display: flex; gap: 8px; }
.p-dot {
  width: 10px; height: 10px; border-radius: 999px; border: none;
  background: var(--border); cursor: pointer; transition: width 0.2s, background 0.2s;
}
.p-dot.active { width: 26px; background: var(--accent); }

@media (max-width: 860px) {
  .folio-topbar { padding: 14px 16px; }
  .folio-stage { padding: 8px 16px 36px; }
  .book-spread { grid-template-columns: 1fr; }
  .page-leaf { padding: 26px 22px; min-height: auto; }
  .page-left { border-right: none; border-bottom: 1px solid var(--border); box-shadow: none; }
  .page-right { box-shadow: none; }
  .work-row { flex-direction: column; align-items: flex-start; }
}
