/* FOW MAPBOOK — THE ARRIVAL (Hero → Mapbook First Spread integration v0.1)
   Present only while html[data-arrive] is set: a reader who opened this volume
   from the Hero arrives holding it. The layer is built at the top of <body>
   (transport_v0117_repair.html) and owned by mapbook_arrival.js, which removes
   it and the attribute; with neither, this sheet does nothing.
     hold / wait   the handed-over volume on the Hero's night, poised (its cover
                   unlocked and held; light and a hair of depth on the
                   compositor; the cue once the wait is felt)
     land / open   the Mapbook's own volume under the veil, opening; the veil's
                   opening follows the book and grows into the page
     settle        the Mapbook's own controls come up
   The veil's opening is the Hero's (fow_hero_instrument.css .read-veil): the
   same night, the same feathered box, so the first frame here is the last one
   there. */
html[data-arrive], html[data-arrive] body.pub-ground { background: #05060C; }
.mb-arrive {
  position: fixed; inset: 0; z-index: 2147483000; overflow: hidden; pointer-events: auto; cursor: progress;
  contain: strict;
}
.mb-arrive__stage { position: absolute; inset: 0; will-change: transform; }
.mb-arrive__night { position: absolute; inset: -6%; display: block; background: #05060C; }
.mb-arrive__book { position: absolute; display: block; max-width: none; margin: 0; pointer-events: none; user-select: none; transition: opacity 280ms cubic-bezier(.4, 0, .2, 1); }
.mb-arrive__book.is-gone { opacity: 0; }
/* the hinge rig: the handed-over cover, cut at its hinge, unlocked in the Mapbook's own perspective over the page it
   has been lying on (poised hold v0.1); the lamp finds the leather as it tilts, and drifts across it while it waits */
.mb-arrive__rig { position: absolute; inset: 0; pointer-events: none; transform-style: flat; transition: opacity 280ms cubic-bezier(.4, 0, .2, 1); }
.mb-arrive__rig.is-gone { opacity: 0; }
.mb-arrive__page {
  position: absolute; display: block;
  background: linear-gradient(90deg, rgba(20, 18, 16, .92) 0%, #b9b09c 9%, #d9d0bb 42%, #ebe3cf 82%, #f4eddc 100%);
  box-shadow: inset 0 0 0 1px rgba(60, 52, 40, .25);
}
.mb-arrive__leaf {
  position: absolute; display: block; background-repeat: no-repeat; transform-origin: 0 50%;
  will-change: transform; backface-visibility: hidden; overflow: hidden;
}
.mb-arrive__sheen {
  position: absolute; inset: 0; display: block; opacity: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 244, 222, 0) 20%, rgba(255, 244, 222, .045) 60%, rgba(255, 246, 228, .1) 100%);
}
.mb-arrive__lamp {
  position: absolute; inset: 0; display: block; opacity: 0; pointer-events: none; will-change: transform;
  background: linear-gradient(100deg, rgba(255, 240, 210, 0) 28%, rgba(255, 240, 210, .09) 50%, rgba(255, 240, 210, 0) 72%);
}
/* the light inside the book, at the gap the unlocked cover leaves: over the night, turning with the cover on its
   hinge and ramped from nothing at the hinge to all of it at the fore-edge. A tight line comes up with the unlock;
   the wider spill only a long wait brings up */
.mb-arrive__aura { position: absolute; inset: 0; pointer-events: none; transition: opacity 560ms cubic-bezier(.4, 0, .2, 1); }
.mb-arrive__aura.is-gone { opacity: 0; }
.mb-arrive__edge { position: absolute; display: block; will-change: transform; -webkit-mask-image: var(--ramp); mask-image: var(--ramp); }
.mb-arrive__edge > b, .mb-arrive__edge > i { position: absolute; inset: calc(var(--e) + var(--f) * .6); display: block; opacity: 0; border-radius: 2px; }
.mb-arrive__edge > b { box-shadow: 0 0 calc(var(--ch) * .03) calc(var(--ch) * .002) rgba(248, 226, 178, .42); }
.mb-arrive__edge > i { box-shadow: 0 0 calc(var(--ch) * .15) calc(var(--ch) * .02) rgba(236, 206, 150, .2); }
/* the opening: the volume's box (feathered from just inside its edge), and —
   as the book opens — a soft ellipse growing out of it (0 until then) */
.mb-arrive__veil {
  position: absolute; inset: 0; display: block; background: #05060C;
  --rx0: 0px; --rx1: 100vw; --ry0: 0px; --ry1: 100vh; --rf: 10px;
  --ecx: 50vw; --ecy: 50vh; --erx: 0px; --ery: 0px;
  mask-image: linear-gradient(#000 0 0),
    radial-gradient(max(1px, var(--erx)) max(1px, var(--ery)) at var(--ecx) var(--ecy), #000 42%, transparent 100%),
    linear-gradient(90deg, transparent calc(var(--rx0) - var(--rf)), #000 var(--rx0), #000 var(--rx1), transparent calc(var(--rx1) + var(--rf))),
    linear-gradient(180deg, transparent calc(var(--ry0) - var(--rf)), #000 var(--ry0), #000 var(--ry1), transparent calc(var(--ry1) + var(--rf)));
  mask-composite: exclude, add, intersect;
}
/* the cue: the Hero instrument's label voice, between two brass rules */
.mb-arrive__cue {
  position: absolute; left: 0; top: 0; margin: 0; display: flex; align-items: center; gap: .8rem; white-space: nowrap;
  font-family: var(--font-data, "Instrument Sans", system-ui, sans-serif); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(236, 230, 214, .72); opacity: 0; transition: opacity 600ms cubic-bezier(.23, 1, .32, 1);
}
html[lang="ko"] .mb-arrive__cue { letter-spacing: .08em; font-family: SUIT, var(--font-data, system-ui), sans-serif; }
.mb-arrive__cue i { position: relative; width: 34px; height: 1px; overflow: hidden; background: rgba(200, 167, 105, .32); }
.mb-arrive__cue i::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(239, 217, 166, .95), transparent);
  transform: translateX(-100%); animation: mb-arrive-glint 1.8s cubic-bezier(.45, 0, .55, 1) infinite;
}
.mb-arrive__cue i:last-child::after { animation-direction: reverse; }
@keyframes mb-arrive-glint { to { transform: translateX(100%); } }
html[data-arrive="wait"] .mb-arrive__cue { opacity: 1; }
/* the Mapbook's own page stays painted, not shown, until the book has opened;
   then it comes up in its own ordinary state */
html[data-arrive]:not([data-arrive="settle"]) :is(.pub-bar, .pub-skip, #transport > :not(.transport-stage)) { opacity: .001 !important; }
html[data-arrive="settle"] :is(.pub-bar, .pub-skip, #transport > :not(.transport-stage)) { animation: mb-arrive-chrome 380ms cubic-bezier(.23, 1, .32, 1) both; }
@keyframes mb-arrive-chrome { from { opacity: .001; } }
/* a failure is said plainly, with the way back to the Atlas */
.mb-arrive-fail {
  position: fixed; left: 50%; bottom: 72px; z-index: 2147483001; transform: translateX(-50%); max-width: min(92vw, 460px);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .8rem 1rem; border-radius: 4px;
  background: #11151f; color: #ece6d6; box-shadow: 0 10px 30px rgba(5, 6, 12, .28);
  font: 13px/1.45 SUIT, "Instrument Sans", system-ui, sans-serif;
}
.mb-arrive-fail p { margin: 0; flex: 1 1 14rem; }
.mb-arrive-fail a { color: #efd9a6; text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .mb-arrive__cue i::after { animation: none; transform: none; opacity: .6; }
  .mb-arrive__book { transition: none; }
}
