/* ═══════════════════════════════════════════════════════════
   BFF? LEITOR: mesma identidade do hello-ai-landing (V36)
   ═══════════════════════════════════════════════════════════ */
:root {
  --bg:          #1e2a80;
  --bg2:         #283aaa;
  --cyan:        #00e5cc;
  --cyan-dim:    rgba(0,229,204,0.15);
  --pink:        #e040fb;
  --amber:       #f59e0b;
  --white:       #f0eef8;
  --muted:       #b0aac8;
  --card-border: rgba(255,255,255,0.10);
  --ink:         #07050e;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body.rd {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 45%, var(--bg2) 0%, var(--bg) 62%);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.series-bff  { color: var(--white); }
.series-mark { color: var(--cyan); }

/* ── Barra superior ── */
.rd-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
}

.rd-back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: color 0.2s;
}
.rd-back:hover { color: var(--white); }

.rd-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.rd-title-mark {
  font-family: 'Unbounded', sans-serif;
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.rd-title-sub {
  color: rgba(255,255,255,0.55);
  font-style: italic;
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 2px;
}
.lang-btn {
  padding: 6px 13px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: 'Unbounded', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.lang-btn:hover { color: var(--white); }
.lang-btn.lang-active { background: var(--cyan); color: var(--ink); }

/* ── Palco do livro ── */
.rd-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  position: relative;
  outline: none;
}

.rd-frame { position: relative; margin: 0 auto; }
.rd-frame .stf__parent { margin: 0 auto; }

.rd-book-shadow {
  filter: drop-shadow(0 30px 60px rgba(0,0,0,0.45));
}

.page {
  background: #fff;
  overflow: hidden;
}
.page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.page img.is-loaded { opacity: 1; }

/* Página final da amostra */
.page.page--end {
  background: var(--bg);
  color: var(--white);
  border: 1px solid rgba(0,229,204,0.18);
}
.end-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 9% 10%;
}
.end-kicker {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.end-text { color: var(--muted); font-size: clamp(0.82rem, 1.5vw, 1rem); }
.end-buy { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.end-cite {
  margin-top: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}

/* Botões de compra (compartilhados com a página final) */
.buy-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 6px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: transparent;
  text-decoration: none;
  font-weight: 600;
  font-size: clamp(0.8rem, 1.4vw, 0.95rem);
  transition: background 0.2s;
}
.buy-btn:hover { background: var(--cyan-dim); }
/* A StPageFlip só repassa o toque quando o alvo é o próprio <a>:
   os filhos não podem capturar o evento. */
.buy-btn > * { pointer-events: none; }
.buy-btn .buy-price { color: var(--white); font-weight: 500; white-space: nowrap; }
.buy-btn[aria-disabled="true"] {
  border-color: var(--card-border);
  color: var(--muted);
  pointer-events: none;
}

.rd-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  pointer-events: none;
}
.rd-status[hidden] { display: none; }

/* ── Controles ── */
.rd-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px 18px;
  flex-wrap: wrap;
}

.rd-nav { display: flex; align-items: center; gap: 6px; }

.rd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-width: 42px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.06);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.rd-btn:hover { background: rgba(255,255,255,0.12); }
.rd-btn:disabled { opacity: 0.35; cursor: default; }
.rd-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.rd-btn--accent { border-color: var(--cyan); color: var(--cyan); background: transparent; }
.rd-btn--accent:hover { background: var(--cyan-dim); }

.rd-counter {
  min-width: 108px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.9rem;
}

.rd-sep { width: 1px; height: 26px; background: var(--card-border); margin: 0 6px; }

/* Foco visível */
.rd-btn:focus-visible,
.lang-btn:focus-visible,
.rd-back:focus-visible,
.buy-btn:focus-visible,
.rd-stage:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* Tela cheia */
body.rd:fullscreen { background: var(--bg); }

@media (max-width: 640px) {
  .rd-bar { padding: 10px 14px; gap: 10px; }
  .rd-title-sub { display: none; }
  .rd-stage { padding: 4px 12px; }
  .rd-controls { padding: 10px 12px 14px; gap: 6px; }
  .rd-btn-label { display: none; }
  .rd-sep { display: none; }
  .rd-counter { min-width: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .page img { transition: none; }
}

/* ═══════════════════════════════════════════════════════════
   V3: aviso de leitura na horizontal e zoom
   ═══════════════════════════════════════════════════════════ */
.rd-stage { touch-action: none; }   /* o zoom é nosso: evita o zoom da página inteira */

.rd-hint {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 9px 8px 9px 14px;
  border: 1px solid rgba(0,229,204,0.35);
  border-radius: 12px;
  background: rgba(7,5,14,0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--white);
  font-size: 0.86rem;
  line-height: 1.35;
}
.rd-hint > svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--cyan); }
.rd-hint-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.rd-hint-close svg { width: 16px; height: 16px; }
.rd-hint-close:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.rd-zoom {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: rgba(20,28,95,0.97);
  touch-action: none;
  cursor: grab;
}
.rd-zoom.is-dragging { cursor: grabbing; }
.rd-zoom-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  transform-origin: 0 0;
  will-change: transform;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.rd-zoom-canvas img {
  display: block;
  height: 100%;
  width: auto;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.rd-zoom-canvas.is-animating { transition: transform 0.22s ease-out; }
.rd-zoom-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  background: rgba(7,5,14,0.7);
}
.rd-zoom-tip {
  position: absolute;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(7,5,14,0.7);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.4s;
}
.rd-zoom-tip.is-gone { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .rd-zoom-canvas.is-animating { transition: none; }
}

/* Celular na horizontal: barras compactas para o livro ganhar altura */
@media (max-height: 500px) and (orientation: landscape) {
  .rd-bar { padding: 4px 14px; }
  .rd-title-sub { display: none; }
  .rd-title-mark { font-size: 1rem; }
  .lang-btn { padding: 4px 10px; }
  .rd-stage { padding: 2px 12px; }
  .rd-controls { padding: 4px 12px 6px; gap: 6px; }
  .rd-btn { height: 34px; min-width: 34px; padding: 0 10px; }
  .rd-btn-label { display: none; }
  .rd-sep { display: none; }
  .rd-hint { top: 4px; padding: 6px 6px 6px 12px; font-size: 0.8rem; }
}
