/* ==========================================================================
   ARCHITECTURE — "Architecture, annotated". One held scene, three acts,
   scrubbed by scroll (js/arch-band.js):
     1  a gallery of the development's spaces floats in depth around a gold
        window; the camera flies forward through it and the window opens
     2  inside, the tower's drawing becomes the lit building behind a rising
        gold build-line
     3  the six figures arrive as an architect's annotations, gold leader lines
        drawn to the parts of the building they describe, numbers counting up
   The module writes the per-frame geometry as custom properties on
   .arc__stage; everything here reads them.
   ========================================================================== */

.arc {
  position: relative;
  height: 520vh;
  background: #071324;
  color: var(--c-ivory);
  overflow: clip;                 /* clip, not hidden: hidden would break sticky */
}

/* the gold seam where the section begins: it follows the map, another dark
   scene, so the line is the break between them */
.arc::before {
  content: "";
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold) 30%, #f3dfae 50%, var(--c-gold) 70%, transparent);
  opacity: .7;
  pointer-events: none;
}

.arc__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 90% at 50% 60%, #0f2740 0%, #071324 60%, #040d18 100%);
}

/* --- act 1: the gallery ----------------------------------------------------- */
.arc__gallery {
  position: absolute;
  inset: 0;
  z-index: 3;
  perspective: 1100px;
  pointer-events: none;
}
.arc__panel {
  --pnl: clamp(260px, 30vw, 560px);   /* panel width (before depth scales it); --pw is the tower plate */
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--pnl);
  aspect-ratio: 1.3;
  margin: calc(var(--pnl) / -2.6) 0 0 calc(var(--pnl) / -2);
  overflow: hidden;
  border-radius: var(--r-card);
  border: 1px solid rgb(208 173 103 / .35);
  box-shadow: 0 30px 80px rgb(0 0 0 / .45);
  background: #0b1f33;
  opacity: 0;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.arc__panel img { width: 100%; height: 100%; object-fit: cover; }

.arc__word {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  top: var(--word-top, 60%);
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  opacity: var(--word-o, 1);
}
.arc__word-track {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  font-family: var(--font-display);
  font-size: clamp(88px, 14vw, 260px);
  font-weight: var(--fw-medium);
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--c-ivory);
  text-shadow: 0 4px 40px rgb(var(--scrim) / .55);
  translate: var(--word-x, 0) 0;
  will-change: translate;
}
.arc__word-track i {
  width: .12em;
  height: .12em;
  border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 18px rgb(208 173 103 / .8);
}
.arc__word-track em { font-style: italic; color: var(--c-gold); }

/* --- the window and the tower -------------------------------------------- */
.arc__tower {
  position: absolute;
  inset: 0;
  z-index: 1;
  clip-path: inset(var(--wt, 25%) var(--wr, 35%) var(--wb, 25%) var(--wl, 35%) round var(--wrad, 12px));
  background: #0a1a2c;
}
.arc__plate {
  position: absolute;
  left: var(--px, 0);
  top: var(--py, 0);
  width: var(--pw, 100%);
  height: var(--ph, 100%);
  scale: var(--zoom, 1);
}
.arc__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.arc__img--lit { clip-path: inset(var(--lit, 100%) 0 0 0); }

/* the gold build-line riding the edge of the lit reveal */
.arc__scan {
  position: absolute;
  left: var(--px, 0);
  width: var(--pw, 100%);
  top: var(--scan-y, 100%);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--c-gold) 15%, #f3dfae 50%, var(--c-gold) 85%, transparent);
  box-shadow: 0 0 24px 4px rgb(208 173 103 / .55);
  opacity: var(--scan-o, 0);
}

.arc__frame {
  position: absolute;
  z-index: 2;
  left: var(--fl, 35%);
  top: var(--ft, 25%);
  width: var(--fw, 30%);
  height: var(--fh, 50%);
  border: 1px solid rgb(208 173 103 / .7);
  border-radius: var(--wrad, 12px);
  box-shadow: 0 0 0 1px rgb(208 173 103 / .12), 0 0 60px rgb(208 173 103 / .18);
  opacity: var(--frame-o, 1);
  pointer-events: none;
}
/* drafting ticks at the corners */
.arc__frame i { position: absolute; width: 18px; height: 18px; border-color: var(--c-gold); border-style: solid; border-width: 0; }
.arc__frame i:nth-child(1) { left: -10px;  top: -10px;    border-left-width: 1px;  border-top-width: 1px; }
.arc__frame i:nth-child(2) { right: -10px; top: -10px;    border-right-width: 1px; border-top-width: 1px; }
.arc__frame i:nth-child(3) { left: -10px;  bottom: -10px; border-left-width: 1px;  border-bottom-width: 1px; }
.arc__frame i:nth-child(4) { right: -10px; bottom: -10px; border-right-width: 1px; border-bottom-width: 1px; }

/* legibility for the annotation columns; the picture is never dimmed */
.arc__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: var(--shade-o, 0);
  background:
    linear-gradient(to right, rgb(var(--scrim) / .72), transparent 30%, transparent 70%, rgb(var(--scrim) / .72)),
    linear-gradient(to bottom, rgb(var(--scrim) / .55), transparent 20%);
}

