/* ════════════════════════════════════════════════════
   TRANSITIONS.CSS — Book page-turn animations
   ════════════════════════════════════════════════════ */

/* ── EXIT: turning to next page ──────────────────────
   Page hinges on its LEFT edge (the spine), folds away left */
@keyframes flip-out-left {
  0%   { transform: perspective(1100px) rotateY(0deg);   opacity: 1;   }
  100% { transform: perspective(1100px) rotateY(-90deg); opacity: 0.2; }
}

/* ── EXIT: turning to previous page ─────────────────
   Page hinges on its RIGHT edge, folds away right */
@keyframes flip-out-right {
  0%   { transform: perspective(1100px) rotateY(0deg);  opacity: 1;   }
  100% { transform: perspective(1100px) rotateY(90deg); opacity: 0.2; }
}

/* ── ENTRY: arriving from next (new page opens from right) ── */
@keyframes flip-in-right {
  0%   { transform: perspective(1100px) rotateY(90deg); opacity: 0.2; }
  100% { transform: perspective(1100px) rotateY(0deg);  opacity: 1;   }
}

/* ── ENTRY: arriving from previous (new page opens from left) ── */
@keyframes flip-in-left {
  0%   { transform: perspective(1100px) rotateY(-90deg); opacity: 0.2; }
  100% { transform: perspective(1100px) rotateY(0deg);   opacity: 1;   }
}

/* ── SHADOW SWEEP — darkens page as it turns edge-on ── */
@keyframes shadow-sweep-out {
  0%   { opacity: 0; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes shadow-sweep-in {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Home page: simple fade-in ── */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Base ─────────────────────────────────────────── */
/* will-change intentionally NOT set on main by default —
   setting it permanently breaks position:fixed children (photo panel).
   Applied only during active animation states below. */

/* Transform-origin is set per direction — spine is always the hinge */
main.page-exit-left {
  transform-origin: left center;
  animation: flip-out-left 0.30s ease-in both;
  will-change: transform, opacity;
  pointer-events: none;
}
main.page-exit-right {
  transform-origin: right center;
  animation: flip-out-right 0.30s ease-in both;
  will-change: transform, opacity;
  pointer-events: none;
}
main.page-enter-right {
  transform-origin: left center;
  animation: flip-in-right 0.42s ease-out both;
  will-change: transform, opacity;
}
main.page-enter-left {
  transform-origin: right center;
  animation: flip-in-left 0.42s ease-out both;
  will-change: transform, opacity;
}
main.page-enter-home {
  animation: page-fade-in 0.35s ease-out both;
}

/* ── Shadow sweep overlay (created by JS) ─────────── */
.pt-shadow {
  position: fixed;
  inset: 0;
  z-index: 8000;
  pointer-events: none;
}
.pt-shadow.shadow-exit-left {
  background: linear-gradient(to left, transparent 40%, rgba(28,15,5,0.55) 100%);
  animation: shadow-sweep-out 0.30s ease-in both;
}
.pt-shadow.shadow-exit-right {
  background: linear-gradient(to right, transparent 40%, rgba(28,15,5,0.55) 100%);
  animation: shadow-sweep-out 0.30s ease-in both;
}
.pt-shadow.shadow-enter-right {
  background: linear-gradient(to right, rgba(28,15,5,0.40) 0%, transparent 60%);
  animation: shadow-sweep-in 0.45s ease-out both;
}
.pt-shadow.shadow-enter-left {
  background: linear-gradient(to left, rgba(28,15,5,0.40) 0%, transparent 60%);
  animation: shadow-sweep-in 0.45s ease-out both;
}

/* ══════════════════════════════════════════════════════
   INFOGRAPHIC HINT — floating button bottom-right
   ══════════════════════════════════════════════════════ */

/* ── Poster-image hint — vertical tab left of summary ─
   .ih-wrap is a flex row; hint tab + summary sit side by side.
   Summary keeps its own styles; wrap inherits its margin.     */

.ih-wrap {
  display: flex;
  align-items: stretch;
  margin-bottom: 28px;
}

/* Cancel summary-box's own bottom margin inside the wrap */
.ih-wrap .summary-box {
  margin-bottom: 0;
  flex: 1;
}

@keyframes ih-appear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#infographic-hint {
  /* No flex — icon + text flow as one continuous vertical strip */
  writing-mode: vertical-rl;
  transform: rotate(180deg);

  background: rgba(184, 134, 11, 0.07);
  color: #9A7010;
  border: none;
  border-right: 1px solid rgba(184, 134, 11, 0.22);
  padding: 12px 5px;
  border-radius: 6px 0 0 6px;

  font-size: 11px;
  font-family: 'Noto Sans Devanagari', 'Crimson Pro', sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.82;

  animation: ih-appear 0.4s ease-out both;
  transition: opacity 0.2s, background 0.2s;
}
#infographic-hint:hover,
#infographic-hint:active {
  opacity: 1;
  background: rgba(184, 134, 11, 0.15);
}

/* Icon sits inline before text — no extra margin */
.ih-icon {
  font-size: 10px;
  opacity: 0.70;
  margin-right: 4px;   /* small gap after icon in inline flow */
}

/* ══════════════════════════════════════════════════════
   TOP NAV — ‹ prev … next › below chapter heading
   ══════════════════════════════════════════════════════ */

.art-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 56px;
  margin: 0;
  gap: 8px;
}
@media (max-width: 860px) {
  .art-top-nav { padding: 4px 24px; }
}

