/* =======================================================================
   atlas.css : Hoshi's atlas on mukashi.world (the home page's Journey Home
   section and atlas.html). The reading app's atlas, ported: the same
   approved pieces (Assets/atlas/, built by scripts/atlas/build-atlas-
   assets.py from mukashi-app public/atlas), the same reveal (the lantern
   light spreads, the ink draws the land, the watercolour floods in, the
   names write themselves in), the same lettering. Behaviour: atlas.js.

   Geometry: a PIECE is its cell grown by the 4% bleed on every side (the
   app's PIECE_BLEED), so a point at x% of the cell sits at
   (x + 4) / 108 of the piece. World boxes, names and labels are written in
   the cell's 0-100 grid (as lib/map/atlas-vignettes.ts has them) and turned
   into piece % here with --x/--y and the cq() helper below.
   ======================================================================= */

.atlas-piece {
  position: absolute;
  container-type: size;
  /* a piece is never a stacking context of its own until it lifts */
}
.atlas-piece > .atlas-paper,
.atlas-piece > .atlas-ink,
.atlas-piece > .atlas-art,
.atlas-piece > .atlas-lit {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
/* Before the reveal: the blank piece (paper) only. The ink and the
   painting wait behind a mask that atlas.js opens as a bloom. */
.atlas-piece > .atlas-ink,
.atlas-piece > .atlas-art,
.atlas-piece > .atlas-lit {
  -webkit-mask-image: radial-gradient(circle at 0 0, #000 0, transparent 0);
          mask-image: radial-gradient(circle at 0 0, #000 0, transparent 0);
}
/* Hoshi's lantern light: the warm light that spreads in ahead of the ink. */
.atlas-piece > .atlas-lit {
  background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(255, 233, 184, 0.55), rgba(245, 166, 35, 0.18) 55%, rgba(245, 166, 35, 0) 80%);
  mix-blend-mode: soft-light;
  opacity: 1;
  transition: opacity 900ms ease;
}
.atlas-piece.is-drawn > .atlas-art { -webkit-mask-image: none; mask-image: none; }
.atlas-piece.is-drawn > .atlas-ink { opacity: 0; }
.atlas-piece.is-drawn > .atlas-lit { opacity: 0; }

/* -- the lettering: names and the level label, written in ink by the page
      (the app letters them too; the painting carries none) ------------ */
.atlas-name,
.atlas-label {
  position: absolute;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  color: #5A3E22;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
  /* a little paper round the ink, so a name over a busy painting still reads */
  text-shadow: 0 0 0.18em rgba(250, 243, 226, 0.95), 0 0 0.4em rgba(250, 243, 226, 0.7);
}
.atlas-name {
  left: calc((var(--x) + 4) / 108 * 100%);
  top: calc((var(--y) + 4) / 108 * 100%);
  transform: translateX(-50%);
  font-size: 3.9cqh;          /* the app: 0.042 of the cell's height */
}
.atlas-label {
  left: calc((var(--x) + 4) / 108 * 100%);
  top: calc((var(--y) + 4) / 108 * 100%);
  font-size: 4.6cqh;
}
.atlas-label .i18n-jp,
.atlas-label .gloss-jp { font-family: 'M PLUS Rounded 1c', sans-serif; font-weight: 700; font-size: 0.72em; letter-spacing: 0.02em; }
/* written in once, left to right (writeInClip in the app) */
.atlas-piece:not(.is-named) .atlas-name,
.atlas-piece:not(.is-named) .atlas-label { clip-path: inset(-60% 120% -60% -30%); }
.atlas-piece.is-named .atlas-name,
.atlas-piece.is-named .atlas-label { clip-path: inset(-60% -30% -60% -30%); transition: clip-path 900ms cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.atlas-piece.is-named .atlas-label { transition-delay: 250ms; }

/* -- worlds: a hit box per vignette, the world's own cut-out (lifted on
      hover or focus) and its tip (name + one-line hook) ------------------ */
.atlas-world-g { position: absolute; inset: 0; pointer-events: none; }
.atlas-cut {
  position: absolute;
  left: calc((var(--cx0) + 4) / 108 * 100%);
  top: calc((var(--cy0) + 4) / 108 * 100%);
  width: calc((var(--cx1) - var(--cx0)) / 108 * 100%);
  height: calc((var(--cy1) - var(--cy0)) / 108 * 100%);
  opacity: 0;
  transform-origin: 50% 92%;
  transition: transform 320ms cubic-bezier(0.23, 1, 0.32, 1), opacity 160ms ease, filter 320ms ease;
  pointer-events: none;
}
.atlas-world {
  position: absolute;
  left: calc((var(--x0) + 4) / 108 * 100%);
  top: calc((var(--y0) + 4) / 108 * 100%);
  width: calc((var(--x1) - var(--x0)) / 108 * 100%);
  height: calc((var(--y1) - var(--y0)) / 108 * 100%);
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit;
  font: inherit; cursor: pointer;
  border-radius: 18%;
  pointer-events: none;           /* live once the piece is drawn */
  -webkit-tap-highlight-color: transparent;
}
.atlas-piece.is-drawn .atlas-world { pointer-events: auto; }
/* its name is for screen readers; the map letters it (.atlas-name) */
.atlas-world > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.atlas-world:focus { outline: none; }
.atlas-world:focus-visible { outline: 2px dashed rgba(90, 62, 34, 0.75); outline-offset: 3px; }
.atlas-world-g.is-up .atlas-cut {
  opacity: 1;
  transform: translateY(-2.2%) scale(1.045);
  filter: drop-shadow(0 0.9cqh 0.7cqh rgba(60, 40, 18, 0.32)) drop-shadow(0 0.25cqh 0.2cqh rgba(60, 40, 18, 0.25));
}
.atlas-world-g.is-up { z-index: 2; }
.atlas-world-g.is-up .atlas-name { z-index: 3; }

/* the tip: the house night bubble (cream text, gold hairline, a tail) */
.atlas-tip {
  position: absolute;
  left: calc((var(--tx) + 4) / 108 * 100%);
  top: calc((var(--ty) + 4) / 108 * 100%);
  transform: translate(-50%, calc(-100% - 0.7em)) scale(0.96);
  transform-origin: 50% 100%;
  width: max-content; max-width: 19em;
  padding: 0.7em 0.95em 0.75em;
  font-family: 'Nunito', 'M PLUS Rounded 1c', sans-serif;
  font-size: calc(clamp(13px, 1.05vw, 15px) / var(--cam-s, 1));
  line-height: 1.5;
  text-align: left;
  color: #FAF6EF;
  background: rgba(17, 26, 66, 0.96);
  border: 1px solid rgba(245, 166, 35, 0.55);
  border-radius: 0.8em;
  box-shadow: 0 0.6em 1.6em rgba(4, 8, 32, 0.45);
  opacity: 0; visibility: hidden;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.23, 1, 0.32, 1), visibility 0s linear 220ms;
  pointer-events: none;
  z-index: 4;
}
.atlas-tip::after {
  content: ''; position: absolute; left: 50%; bottom: -0.42em; width: 0.8em; height: 0.8em;
  background: inherit; border-right: inherit; border-bottom: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.atlas-tip--below { transform: translate(-50%, 0.7em) scale(0.96); transform-origin: 50% 0; }
.atlas-tip--below::after { bottom: auto; top: -0.42em; border: 0; border-left: inherit; border-top: inherit; }
.atlas-tip--right { transform: translate(-82%, calc(-100% - 0.7em)) scale(0.96); }
.atlas-tip--right::after { left: 82%; }
.atlas-tip--left { transform: translate(-18%, calc(-100% - 0.7em)) scale(0.96); }
.atlas-tip--left::after { left: 18%; }
.atlas-tip strong {
  display: block; margin-bottom: 0.15em;
  font-family: 'Fraunces', 'M PLUS Rounded 1c', Georgia, serif;
  font-variation-settings: 'opsz' 60, 'wght' 650, 'SOFT' 100, 'WONK' 1;
  font-weight: 650; font-size: 1.12em; color: #FFE9B8;
}
.atlas-tip .atlas-tip-count { display: block; margin-top: 0.35em; font-size: 0.82em; color: rgba(255, 233, 184, 0.72); font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; letter-spacing: 0.02em; }
.atlas-world-g.is-up .atlas-tip { opacity: 1; visibility: visible; transition-delay: 0s; }
.atlas-world-g.is-up .atlas-tip:not(.atlas-tip--below):not(.atlas-tip--right):not(.atlas-tip--left) { transform: translate(-50%, calc(-100% - 0.7em)) scale(1); }
.atlas-world-g.is-up .atlas-tip--below { transform: translate(-50%, 0.7em) scale(1); }
.atlas-world-g.is-up .atlas-tip--right { transform: translate(-82%, calc(-100% - 0.7em)) scale(1); }
.atlas-world-g.is-up .atlas-tip--left { transform: translate(-18%, calc(-100% - 0.7em)) scale(1); }
/* Touch: the caption under the map carries the tip instead (atlas.js). */
.atlas-touch .atlas-world-g .atlas-tip { display: none; }
.atlas-caption .atlas-tip { position: static; display: block; opacity: 1; visibility: visible; transform: none; max-width: none; width: auto; padding: 0; background: none; border: 0; box-shadow: none; font-size: inherit; color: inherit; }
.atlas-caption .atlas-tip::after { display: none; }
.atlas-caption .atlas-tip strong { display: inline; margin-right: 0.45em; }

/* =======================================================================
   THE HOME PAGE: the Eiken 5 piece laid over the Journey Home map
   ======================================================================= */
.jh-atlas {
  position: absolute;
  /* the piece's CELL takes 94% of the map; its bleed reaches past that */
  left: calc(3% - 94% * 0.04); top: calc(3% - 94% * 0.04);
  width: calc(94% * 1.08); height: calc(94% * 1.08);
  z-index: 4;
  opacity: 0;
  transform: rotate(-0.6deg) translateY(1.5%) scale(1.015);
  transition: opacity 650ms ease, transform 900ms cubic-bezier(0.23, 1, 0.32, 1);
  filter: drop-shadow(0 10px 18px rgba(4, 8, 32, 0.45));
}
.jh-atlas[hidden] { display: block; visibility: hidden; }
.jh-atlas.is-down { opacity: 1; transform: rotate(-0.6deg); }
.world-map-container.is-atlas .map-hotspot-svg,
.world-map-container.is-atlas .map-way-on-layer { pointer-events: none; visibility: hidden; }
.world-map-container.is-atlas .map-preview-panel { display: none; }
/* =======================================================================
   THE ATLAS PAGE
   ======================================================================= */
.at-stage-wrap { position: relative; max-width: 1240px; margin: 0 auto; padding-inline: clamp(0px, 3vw, 2.75rem); }
.atlas-view {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  /* the map floats on the night: no box, only the very edges soften, so a
     neighbouring piece runs off into the sky rather than stopping at a line */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
          mask-composite: intersect;
  touch-action: pan-y;
  view-transition-name: var(--at-arrival, none);
}
.atlas-plane {
  position: absolute; left: 0; top: 0;
  width: 300%; height: 300%;
  transform-origin: 0 0;
}
.atlas-plane.is-moving { will-change: transform; transition: transform 1100ms cubic-bezier(0.65, 0, 0.35, 1); }
.atlas-plane .atlas-piece {
  left: calc((var(--col) - 0.04) / 3 * 100%);
  top: calc((var(--row) - 0.04) / 3 * 100%);
  width: calc(1.08 / 3 * 100%);
  height: calc(1.08 / 3 * 100%);
}
/* a piece is a door in the whole-map view: it lifts toward you */
.atlas-plane .atlas-piece { transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), filter 300ms ease; }
.atlas-view.is-all .atlas-plane .atlas-piece[data-zoom] { cursor: zoom-in; }
@media (hover: hover) and (pointer: fine) {
  .atlas-view.is-all .atlas-piece[data-zoom]:hover { transform: translateY(-0.6%); filter: drop-shadow(0 1.4cqh 1.6cqh rgba(4, 8, 32, 0.55)); z-index: 2; }
}
.atlas-piece-hit {
  position: absolute; inset: 4%; margin: 0; padding: 0; border: 0; background: transparent;
  cursor: zoom-in; border-radius: 3%;
  display: none;
}
.atlas-view.is-all .atlas-piece-hit { display: block; }
.atlas-piece-hit:focus { outline: none; }
.atlas-piece-hit:focus-visible { outline: 0.5cqh dashed rgba(255, 233, 184, 0.9); outline-offset: -1.5cqh; }

/* the road: dotted ink, inked in with each piece */
.atlas-road { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.atlas-road .road { fill: none; stroke: #5A3E22; stroke-opacity: 0.62; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 0 24; }
.atlas-road .road-mask { fill: none; stroke: #fff; stroke-width: 48; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
/* the home page's piece: the road in the piece's own grid (1728 x 972 = the
   cell's 1600 x 900 plus the bleed), so its dots are a touch smaller */
.jh-atlas .atlas-road .road { stroke-width: 7; stroke-dasharray: 0 19; }

.atlas-plane { container-type: size; }


/* deep links (#eiken-4) land on the map: the anchors sit at its top */
.at-anchor { display: block; height: 0; scroll-margin-top: 0.75rem; }

/* -- the carved arrows: the app's WoodNavButton (components/wood-nav.tsx,
      WOOD_NAV_CSS + WOOD_NAV_POSITIONS), one per neighbouring piece -------- */
.atlas-nav { position: absolute; inset: 0 clamp(0px, 3vw, 2.75rem); pointer-events: none; z-index: 5; }
.atlas-wood {
  position: absolute;
  width: 46px; height: 46px; margin: 0; padding: 0;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto; cursor: pointer;
  background: linear-gradient(158deg, #7c5836 0%, #5f4127 62%, #513521 100%);
  border: 2px solid rgba(52, 34, 16, 0.65);
  box-shadow:
    inset 0 2px 3px rgba(255, 224, 178, 0.28),
    inset 0 -4px 6px rgba(22, 12, 4, 0.42),
    0 5px 12px rgba(0, 0, 0, 0.38);
  transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.25s ease;
  transform: var(--wn-t);
  -webkit-tap-highlight-color: transparent;
}
.atlas-wood[hidden] { display: none; }
.atlas-wood svg { filter: drop-shadow(0 1px 0 rgba(20, 10, 4, 0.5)); }
.atlas-wood--up { top: 14px; left: 50%; --wn-t: translateX(-50%); }
.atlas-wood--up svg { transform: rotate(-90deg); }
.atlas-wood--right { top: 50%; right: 14px; --wn-t: translateY(-50%); }
.atlas-wood--down { bottom: 14px; left: 50%; --wn-t: translateX(-50%); }
.atlas-wood--down svg { transform: rotate(90deg); }
.atlas-wood--left { top: 50%; left: 14px; --wn-t: translateY(-50%); }
.atlas-wood--left svg { transform: rotate(180deg); }
@media (hover: hover) and (pointer: fine) {
  .atlas-wood:hover {
    transform: var(--wn-t) scale(1.07);
    box-shadow:
      inset 0 2px 3px rgba(255, 224, 178, 0.30),
      inset 0 -4px 6px rgba(22, 12, 4, 0.42),
      0 5px 14px rgba(0, 0, 0, 0.4),
      0 0 16px rgba(245, 166, 35, 0.5);
  }
}
.atlas-wood:active { transform: var(--wn-t) scale(0.96); }
.atlas-wood:focus-visible { outline: 2px solid #FFE9B8; outline-offset: 3px; }
/* the app shows its arrows only while the camera is still */
.at-stage-wrap.is-moving .atlas-wood { opacity: 0; pointer-events: none; }
.atlas-view:focus { outline: none; }
.atlas-view:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 233, 184, 0.7); }

/* -- tap to unfold (the atlas page only, atlas.js): where the browser keeps
      sound locked until a gesture, the first piece waits as the plain
      parchment with one line written on it in the map's own ink and hand
      (the level labels' lettering). The whole map is the button. ---------- */
.atlas-unfold {
  position: absolute; inset: 0; z-index: 3;
  margin: 0; padding: 0; border: 0; background: transparent;
  display: grid; place-items: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  container-type: size;
  opacity: 0; transition: opacity 400ms ease;
}
.atlas-unfold[hidden] { display: none; }
.atlas-unfold.is-shown { opacity: 1; }
.atlas-unfold.is-going { opacity: 0; transition-duration: 600ms; pointer-events: none; }
.atlas-unfold:focus { outline: none; }
/* a little of Hoshi's lantern light warms the paper under the words */
.atlas-unfold::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 70cqw; height: 46cqh;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(255, 233, 184, 0.5), rgba(245, 166, 35, 0.12) 60%, rgba(245, 166, 35, 0) 100%);
  mix-blend-mode: soft-light;
}
.atlas-unfold-line {
  position: relative;
  padding: 0.25em 0.6em 0.35em;
  font-family: 'Caveat', cursive; font-weight: 600;
  font-size: clamp(1.45rem, 8.2cqh, 3.4rem); line-height: 1.1;
  color: #5A3E22;
  white-space: nowrap;
  text-shadow: 0 0 0.18em rgba(250, 243, 226, 0.95), 0 0 0.4em rgba(250, 243, 226, 0.7);
  border-radius: 0.6em;
}
.atlas-unfold-ink {
  display: block;
  /* unwritten until the prompt shows */
  -webkit-mask-image: linear-gradient(90deg, #000 47.2%, transparent 52.8%);
          mask-image: linear-gradient(90deg, #000 47.2%, transparent 52.8%);
  -webkit-mask-size: 212% 100%; mask-size: 212% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
}
/* the line writes itself in, left to right, at a hand's pace (the names'
   write-in on the map, with a feathered pen edge), then breathes softly */
.atlas-unfold.is-shown .atlas-unfold-ink {
  animation: atlas-unfold-write 1500ms cubic-bezier(0.3, 0.12, 0.55, 0.96) 150ms both,
             atlas-unfold-breathe 3.6s ease-in-out 1900ms infinite;
}
.atlas-unfold-line .i18n-jp,
.atlas-unfold-line .gloss-jp { font-family: 'M PLUS Rounded 1c', sans-serif; font-weight: 700; font-size: 0.66em; letter-spacing: 0.06em; }
.atlas-unfold:focus-visible .atlas-unfold-line { outline: 2px dashed rgba(90, 62, 34, 0.75); outline-offset: 0.1em; }
@keyframes atlas-unfold-write {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to   { -webkit-mask-position: 0 0;    mask-position: 0 0; }
}
@keyframes atlas-unfold-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.74; } }
/* reduced motion: already written, still */
@media (prefers-reduced-motion: reduce) {
  .atlas-unfold-ink, .atlas-unfold.is-shown .atlas-unfold-ink { animation: none; -webkit-mask-image: none; mask-image: none; }
}

/* -- the sound chip: the app's audio chip (48px round paper, amber ink),
      wearing the way-on light until it is first used (the homepage trailer's
      chip, off-the-page-home.css; the home copy of these rules is in
      styles.css so the chip holds its place from the first frame) -------- */
.atlas-sound-wrap { position: relative; display: inline-block; width: 48px; height: 48px; flex: none; }
.atlas-sound {
  position: relative; z-index: 1; width: 48px; height: 48px; margin: 0; padding: 0;
  border-radius: 50%; border: 1px solid #d7bb86; background: #f4e7ca; color: #9a5a0c;
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px #0005;
  transition: transform .2s ease; -webkit-tap-highlight-color: transparent;
}
.atlas-sound:hover { transform: scale(1.06); }
.atlas-sound:focus-visible { outline: 3px solid #f5c86e; outline-offset: 4px; }
.atlas-sound .atlas-sound-on { display: none; }
.atlas-sound.is-on .atlas-sound-on { display: inline; }
.atlas-sound.is-on .atlas-sound-off { display: none; }
.atlas-sound-light { position: absolute; inset: 0; pointer-events: none; }

/* -- the bar under the map: the level tabs, the whole map, the sound ----- */
.atlas-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.8rem 1rem;
  max-width: 1100px; margin: 0.7rem auto 0; padding-inline: var(--sb-gutter, 1rem);
}
.atlas-tabs {
  display: flex; align-items: stretch; gap: 4px; padding: 5px;
  border-radius: 999px;
  background: rgba(8, 15, 44, 0.78);
  border: 1px solid rgba(245, 166, 35, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 233, 184, 0.07), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  touch-action: manipulation;
}
.atlas-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 52px; padding: 0.35rem 1.25rem; margin: 0;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  color: rgba(250, 246, 239, 0.66);
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 300ms ease, color 300ms ease, box-shadow 300ms ease;
}
.atlas-tab-name { font-weight: 600; font-size: 1.05rem; letter-spacing: 0.01em; white-space: nowrap; }
.atlas-tab-count { font-size: 0.74rem; opacity: 0.75; letter-spacing: 0.02em; white-space: nowrap; }
.atlas-tab:hover { color: rgba(250, 246, 239, 0.92); }
.atlas-tab[aria-selected="true"] { color: #FFE9B8; background: rgba(245, 166, 35, 0.16); box-shadow: inset 0 0 0 1.5px rgba(245, 166, 35, 0.6); }
.at-stage.is-all .atlas-tab[aria-selected="true"] { background: transparent; box-shadow: inset 0 0 0 1px rgba(245, 166, 35, 0.3); }
.atlas-tab:focus-visible { outline: 2px solid #FFE9B8; outline-offset: 3px; }
.atlas-btn {
  display: inline-flex; align-items: center; gap: 0.45em; min-height: 46px;
  padding: 0.55em 1.25em; margin: 0;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-weight: 600; font-size: 1rem; line-height: 1.2;
  color: #FAF6EF; background: rgba(13, 26, 66, 0.4);
  border: 1.5px solid rgba(250, 246, 239, 0.42); border-radius: 999px; cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 300ms ease;
  -webkit-tap-highlight-color: transparent;
}
.atlas-btn:hover { background: rgba(250, 246, 239, 0.1); border-color: rgba(250, 246, 239, 0.85); color: #FFE9B8; }
.atlas-btn:active { transform: scale(0.97); opacity: 0.8; }
.atlas-btn:focus-visible { outline: 2px solid #FFE9B8; outline-offset: 3px; }
.atlas-btn[hidden] { display: none; }
/* the whole map's own line (its count) shows only in that view */
.atlas-where { max-width: 1100px; margin: 0.5rem auto 0; padding-inline: var(--sb-gutter, 1rem); text-align: center; min-height: 1.5em; font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-size: 0.95rem; color: rgba(255, 233, 184, 0.8); letter-spacing: 0.02em; }
.atlas-where [data-for] { display: none; }
.atlas-where [data-for].is-on { display: inline; }

/* the caption (touch): the world you tapped, its hook */
.atlas-caption {
  max-width: 1100px; margin: 0.6rem auto 0; padding-inline: var(--sb-gutter, 1rem);
  min-height: 0; font-size: 0.95rem; line-height: 1.65; color: rgba(250, 246, 239, 0.84);
}
.atlas-caption:empty { display: none; }
.atlas-caption strong { color: #FFE9B8; font-family: 'Fraunces', 'M PLUS Rounded 1c', Georgia, serif; font-variation-settings: 'opsz' 60, 'wght' 650, 'SOFT' 100, 'WONK' 1; font-weight: 650; margin-right: 0.4em; }
.atlas-caption .atlas-tip-count { color: rgba(255, 233, 184, 0.7); font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-size: 0.86em; margin-left: 0.4em; }

/* =======================================================================
   THE LEVEL PANEL: the level the map is on, its worlds as torn scraps of
   the same map. Every panel is complete static HTML. Without JS they
   stack; with it they share one place and only the current one shows (the
   others behind it, aria-hidden + inert, never display:none), following
   the map (atlas.js setLevel; the first frame from html[data-at-level]).
   ======================================================================= */
.sb .at-stage { padding-bottom: 0; }
.sb .at-reading { padding-top: clamp(1rem, 2.4vw, 1.6rem); }
.at-reading .sb-folio { max-width: 1180px; }
.at-panel {
  position: relative;
  border-radius: 30px;
  padding: clamp(1.4rem, 3vw, 2.4rem) clamp(1.1rem, 3vw, 2.6rem) clamp(1.7rem, 3.2vw, 2.7rem);
  background:
    radial-gradient(ellipse 60% 32% at 50% 0%, rgba(245, 166, 35, 0.12) 0%, transparent 72%),
    linear-gradient(180deg, #17265f 0%, #101b4c 100%);
  border: 1px solid rgba(245, 166, 35, 0.3);
  box-shadow: 0 26px 60px -24px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 233, 184, 0.06);
}
.at-panel + .at-panel { margin-top: 1.6rem; }
.js .at-deck { display: grid; touch-action: pan-y; }
.js .at-panel {
  grid-area: 1 / 1; align-self: start; margin: 0;
  overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, max-height 0.6s cubic-bezier(0.45, 0.05, 0.25, 1);
}
.js:not([data-at-level]) .at-panel[data-level="e5"],
.js[data-at-level="e5"] .at-panel[data-level="e5"],
.js[data-at-level="e4"] .at-panel[data-level="e4"],
.js[data-at-level="e3"] .at-panel[data-level="e3"] { opacity: 1; pointer-events: auto; z-index: 1; }

/* the level: its name, its count, what it is */
.at-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  grid-template-areas: "tag body" "title body";
  column-gap: clamp(1.2rem, 3.5vw, 3rem);
  align-items: start;
}
.at-panel-head .at-level-tag {
  grid-area: tag; margin: 0 0 0.2rem;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-weight: 600; font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255, 233, 184, 0.75);
}
.at-panel-head h2 {
  grid-area: title; margin: 0;
  font-family: 'Fraunces', 'M PLUS Rounded 1c', Georgia, serif;
  font-variation-settings: 'opsz' 60, 'wght' 700, 'SOFT' 100, 'WONK' 1;
  font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.15;
  color: #F5A623;
  background: linear-gradient(180deg, #FFE9B8 0%, #F5A623 90%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  justify-self: start;
}
.at-panel-head > p:not(.at-level-tag) { grid-area: body; margin: 0; font-size: 1rem; line-height: 1.9; color: rgba(250, 246, 239, 0.86); }

/* the worlds: torn scraps of the map, each with its story */
.at-worlds {
  list-style: none; margin: clamp(1.5rem, 3vw, 2.3rem) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 1.8rem clamp(1rem, 2vw, 1.6rem);
}
.at-panel[data-level="e3"] .at-worlds { --n: 5; }
.at-vignette { --tilt: -1.4deg; min-width: 0; }
.at-vignette:nth-child(2n) { --tilt: 1.1deg; }
.at-vignette:nth-child(3n) { --tilt: -0.5deg; }
.at-scrap {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3;
  transform: rotate(var(--tilt));
  filter: drop-shadow(0 10px 14px rgba(4, 8, 32, 0.5));
  transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) {
  .at-vignette:hover .at-scrap { transform: rotate(0deg) translateY(-4px) scale(1.025); }
}
.at-vignette h3 {
  margin: 0.95rem 0 0.1rem;
  font-family: 'Fraunces', 'M PLUS Rounded 1c', Georgia, serif;
  font-variation-settings: 'opsz' 60, 'wght' 650, 'SOFT' 100, 'WONK' 1; font-weight: 650;
  font-size: 1.2rem; line-height: 1.3; color: #FFE9B8;
}
.at-vignette .at-count { display: block; margin-bottom: 0.4rem; font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-size: 0.82rem; letter-spacing: 0.03em; color: rgba(245, 166, 35, 0.85); }
.at-vignette p { margin: 0; font-size: 0.94rem; line-height: 1.75; color: rgba(250, 246, 239, 0.84); }

/* arriving: the panel's words and scraps come in from the way you travelled */
@keyframes at-in-r { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes at-in-l { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
.at-panel.from-right .at-panel-head,
.at-panel.from-right .at-vignette { animation: at-in-r 0.55s cubic-bezier(0.23, 1, 0.32, 1) both; }
.at-panel.from-left .at-panel-head,
.at-panel.from-left .at-vignette { animation: at-in-l 0.55s cubic-bezier(0.23, 1, 0.32, 1) both; }
.at-panel.from-right .at-vignette,
.at-panel.from-left .at-vignette { animation-delay: calc(90ms + var(--i, 0) * 60ms); }

.at-beyond { max-width: 44em; margin-top: clamp(2rem, 4vw, 3rem); }
.at-close { text-align: center; }
.at-close .pr-actions { justify-content: center; }
.at-intro { max-width: 40em; font-size: clamp(0.98rem, 1.4vw, 1.06rem); line-height: 1.95; }
.at-intro p { color: rgba(250, 246, 239, 0.86); }
.at-intro p + p { margin-top: 0.9rem; }
.at-head { padding-bottom: clamp(0.5rem, 2vw, 1.2rem) !important; }
.at-head .sb-folio { max-width: 1100px; }
.at-eyebrow { font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-weight: 600; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 233, 184, 0.75); margin: 0 0 0.6rem; }
.at-note { font-size: 0.85rem; color: rgba(250, 246, 239, 0.6) !important; margin-top: 1rem; }

@media (max-width: 1060px) {
  .at-worlds, .at-panel[data-level="e3"] .at-worlds { --n: 2; column-gap: 2rem; }
  /* the scrap beside the name, the words under both */
  .at-vignette { display: grid; grid-template-columns: 40% minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 0.95rem; }
  .at-vignette > .at-scrap { grid-column: 1; grid-row: 1 / span 2; }
  .at-vignette > h3, .at-vignette > .at-count { grid-column: 2; }
  .at-vignette > h3 { align-self: end; }
  .at-vignette > .at-count { align-self: start; }
  .at-vignette > p { grid-column: 1 / -1; margin-top: 0.7rem; }
  .at-vignette .at-count { margin-bottom: 0.2rem; }
  .at-vignette h3 { margin-top: 0.1rem; }
}
@media (max-width: 860px) {
  .at-panel-head { grid-template-columns: 1fr; grid-template-areas: "tag" "title" "body"; }
  .at-panel-head > p:not(.at-level-tag) { margin-top: 0.7rem; }
}
@media (max-width: 600px) {
  .at-stage-wrap { padding-inline: 0; }
  .atlas-nav { inset: 0; }
  .atlas-wood { width: 40px; height: 40px; border-radius: 11px; }
  .atlas-wood--up { top: 8px; } .atlas-wood--down { bottom: 8px; }
  .atlas-wood--left { left: 8px; } .atlas-wood--right { right: 8px; }
  .atlas-tabs { width: 100%; box-sizing: border-box; }
  .atlas-tab { flex: 1 1 0; min-width: 0; padding: 0.3rem 0.35rem; }
  .atlas-tab-name { font-size: 0.98rem; }
  .atlas-tab-count { font-size: 0.66rem; letter-spacing: 0; }
  .at-panel { border-radius: 22px; padding-inline: 1rem; }
  /* a phone: each world a row, the scrap beside its words */
  .at-worlds, .at-panel[data-level="e3"] .at-worlds { grid-template-columns: 1fr; gap: 1.5rem; }
  .at-vignette { grid-template-columns: 36% minmax(0, 1fr); }
  .at-vignette h3 { margin-top: 0.1rem; font-size: 1.1rem; }
  .at-vignette p { font-size: 0.92rem; line-height: 1.7; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-plane.is-moving { transition: none; }
  .jh-atlas, .jh-atlas-more, .atlas-cut, .atlas-tip { transition: none; }
  .atlas-piece.is-named .atlas-name, .atlas-piece.is-named .atlas-label { transition: none; }
  .js .at-panel { transition: opacity 0.2s ease; }
  .at-panel .at-panel-head, .at-panel .at-vignette { animation: none !important; }
  .at-scrap { transition: none; }
}

/* the home page's map is a door to the atlas page */
.world-map-container.is-door { cursor: pointer; }

/* Only text can be highlighted (2026-11-13): the map is a painting, its
   names and labels are lettering on it, so none of it lights up when a
   visitor drags across the page or presses Cmd+A. */
.atlas-view, .atlas-piece { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