/* --- act 3: the annotations ---------------------------------------------- */
.arc__lines {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.arc__ln path {
  fill: none;
  stroke: var(--c-gold);
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .9s cubic-bezier(.65, 0, .35, 1);
}
.arc__ln .dot   { fill: var(--c-gold); opacity: 0; transition: opacity .4s var(--ease-css) .7s; }
.arc__ln .ring  { fill: none; stroke: var(--c-gold); stroke-width: 1; opacity: 0; transform-box: fill-box; transform-origin: center; }
.arc__ln.is-on path { stroke-dashoffset: 0; }
.arc__ln.is-on .dot { opacity: 1; }
.arc__ln.is-on .ring { animation: arc-ring 2.4s ease-out 1s infinite; }
@keyframes arc-ring {
  0%   { opacity: .9; scale: 1; }
  100% { opacity: 0;  scale: 3.2; }
}

.arc__ui {
  position: absolute;
  inset: 0;
  z-index: 6;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(250px, 300px);
  grid-template-rows: auto repeat(3, minmax(0, 1fr));
  column-gap: var(--sp-lg);
  padding-block: clamp(92px, 11vh, 128px) clamp(28px, 4vh, 48px);
  pointer-events: none;
}

.arc__head {
  grid-column: 1;
  grid-row: 1;
  opacity: var(--head-o, 0);
  translate: 0 calc((1 - var(--head-o, 0)) * 16px);
}
.arc__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-gold);
}
.arc__eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.arc__h {
  margin-block-start: 8px;
  font-family: var(--font-display);
  font-size: clamp(36px, 3.2vw, 56px);
  font-weight: var(--fw-medium);
  line-height: 1.05;
  letter-spacing: -.015em;
}

.arc__progress {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  color: var(--c-mist);
  opacity: var(--head-o, 0);
}
.arc__progress b { color: var(--c-gold); font-weight: var(--fw-bold); }

.arc__stats { display: contents; }
.arc__stat { align-self: center; }
.arc__stat:nth-child(odd)  { grid-column: 1; }
.arc__stat:nth-child(even) { grid-column: 3; }
.arc__stat:nth-child(1), .arc__stat:nth-child(2) { grid-row: 2; }
.arc__stat:nth-child(3), .arc__stat:nth-child(4) { grid-row: 3; }
.arc__stat:nth-child(5), .arc__stat:nth-child(6) { grid-row: 4; }

/* The card animates; the list item holds still so the leader lines can be
   measured from it while the card is still rising. */
.arc__card {
  padding: 16px 18px 15px;
  border: 1px solid rgb(208 173 103 / .22);
  border-radius: var(--r-card);
  background: rgb(var(--scrim) / .62);
  backdrop-filter: blur(12px);
  opacity: 0;
  translate: 0 16px;
  transition: opacity .7s var(--ease-css), translate .8s var(--ease-css), border-color .5s var(--ease-css);
}
.arc__stat.is-on .arc__card { opacity: 1; translate: 0 0; border-color: rgb(208 173 103 / .45); box-shadow: inset 0 2px 0 var(--c-gold); }

.arc__idx { font-size: 10px; font-weight: var(--fw-bold); letter-spacing: .16em; color: var(--c-gold); }
.arc__fig {
  margin-block-start: 4px;
  font-family: var(--font-display);
  font-size: clamp(32px, 2.6vw, 44px);
  font-weight: var(--fw-medium);
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1.05;
  letter-spacing: -.01em;
}
.arc__fig small { font-size: .55em; margin-inline-start: .18em; color: var(--c-ivory); }
.arc__unit {
  margin-block-start: 6px;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-gold);
}
.arc__note { margin-block-start: 6px; font-size: var(--fs-small); line-height: 1.5; color: var(--c-mist); }

/* --- narrow: the tower on a plate at the top, one figure at a time -------- */
@media (max-width: 959px) {
  .arc { height: 470vh; }
  .arc__panel { --pnl: clamp(220px, 62vw, 380px); }
  .arc__word-track { font-size: clamp(72px, 22vw, 140px); }
  .arc__plate {
    -webkit-mask-image: radial-gradient(75% 70% at 50% 45%, #000 60%, transparent 100%);
            mask-image: radial-gradient(75% 70% at 50% 45%, #000 60%, transparent 100%);
  }
  .arc__shade { background: linear-gradient(to top, rgb(var(--scrim) / .85), transparent 45%), linear-gradient(to bottom, rgb(var(--scrim) / .5), transparent 18%); }

  .arc__ui {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr auto;
    padding-block: 88px 24px;
  }
  .arc__head { grid-column: 1; grid-row: 1; }
  .arc__progress { grid-column: 2; grid-row: 1; }
  .arc__stat,
  .arc__stat:nth-child(n) { grid-column: 1 / -1; grid-row: 3; align-self: end; }
  .arc__stat .arc__card { opacity: 0; translate: 0 16px; }
  .arc__stat.is-current .arc__card { opacity: 1; translate: 0 0; border-color: rgb(208 173 103 / .45); box-shadow: inset 0 2px 0 var(--c-gold); }
  .arc__stat.is-on:not(.is-current) .arc__card { opacity: 0; translate: 0 -12px; }
}

/* --- reduced motion: the finished, annotated building, still --------------- */
.arc--static { height: auto; }
.arc--static .arc__stage { position: relative; height: 100vh; min-height: 720px; }
.arc--static .arc__gallery,
.arc--static .arc__word { display: none; }

@media (prefers-reduced-motion: reduce) {
  .arc__card,
  .arc__ln path,
  .arc__ln .dot { transition: none; }
  .arc__ln.is-on .ring { animation: none; }
}
