/* ============================================================
   MyDeen web lesson viewer (swipeable carousel).
   Reuses design tokens + fonts from styles.css.
   Mirrors the app's lesson look: cream canvas, serif editorial
   text, gold accents; laid out for the web at any screen size.
   ============================================================ */

html, body { height: 100%; margin: 0; }
body.lesson { overflow: hidden; background: var(--ivory); }

.viewer { position: fixed; inset: 0; overflow: hidden; background: var(--ivory); }
.viewer-track {
  display: flex; height: 100%;
  transition: transform .42s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}

.slide {
  flex: 0 0 100%; width: 100%; height: 100%;
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: clamp(76px, 10vh, 112px) clamp(20px, 5vw, 40px) clamp(84px, 11vh, 124px);
  overflow-y: auto;
}
.slide-inner { width: 100%; max-width: 680px; margin: auto; position: relative; z-index: 1; }

.slide-kicker {
  font-family: var(--sans); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold-deep); margin: 0 0 14px;
}
.slide-title {
  font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.14;
  font-size: clamp(1.8rem, 1rem + 2.6vw, 2.6rem); color: #2A1A05;
  margin: 0 0 clamp(18px, 2.6vw, 30px); text-wrap: balance;
}
.slide-body p {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.42rem); line-height: 1.62;
  color: #3D2A12; margin: 0 0 0.9em;
}
.slide-body p:last-child { margin-bottom: 0; }

/* All lesson pages use the default cream canvas (consistent with the app). */

/* image_below pages: an image beneath the text */
.slide-image {
  display: block; width: 100%; margin-top: clamp(22px, 3vw, 32px);
  border-radius: 14px; box-shadow: var(--shadow-card);
}

/* video pages */
.slide-video {
  display: block; width: 100%; max-width: 460px; max-height: 66vh; margin: 0 auto;
  border-radius: 16px; background: #000; box-shadow: var(--shadow-phone);
}

/* closing call-to-action slide */
.cta-slide .slide-inner { text-align: center; max-width: 560px; }
.cta-slide .cta-logo { width: 118px; height: auto; margin: 0 auto 24px; }
.cta-slide h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.9rem, 1.2rem + 2.2vw, 2.7rem); color: #2A1A05; margin: 0 0 14px; }
.cta-slide p { font-family: var(--sans); font-size: 1.08rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 30px; max-width: 30rem; margin-inline: auto; }
.cta-slide .back-link { display: inline-block; margin-top: 24px; font-size: 0.9rem; color: var(--ink-faint); font-family: var(--sans); }

/* official store badges (last screen) */
.store-badges { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; align-items: center; }
.store-badges a { display: inline-flex; }
.store-badges img { display: block; width: auto; }
.badge-apple { height: 46px; }
.badge-google { height: 68px; }
.cta-slide .back-link:hover { color: var(--ink); }

/* top bar: close + progress */
.v-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: calc(clamp(14px, 2vh, 20px) + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 28px) clamp(14px, 2vh, 20px);
}
.v-close {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(44,24,16,0.07); color: var(--ink); display: grid; place-items: center;
  transition: background .15s ease;
}
.v-close:hover { background: rgba(44,24,16,0.13); }
.v-progress { flex: 1; height: 7px; border-radius: 999px; background: rgba(44,24,16,0.12); overflow: hidden; }
.v-progress-fill { height: 100%; width: 0; background: var(--gold); border-radius: 999px; transition: width .42s ease; }

/* side arrows (pointer devices) */
.v-arrow {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 30;
  width: 50px; height: 50px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--ivory-raised); color: var(--ink);
  display: grid; place-items: center; box-shadow: var(--shadow-card);
  transition: opacity .2s ease, background .15s ease;
}
.v-arrow:hover { background: var(--ivory-warm); }
.v-arrow.prev { left: clamp(12px, 2vw, 30px); }
.v-arrow.next { right: clamp(12px, 2vw, 30px); }
.v-arrow[disabled] { opacity: 0; pointer-events: none; }

/* On phones the side arrows move to the bottom corners (thumb-reachable),
   so there is always a visible Next button, not just swipe. */
@media (max-width: 820px) {
  .v-arrow {
    top: auto; transform: none;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 54px; height: 54px;
  }
  .v-arrow.prev { left: 18px; }
  .v-arrow.next { right: 18px; background: var(--gold); border-color: transparent; color: #4A3414; box-shadow: var(--shadow-pill); }
}
