/* ============================================================
   Magazine flipbook viewer (turn.js)
   Full-screen immersive reading experience
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--ff-body), system-ui, sans-serif;
}

.magazine-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(93, 44, 181, 0.35), transparent 45%),
    radial-gradient(circle at 92% 100%, rgba(50, 55, 240, 0.32), transparent 45%),
    #0b0820;
  color: rgba(255, 255, 255, 0.92);
}

/* ─── Top bar ───────────────────────────────────────────────── */
.magazine-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(10, 8, 24, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.magazine-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--fs-small);
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.magazine-bar__back:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
}

.magazine-bar__title {
  min-width: 0;
  text-align: center;
}

.magazine-bar__title h1 {
  margin: 2px 0 0;
  font-family: var(--ff-display), sans-serif;
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.magazine-bar__type {
  display: inline-block;
  font-family: var(--ff-mono), monospace;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.magazine-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.magazine-bar__action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.magazine-bar__action:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
}

.magazine-bar__action--fs {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
}

/* ─── Stage ─────────────────────────────────────────────────── */
.magazine-stage {
  flex: 1 1 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
}

.magazine-book-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.magazine-book {
  position: relative;
  margin: 0 auto;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.55),
    0 12px 24px rgba(0, 0, 0, 0.35);
  background: #0b0820;
}

.magazine-book.is-ready {
  border-radius: 4px;
}

.magazine-book .magazine-page {
  width: 100%;
  height: 100%;
  background: #1a1635;
}

.magazine-book .magazine-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.magazine-book .turn-page {
  background: #1a1635;
}

.magazine-book .gradient {
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0) 12%);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* nav arrows */
.magazine-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  appearance: none;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 8, 24, 0.7);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.magazine-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.magazine-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.magazine-nav--prev { left: 18px; }
.magazine-nav--next { right: 18px; }

/* ─── Footer ────────────────────────────────────────────────── */
.magazine-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(10, 8, 24, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.magazine-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-mono), monospace;
  font-size: var(--fs-small);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.magazine-pager:first-child {
  justify-self: end;
}

.magazine-pager--ghost {
  visibility: hidden;
}

.magazine-pager__sep { opacity: 0.4; }

.magazine-slider-wrap {
  width: clamp(180px, 28vw, 360px);
}

.magazine-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
}

.magazine-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.magazine-slider::-webkit-slider-thumb:hover { transform: scale(1.18); }

.magazine-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: #fff;
  cursor: pointer;
}

/* ─── Mobile ────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .magazine-bar {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .magazine-bar__back span { display: none; }
  .magazine-bar__back { padding: 8px; }

  .magazine-bar__title h1 { font-size: var(--fs-body); }

  .magazine-bar__action span { display: none; }
  .magazine-bar__action { padding: 8px; width: 36px; height: 36px; justify-content: center; }

  .magazine-stage { padding: 10px; }

  .magazine-nav {
    width: 38px;
    height: 38px;
  }
  .magazine-nav--prev { left: 6px; }
  .magazine-nav--next { right: 6px; }

  .magazine-footer {
    padding: 10px 14px;
    gap: 10px;
  }

  .magazine-pager--ghost { display: none; }
  .magazine-footer { grid-template-columns: auto 1fr; }
}

@media (max-width: 420px) {
  .magazine-bar__title h1 { font-size: var(--fs-small); }
  .magazine-bar__type { font-size: var(--fs-small); }
}
