/* 街 The world. A sticky frame with the city plate, a left-to-right shade so the copy reads,
   the jade relic on the right and a field-note card. On desktop it opens over the hero through the
   dawn iris (see chapters.css). What carries it into the roster is in beat.css. */

.world {
  position: relative;
  height: 175svh;
}
.world-frame {
  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 650px;
  overflow: clip;
  background: var(--surface-world);
}
.world-art {
  position: absolute;
  inset: -8%; /* 16% larger than the frame, so the plate can drift without showing an edge */
  width: 116%;
  height: 116%;
  max-width: none;
  object-fit: cover;
  filter: saturate(0.75);
  will-change: transform;
}
.world-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #0a100bea, #0a100b77 50%, #0a100b08), linear-gradient(0deg, #111510e0, transparent 40%);
}
.world-mark {
  position: absolute;
  top: 118px;
  left: var(--pad);
  z-index: 3;
}

/* ---------- Copy: each paragraph is unmasked from the bottom up ---------- */
.world-copy {
  position: absolute;
  top: 27%;
  left: var(--pad);
  max-width: 780px;
  z-index: 2;
}
.world-copy p {
  max-width: 360px;
  margin-top: 24px;
  color: #d0d3c2;
}
.world-copy h2 + p {
  margin-top: 34px;
}
.world-copy > p {
  clip-path: inset(0 0 var(--copy-cut, 0%) 0);
  transform: translateY(var(--copy-y, 0px));
}
.world-note {
  position: absolute;
  right: var(--pad);
  bottom: 90px;
  z-index: 2;
  max-width: 245px;
  border-left: 2px solid var(--shu);
  padding-left: 20px;
  clip-path: inset(0 var(--note-cut, 0%) 0 0); /* wipes in from the left */
  transform: translateX(var(--note-x, 0px));
}
.world-note .label {
  color: var(--shu-light);
}
.world-note strong {
  display: block;
  margin: 8px 0 10px;
  font: 800 var(--text-line) / 1 var(--font-display);
}
.world-note p:last-child {
  font-size: var(--text-small);
  color: #bcc2ae;
}

/* ---------- The relic: a WebGL canvas over an SVG fallback ---------- */
.world-relic {
  position: absolute;
  right: 7.7%;
  top: 21.5%;
  z-index: 1;
  width: clamp(290px, 32vw, 480px);
  height: clamp(390px, 57svh, 610px);
  margin: 0;
  isolation: isolate;
  pointer-events: none;
}
.world-relic-canvas,
.world-relic-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.world-relic-canvas {
  opacity: 0;
  transition: opacity 0.4s;
}
.world-relic.ready .world-relic-canvas {
  opacity: 1;
}
.world-relic.ready .world-relic-fallback {
  visibility: hidden;
}
.relic-aura {
  position: absolute;
  inset: 12% 6% 15%;
  z-index: -1;
  background: radial-gradient(ellipse, #0c241dc2, transparent 69%);
  filter: blur(15px);
}
/* ---------- Tablet and short screens ---------- */
@media (max-width: 1100px) and (min-width: 761px) {
  .world-relic {
    right: 3%;
    top: 22%;
    width: 36vw;
    height: 50svh;
  }
}
@media (min-width: 761px) and (max-height: 760px) {
  .world-frame {
    min-height: 600px;
  }
  .world-copy {
    top: 27%;
  }
  .world-copy p {
    margin-top: 18px;
  }
}

/* ---------- Phone: the world flows instead of pinning ---------- */
@media (max-width: 760px) {
  .world {
    height: auto;
  }
  .world-frame {
    position: relative;
    height: auto;
    min-height: 0;
    padding: 1px 0 40px;
  }
  .world-mark {
    top: 96px;
  }
  .world-art {
    width: 165%;
    left: -35%;
    object-position: center;
  }
  .world-copy {
    position: relative;
    top: auto;
    left: auto;
    max-width: none;
    margin: 165px 22px 0;
  }
  .world-copy p {
    max-width: 320px;
  }
  .world-relic {
    position: relative;
    inset: auto;
    width: 290px;
    height: 365px;
    margin: 10px auto 32px;
  }
  .world-note {
    position: relative;
    inset: auto;
    margin: 0 22px 70px;
    max-width: none;
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    column-gap: 20px;
    align-items: center;
  }
  .world-note strong {
    grid-column: 1;
    margin: 5px 0;
  }
  .world-note p:last-child {
    grid-column: 2;
    grid-row: 1 / 3;
  }
}

/* ---------- Reduced motion ---------- */
html:is(.reduced, .compact-layout) .world {
  height: auto;
}
html:is(.reduced, .compact-layout) .world-art {
  transform: none !important;
}
html:is(.reduced, .compact-layout) main :is(.world-note, .world-copy > p) {
  transform: none !important;
  clip-path: none !important;
  opacity: 1 !important;
}
@media (min-width: 761px) {
  html:is(.reduced, .compact-layout) .world-frame {
    position: relative;
    height: 100svh;
  }
}
