/* Desktop issue mini-map, docked 32px from the magazine's visible
   right edge (the cover while it is on screen, then the issue /
   spread). On the home cover, a CSS scroll-timeline translateX on
   .mm-host keeps that gap in lockstep with the cover's scale, with
   no JS on the scroll path. A cover thumb as wide as a page pair
   sits above spread-pair snapshots (17:25). An invisible hit zone
   (~2× width, a bit taller) drives a subtle top-anchored magnify:
   the cover and items above the hover stay put; the hovered item
   and those below it grow downward. Hidden on mobile. */

.mm-host {
  /* CSS start geometry so the prerendered strip is visible and
     docked before any JS runs. left / width / top / height may later
     be refined in JS; translateX is driven by the cover's
     scroll-timeline, or by a cached JS fallback. */
  --mm-visual-w: calc(var(--mm-pair, 46px) + 2px);
  --mm-gap-dock: 32px;
  --mm-start-w: calc(var(--cover-final-w, 1120px) * var(--s0, 1));
  --mm-edge-0: calc((100vw + var(--mm-start-w)) / 2);
  --mm-visual-left: calc(var(--mm-edge-0) + var(--mm-gap-dock));
  --mm-hit-w: calc(var(--mm-visual-w) * 2);
  --mm-hit-left: max(var(--mm-edge-0), calc(var(--mm-visual-left) - var(--mm-visual-w) / 2));
  position: fixed;
  left: var(--mm-hit-left);
  width: var(--mm-hit-w);
  top: var(--nav-stack-h, 72px);
  bottom: 16px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  z-index: 20;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  /* No will-change here. This node is a tall, mostly transparent hit
     zone (2× the visual width, viewport height). In Safari, promoting
     it to its own layer paints a ghost column behind the strip — a
     “shadow” of the control without the thumbnail images. The dock
     animation still runs from the literal keyframes on this element. */
}

/* Keep the offscreen issue out of the first layout pass on the home
   cover (no deep-link hash). Revealed after the first presented frame
   by the inlined bind script. Not content-visibility: the issue is
   below the fold at scroll 0, so display:none cannot change what is
   on screen, and once .issue-ready is set scroll math is exact. */
html.js-defer-issue:not(.issue-ready) .issue-wrap {
  display: none !important;
}

/* Literal endpoints are written into #cover-kf (see mm-early.js). */
@keyframes mm-dock-x {
  from { transform: translateX(0); }
  to { transform: translateX(0); }
}

@supports (animation-timeline: scroll()) {
  html.scroll-timeline.has-scale .mm-host.mm-dock-tl {
    animation: mm-dock-x linear both;
    animation-timeline: scroll(root);
    animation-range: 0px var(--scale-travel, 0px);
  }
}

.mm-host.is-squeezed {
  visibility: hidden;
  pointer-events: none;
}

.mm {
  --mm-w: 22px;
  --mm-gap: 2px;
  --mm-pair: calc(var(--mm-w) * 2 + var(--mm-gap));
  position: relative;
  /* Offset inside the wider hit zone so the visual left edge stays
     32px from the magazine. JS may later switch this to absolute
     with explicit left/top. */
  margin-left: calc(var(--mm-visual-left) - var(--mm-hit-left));
  margin-right: auto;
  right: auto;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  margin: 0;
  /* Tight horizontal chrome so the control plus a 32px gap fits
     beside a 1120px issue at 1280px wide (48px box = 46px pair + borders). */
  width: calc(var(--mm-pair) + 2px);
  max-width: calc(var(--mm-pair) + 2px);
  max-height: calc(100vh - var(--nav-stack-h, 0px) - 16px);
  overflow: visible;
  padding: 8px 0 7px;
  border: 1px solid rgb(28 26 23 / 0.22);
  background: rgb(36 32 28 / 0.42);
  color: #f3eee2;
  font: 400 10px/1 League, "League Gothic", Impact, sans-serif;
  letter-spacing: 0.06em;
  opacity: 0.58;
  transition: opacity 0.18s ease;
  pointer-events: auto;
  scrollbar-width: thin;
}

.mm.is-squeezed {
  visibility: hidden;
  pointer-events: none;
}

.mm.is-scrollable {
  overflow-x: hidden;
  overflow-y: auto;
}

.mm-host:hover .mm,
.mm:focus-within {
  opacity: 1;
  background: rgb(36 32 28 / 0.72);
}

.mm-label {
  display: block;
  flex: 0 0 auto;
  margin: 0 0 6px;
  /* Twice the previous 8px size so the word is legible at rest. */
  font: 400 16px/1 League, "League Gothic", Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: #dfd3bb;
}

.mm-spread {
  display: flex;
  flex-direction: row;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: var(--mm-gap);
  margin: 0 0 var(--mm-gap);
  justify-content: center;
  position: relative;
  z-index: 1;
}

.mm-spread:last-child {
  margin-bottom: 0;
}

.mm-cover-row {
  display: flex;
  flex-direction: row;
  flex: 0 0 auto;
  justify-content: center;
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
}

.mm-rule {
  flex: 0 0 auto;
  height: 0;
  margin: 6px 4px 7px;
  border: 0;
  border-bottom: 1px solid rgb(243 238 226 / 0.28);
}

.mm-label,
.mm-cover,
.mm-rule,
.mm-spread {
  /* Top-anchored magnify: scale about the top-center so the top
     edge stays put and growth is downward / left-right only. */
  transform-origin: 50% 0;
}

.mm-page {
  appearance: none;
  box-sizing: border-box;
  display: block;
  position: relative;
  flex: 0 0 auto;
  width: var(--mm-w);
  aspect-ratio: 17 / 25;
  height: calc(var(--mm-w) * 25 / 17);
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: #f6eedb;
  font: inherit;
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  border-radius: 0;
}

/* Cover is as wide as a page pair (two thumbs plus their gap), 17:25. */
.mm-page.mm-cover {
  width: var(--mm-pair);
  height: calc(var(--mm-pair) * 25 / 17);
  aspect-ratio: 17 / 25;
}

.mm-visual {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border: 1px solid rgb(243 238 226 / 0.35);
  /* Solid page-colored box while the snapshot is still on the way. */
  background: #f3eee2;
  box-sizing: border-box;
  pointer-events: none;
  transform-origin: 50% 50%;
}

.mm-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
}

.mm-visual.is-loaded img {
  opacity: 1;
}

.mm-folio {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 1px 2px 0;
  background: rgb(20 16 12 / 0.62);
  color: #f3eee2;
  font: 400 7px/1 League, "League Gothic", Impact, sans-serif;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.mm-page:hover .mm-visual,
.mm-page:focus-visible .mm-visual {
  border-color: #f3eee2;
  outline: 1px solid #f3eee2;
  outline-offset: 1px;
}

.mm-page.is-current .mm-visual {
  border-color: #f3eee2;
  outline: 1px solid #f3eee2;
  outline-offset: 1px;
  box-shadow: 0 0 0 1px #f3eee2;
}

.mm-page.is-solo {
  /* A single left page still sits on the left of the pair. */
  margin-right: calc(var(--mm-w) + var(--mm-gap));
}

.mm-page:focus-visible {
  outline: none;
}

/* When the viewport is too narrow for the full-width issue plus the
   48px control, JS hides the strip (is-squeezed). Mirror that for the
   pre-JS frame: spread 1120px + control 48px. */
@media (max-width: 1168px) {
  .mm-host,
  .mm {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 640px) {
  .mm-host,
  .mm {
    display: none !important;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-host.mm-dock-tl {
    animation: none !important;
  }
}