.art-top-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(212, 80, 10, 0.18);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-family: 'Noto Sans Devanagari', 'Crimson Pro', sans-serif;
  color: var(--text-muted, #9E7B5A);
  cursor: pointer;
  max-width: 47%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.art-top-nav-btn:hover,
.art-top-nav-btn:active {
  background: rgba(212, 80, 10, 0.06);
  color: var(--saffron, #D4500A);
  border-color: rgba(212, 80, 10, 0.35);
}

.atn-arrow {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--saffron, #D4500A);
  opacity: 0.7;
}
.art-top-nav-btn:hover .atn-arrow { opacity: 1; }

.atn-title { overflow: hidden; text-overflow: ellipsis; }

/* ══════════════════════════════════════════════════════
   EDGE TAP ZONES — subtle arrow handles on left/right
   Only visible on touch devices (hover: none)
   ══════════════════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
  .nav-btn-edge {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    background: rgba(45, 62, 82, 0.18);
    color: rgba(255,255,255,0.55);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
  }
  .nav-btn-edge:active {
    background: rgba(212, 80, 10, 0.55);
    color: #fff;
  }
  .nav-btn-edge.edge-left  { left: 0;  border-radius: 0 8px 8px 0; }
  .nav-btn-edge.edge-right { right: 0; border-radius: 8px 0 0 8px; }
}

/* ══════════════════════════════════════════════════════
   SWIPE HINT — bottom toast, first visit only
   ══════════════════════════════════════════════════════ */

@keyframes sh-bounce-left {
  0%, 100% { transform: translateX(0); }
  40%       { transform: translateX(-7px); }
}
@keyframes sh-bounce-right {
  0%, 100% { transform: translateX(0); }
  40%       { transform: translateX(7px); }
}
@keyframes sh-appear {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#swipe-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(45, 62, 82, 0.92);
  color: #fff;
  padding: 11px 22px;
  border-radius: 40px;
  font-size: 15px;
  font-family: 'Noto Sans Devanagari', sans-serif;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  animation: sh-appear 0.4s ease-out both;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
}

.sh-arrow {
  font-size: 22px;
  line-height: 1;
  color: #E8C84A;
  font-weight: bold;
}
.sh-left  { animation: sh-bounce-left  1.1s ease-in-out infinite; }
.sh-right { animation: sh-bounce-right 1.1s ease-in-out infinite; }

.sh-text {
  letter-spacing: 0.01em;
  opacity: 0.92;
}

#swipe-hint.sh-hide {
  transition: opacity 0.45s ease, transform 0.45s ease;
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
}
