/* ============================================
   THE SIMPLICITY TRAP — Flipbook Reader
   PREMIUM PHYSICAL BOOK STYLING
   ============================================ */

/* ── Reader Page ── */
.reader-page {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0c0f18;
  overflow: hidden;
  user-select: none;
}

/* ── Top Bar ── */
.reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(10, 14, 26, 0.97);
  border-bottom: 1px solid rgba(201,168,76,0.12);
  z-index: 10;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.page-counter {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--silver);
  letter-spacing: 0.1em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.topbar-btn {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--silver-muted);
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.topbar-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.mute-btn .icon-muted { display: none; }
.mute-btn.muted .icon-sound { display: none; }
.mute-btn.muted .icon-muted { display: inline; }

/* ── Book Container — Dark Leather Desk ── */
.book-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px 60px;
  /* Deep leather-like radial background */
  background:
    radial-gradient(ellipse at 50% 60%, #1e1914 0%, #110e0a 40%, #0a0807 100%);
  overflow: hidden;
}

/* Leather grain texture */
.book-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Subtle vignette */
.book-container::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Flipbook Wrapper — Physical Book Frame ── */
.flipbook-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Book spine shadow on left */
.flipbook-wrapper::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: calc(100% - 10px);
  background: linear-gradient(90deg,
    rgba(0,0,0,0.5) 0%,
    rgba(0,0,0,0.2) 30%,
    transparent 50%,
    rgba(0,0,0,0.2) 70%,
    rgba(0,0,0,0.5) 100%
  );
  z-index: 100;
  pointer-events: none;
}

/* Depth shadow beneath the book */
.flipbook-wrapper::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 5%;
  width: 90%;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.5) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
}

/* StPageFlip parent styling */
.flipbook-wrapper .stf__parent {
  box-shadow:
    0 2px 4px rgba(0,0,0,0.3),
    0 8px 20px rgba(0,0,0,0.4),
    0 20px 60px rgba(0,0,0,0.5),
    0 0 100px rgba(0,0,0,0.2);
  border-radius: 3px;
}

/* Page edge effect — simulates multiple page layers */
.flipbook-wrapper .stf__parent::before {
  content: '';
  position: absolute;
  top: 2px;
  right: -4px;
  width: 4px;
  height: calc(100% - 4px);
  background: linear-gradient(90deg,
    #d4cbb8 0%,
    #c8bda8 25%,
    #bcb098 50%,
    #c8bda8 75%,
    #d4cbb8 100%
  );
  border-radius: 0 2px 2px 0;
  box-shadow: 1px 0 3px rgba(0,0,0,0.2);
  z-index: 1;
}

/* Left page edge */
.flipbook-wrapper .stf__parent::after {
  content: '';
  position: absolute;
  top: 2px;
  left: -4px;
  width: 4px;
  height: calc(100% - 4px);
  background: linear-gradient(90deg,
    #d4cbb8 0%,
    #c8bda8 25%,
    #bcb098 50%,
    #c8bda8 75%,
    #d4cbb8 100%
  );
  border-radius: 2px 0 0 2px;
  box-shadow: -1px 0 3px rgba(0,0,0,0.2);
  z-index: 1;
}

/* ── Page Styles ── */
.page {
  background-color: var(--cream);
  font-family: var(--font-book);
  color: var(--ink);
  padding: 50px 40px;
  box-sizing: border-box;
  overflow: hidden !important;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Paper texture overlay */
.page::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    /* Faint horizontal line ruling */
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 26px,
      rgba(0,0,0,0.012) 26px,
      rgba(0,0,0,0.012) 27px
    ),
    /* Subtle grain */
    url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Inner shadow on page edges — gives depth */
.page::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  box-shadow:
    inset 3px 0 8px rgba(0,0,0,0.06),
    inset -1px 0 4px rgba(0,0,0,0.03),
    inset 0 3px 8px rgba(0,0,0,0.04),
    inset 0 -3px 8px rgba(0,0,0,0.04);
  pointer-events: none;
  z-index: 2;
}

.page > * {
  position: relative;
  z-index: 2;
}

.page-content {
  flex: 1;
  overflow: hidden;
}

/* ── Cover Pages ── */
.page.cover-page {
  padding: 0;
  background: var(--deep-navy);
}

.page.cover-page::before,
.page.cover-page::after {
  display: none;
}

.cover-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ── Back Cover ── */
.page.back-cover {
  padding: 36px 32px;
  background: linear-gradient(180deg, #0A0E1A 0%, #111827 100%);
  color: #d0d0d0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page.back-cover::before,
.page.back-cover::after {
  display: none;
}

.back-cover .back-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
  letter-spacing: 0.06em;
}

.back-cover .back-subtitle {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gold-light);
  margin-bottom: 16px;
}

.back-cover .back-body {
  font-family: var(--font-book);
  font-size: 0.68rem;
  line-height: 1.7;
  color: #aaa;
  margin-bottom: 6px;
}

.back-cover .back-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gold);
  text-align: center;
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid rgba(201,168,76,0.3);
  border-bottom: 1px solid rgba(201,168,76,0.3);
}

