/* =========================================================
   C3 — the magazine page itself
   The magazine is 8.5 x 11, so every page is authored on a fixed
   1275 x 1650 canvas (letter at 150dpi) and scaled to fit whatever
   it is dropped into. Nothing here is sized in anything but canvas
   pixels; the scaling is the only thing that knows about screens.
   ========================================================= */

.mag-page {
  position: relative;
  width: 1275px;
  height: 1650px;
  background: #000;
  overflow: hidden;
  transform-origin: 0 0;
}

/* the frame that holds a scaled page */
.mag-frame {
  position: relative;
  overflow: hidden;
  background: #000;
}

.mag-page * { box-sizing: border-box; }
.mag-page img { display: block; }

/* =========================================================
   PAGES — artwork fills the canvas; placeholders are drawn
   ========================================================= */

.mag-page__art,
.mag-page__art img {
  position: absolute;
  left: 0;
  top: 0;
  width: 1275px;
  height: 1650px;
}

.mag-page__art img { object-fit: cover; }

/* a page that has not been laid out yet */
.mag-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 54px;
  background: #000;
}

.mag-ph__label {
  font-family: var(--display);
  font-size: 132px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #f2f3f5;
}

.mag-ph__rule {
  width: 240px;
  height: 1px;
  background: var(--chrome);
  opacity: 0.8;
}

.mag-ph__foot {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #6e747c;
}

/* =========================================================
   VIEWER — the flip book
   ========================================================= */

.reader {
  height: calc(100svh - var(--head-h));
  min-height: 440px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* the reading room: a single light above the page, everything else dark */
  background: var(--black);
  background-image:
    radial-gradient(110% 80% at 50% -10%, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0) 62%);
}

.reader__stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.4vw, 26px) clamp(12px, 4vw, 40px);
  min-height: 0;
  overflow: hidden;
}

.flipbook {
  transition: margin 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  --page-shadow: 0 18px 44px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  filter: drop-shadow(0 24px 46px rgba(0, 0, 0, 0.75));
  touch-action: pan-y;
}

.flipbook .page {
  background: #000;
  overflow: hidden;
}

/* A black page on a black stage has no silhouette of its own, so every
   leaf carries a hairline to read as a sheet of paper. It has to sit
   over the page content — an inset shadow would be painted under it. */
.flipbook .page::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  pointer-events: none;
  z-index: 3;
}

.flipbook .page .mag-page { pointer-events: none; }

/* On a spread the two pages meet in the middle, so the inner edges get
   the shading a real gutter would throw. */
.flipbook--spread .page--left .mag-page::after,
.flipbook--spread .page--right .mag-page::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 90px;
  pointer-events: none;
}

.flipbook--spread .page--left .mag-page::after {
  right: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55));
}

.flipbook--spread .page--right .mag-page::after {
  left: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55));
}

.reader__bar {
  border-top: 1px solid var(--rule);
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px var(--gut) calc(10px + env(safe-area-inset-bottom));
}

.reader__bar-inner {
  max-width: 1080px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.reader__nav {
  appearance: none;
  background: none;
  border: 1px solid var(--rule-strong);
  color: var(--white);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  padding: 12px 18px;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}
.reader__nav:hover:not(:disabled) { background: var(--white); color: var(--black); border-color: var(--white); }
.reader__nav:disabled { opacity: 0.28; cursor: default; }

.reader__count {
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.reader__hint {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 var(--gut) 2px;
  transition: opacity 0.4s ease;
}
.reader__hint[data-hidden="true"] { opacity: 0; }

/* page dots */
.reader__dots {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
}
.reader__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.reader__dot[aria-current="true"] { background: var(--silver); border-color: var(--silver); transform: scale(1.18); }

@media (max-width: 520px) {
  .reader__dots { display: none; }
}
