/* SCENE 04 — LAND AGGREGATION AT THE CORE (bone, #aggregation).
   Everything reads complete without JS: parcels merged, perimeter
   drawn, list visible. Hidden/initial motion states are set only in
   the non-static branch of js/scenes/s04.js. */

.s04 { padding-block: 160px 150px; }

/* ---------- head: eyebrow, headline, brightening opening ---------- */

.s04-h2 {
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  max-width: 16ch;
}

.s04-opening {
  margin-top: var(--rhythm-headline);
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 330;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.55;
  letter-spacing: .002em;
  color: color-mix(in srgb, var(--ink) 90%, transparent);
  max-width: 46ch;
}
.s04-phrase { display: inline; }

/* ---------- the parcel assembly stage ---------- */

.s04-stage {
  position: relative;
  margin-top: 120px;
  overflow: hidden;
}

/* ambient survey layer: 20% opacity, counter-speed drift (JS).
   the -12% vertical bleed absorbs the drift without exposing edges */
.s04-ambient {
  position: absolute;
  inset: -12% 0;
  opacity: .2;
  pointer-events: none;
}

.s04-stage__inner {
  position: relative;
  width: 100%;
}

.s04-canvas { position: relative; }
.s04-svg { width: 100%; height: auto; }

/* parcel boundaries: earth survey lines on bone. The static default is
   the merged, settled state; the motion build raises them to .95 while
   each parcel is the active one. */
.s04-parcel {
  fill: none;
  stroke: var(--earth);
  stroke-width: 1.2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke; /* survey-line law: true 1px at any scale */
  opacity: .35;
}

/* the ONE bounded plot: bold gradient perimeter over a 5% earth wash */
.s04-plot {
  fill: var(--earth);
  fill-opacity: .05;
  stroke: url(#s04-grad);
  stroke-width: 2.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.s04-grad__a { stop-color: var(--gold); }
.s04-grad__b { stop-color: var(--earth); }


/* ---------- the condensed ruled list ---------- */

.s04-row { padding-bottom: 14px; }
.s04-row .s04-lrule { margin-bottom: 12px; }

.s04-row__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.s04-row__num {
  flex: none;
  font-size: .6rem;
  font-weight: 300;
  letter-spacing: .22em;
  color: var(--earth);
}
.s04-row__title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 340;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--ink);
}
.s04-row__line {
  margin-top: 5px;
  font-size: .72rem;
  line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 60%, transparent);
  max-width: 38ch;
}

/* ---------- signature close ---------- */

.s04-close { margin-top: 150px; }
.s04-signature {
  font-style: italic;
  font-weight: 320;
  font-size: clamp(1.7rem, 3.4vw, 2.9rem);
  max-width: 22ch;
  color: var(--ink);
}

/* ---------- desktop: the pinned viewport ---------- */

@media (min-width: 900px) {
  .s04-stage {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding-block: 48px;
  }
  .s04-stage__inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: calc(var(--gutter) * 2);
    align-items: center;
  }
  .s04-left { position: relative; }
  .s04-list { position: absolute; inset: auto 0; top: 50%; transform: translateY(-50%); }
}

/* short desktop viewports: keep the ruled list inside the pin */
@media (min-width: 900px) and (max-height: 760px) {
  .s04-row { padding-bottom: 8px; }
  .s04-row .s04-lrule { margin-bottom: 8px; }
  .s04-row__line { font-size: .66rem; }
  .s04-row__title { font-size: .95rem; }
}

/* ---------- mobile: unpinned simplified sequence ---------- */

@media (max-width: 899px) {
  .s04 { padding-block: 120px 96px; }
  .s04-active { display: none; }
  .s04-left { position: static; }
  .s04-list { position: static; transform: none; }
  .s04-stage { margin-top: 72px; }
  .s04-stage__inner { display: block; }
  .s04-list { margin-top: 56px; }
  .s04-close { margin-top: 96px; }
}

/* WebGL layer (round 3): the 3D assembly replaces the SVG on desktop
   motion builds; the SVG stays as the static/mobile/no-WebGL fallback */
.s04-gl {
  position: absolute;
  inset: 0;
  display: block;
}
.s04--gl .s04-svg { visibility: hidden; }


/* ---------- the active-service panel (round 6 redesign) ---------- */

.s04-active { max-width: 420px; }
.s04-active__num {
  display: block;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 340;
  font-size: clamp(2.4rem, 3.6vw, 3.4rem);
  line-height: 1;
  color: color-mix(in srgb, var(--earth) 42%, transparent);
}
.s04-active__rule { width: 44px; margin-block: 18px 22px; }
.s04-active__title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 340;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  line-height: 1.2;
  color: var(--ink);
  max-width: 16ch;
}
.s04-active__line {
  margin-top: 16px;
  font-size: .9rem;
  line-height: 1.65;
  color: color-mix(in srgb, var(--ink) 64%, transparent);
  max-width: 36ch;
}
.s04-progress {
  margin-top: 40px;
  display: flex;
  gap: 8px;
}
.s04-progress span {
  flex: 1;
  height: 1px;
  background: rgba(156, 85, 51, .22);
  transition: background-color .3s var(--ease);
}
.s04-progress span.is-on { background: var(--earth); }

body.is-static .s04-active { display: none; }
body.is-static .s04-list { position: static; transform: none; }