.back-cover .back-author-title {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--gold);
  margin-bottom: 6px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.back-cover .back-author-bio {
  font-family: var(--font-book);
  font-size: 0.6rem;
  line-height: 1.7;
  color: #888;
}

.back-cover .back-publisher {
  font-family: var(--font-body);
  font-size: 0.55rem;
  color: var(--silver-muted);
  font-style: italic;
  margin-top: 12px;
  text-align: center;
}

/* ── Title Page ── */
.page.title-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.title-page .book-main-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.title-page .book-main-subtitle {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gold-dark);
  margin-bottom: 32px;
  line-height: 1.5;
}

.title-page .title-divider {
  width: 50px;
  height: 2px;
  background: var(--gold);
  margin: 0 auto 32px;
}

.title-page .book-author-name {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* ── Epigraph Page ── */
.page.epigraph-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.epigraph-page .epigraph-mark {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 16px;
}

.epigraph-page .epigraph-text {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.7;
  max-width: 360px;
}

.epigraph-page .epigraph-author {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-top: 24px;
}

/* ── Contents Page ── */
.page.contents-page .contents-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.12em;
}

.contents-list {
  list-style: none;
  padding: 0;
}

.contents-list li {
  display: flex;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dotted rgba(28,28,30,0.15);
  font-family: var(--font-book);
  font-size: 0.85rem;
  color: var(--ink-light);
}

.contents-list .chapter-num {
  color: var(--gold-dark);
  font-weight: 600;
  margin-right: 10px;
  min-width: 20px;
}

/* ── Page Number ── */
.page-number {
  position: absolute;
  bottom: 20px;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--ink-light);
  opacity: 0.6;
}

.page-number.left { left: 40px; }
.page-number.right { right: 40px; }

/* ── Chapter Header ── */
.chapter-header {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 4px;
}

.chapter-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.3;
}

/* ── Body Text ── */
.page-text {
  font-family: var(--font-book);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--ink);
  text-align: justify;
  hyphens: auto;
  letter-spacing: 0.01em;
}

.page-text p {
  margin-bottom: 10px;
  text-indent: 1.2em;
}

.page-text p:first-child {
  text-indent: 0;
}

.page-text p:last-child {
  margin-bottom: 0;
}

/* ── Section Break ── */
.section-break {
  text-align: center;
  color: var(--gold);
  margin: 14px 0;
  letter-spacing: 0.5em;
  font-size: 0.85rem;
}

/* -- Page Illustrations -- */
.page-illustration {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 160px;
  margin: 14px auto;
  opacity: 1;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  object-fit: cover;
}

/* Full-bleed magazine illustration - spans edge to edge */
.page-illustration-full {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 40%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  border-radius: 0;
  opacity: 0.15; /* near-zero opacity under text */
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.8) 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.8) 100%);
}

.page-illustration-full.top {
  bottom: auto;
  top: 0;
  mask-image: linear-gradient(to top, transparent 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.8) 100%);
  -webkit-mask-image: linear-gradient(to top, transparent 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.8) 100%);
}

.page-illustration-full.bottom {
  top: auto;
  bottom: 0;
}

/* ── Pull Quote in Book ── */
.book-pull-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gold-dark);
  text-align: center;
  padding: 14px 16px;
  margin: 14px 0;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  line-height: 1.6;
}

/* ── Navigation Arrows ── */
.nav-arrow {
  position: fixed;
  bottom: 30px;
  top: auto;
  transform: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,14,26,0.9);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.6rem;
  cursor: pointer;
  opacity: 0.9;
  transition: all 0.3s var(--ease-out);
  z-index: 100;
  backdrop-filter: blur(8px);
}

.nav-arrow:hover {
  background: rgba(201,168,76,0.2);
  border-color: var(--gold);
  opacity: 1 !important;
}

.nav-arrow.prev { left: calc(50vw - 100px); }
.nav-arrow.next { right: calc(50vw - 100px); }

.book-container:hover .nav-arrow {
  position: fixed;
  bottom: 30px;
  top: auto;
  transform: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,14,26,0.9);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.6rem;
  cursor: pointer;
  opacity: 0.9;
  transition: all 0.3s var(--ease-out);
  z-index: 100;
  backdrop-filter: blur(8px);
}

/* ── Responsive ── */
@media (max-width: 1023px) {
  .book-container {
    padding: 16px 30px;
  }

  .flipbook-wrapper::before {
    display: none;
  }
}

@media (max-width: 767px) {
  .reader-topbar {
    padding: 8px 14px;
  }

  .topbar-title {
    font-size: var(--text-xs);
  }

  .nav-arrow {
  position: fixed;
  bottom: 30px;
  top: auto;
  transform: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,14,26,0.9);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.6rem;
  cursor: pointer;
  opacity: 0.9;
  transition: all 0.3s var(--ease-out);
  z-index: 100;
  backdrop-filter: blur(8px);
}

  .book-container {
    padding: 8px;
  }

  .flipbook-wrapper::before,
  .flipbook-wrapper::after {
    display: none;
  }
}
