/* Process section: floor plan into a 3D house (js/plan3d.js).
   A tall track with a sticky 100svh panel. Everything inside the panel is absolutely placed, so
   nothing can be taller than the panel (no iPad scroll trap). Captions share one grid cell. */

.process { padding: 0; }
/* the drawing paper fades in and out of the aurora instead of meeting it at a hard edge */
.process::before, .process::after { content: ""; position: absolute; left: 0; right: 0; z-index: 2; height: min(12svh, 5rem); pointer-events: none; }   /* never taller than the space beside it */
.process::before { bottom: calc(100% - 1px); background: linear-gradient(transparent, var(--paper)); }
.process::after { top: calc(100% - 1px); background: linear-gradient(var(--paper), transparent); }
html:not(.js) .process::before, html:not(.js) .process::after { display: none; }
/* 540svh: the spiral gets about three screens of scrolling, so it turns at an even, unhurried pace */
.process__track { position: relative; height: 540svh; }
.process__panel { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--paper); }
.process__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.process__fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(var(--nav-h) + 7rem) var(--gutter) 11rem; color: var(--ink); }
.process__fallback[hidden] { display: none; }
.process__fallback svg { width: 100%; height: 100%; font-family: var(--caps); }

.process__head {
  position: absolute; z-index: 2; pointer-events: none;
  left: max(var(--gutter), env(safe-area-inset-left));
  top: calc(var(--nav-h) + clamp(1rem, 4svh, 3rem));
  width: min(30rem, 34vi);
}
.process__head .title { max-width: 12ch; }

.process__caps {
  position: absolute; z-index: 2;
  left: max(var(--gutter), env(safe-area-inset-left));
  bottom: calc(clamp(1.5rem, 6svh, 4rem) + env(safe-area-inset-bottom));
  width: min(30rem, 38vi); padding: clamp(1.1rem, 2.2vi, 1.6rem) clamp(1.2rem, 2.4vi, 1.8rem); border-radius: var(--radius);
}
/* the captions sit on frosted glass (.glass-panel in site.css), so the house blurs softly behind the words */
/* three stage tiles: always all visible, the current one lit in maroon, each one a button that goes there */
.process__hint { margin: 0 0 .75rem; font: 500 var(--step-caption)/1.4 var(--sans); color: var(--ink-2); }
.process__stages { display: grid; gap: .5rem; }
.stage {
  position: relative; display: grid; gap: .25rem; width: 100%; min-height: 72px; margin: 0; padding: .9rem 1rem .9rem 1.4rem;
  border: 0; border-radius: calc(var(--radius) * .75); cursor: pointer; text-align: left; font: inherit; color: var(--ink);
  background: transparent; -webkit-tap-highlight-color: transparent; transition: background-color .3s var(--ease), box-shadow .3s var(--ease);
}
.stage__bar { position: absolute; left: .6rem; top: .95rem; bottom: .95rem; width: 3px; border-radius: 3px; background: var(--rule); transition: background-color .3s var(--ease); }
.stage__name { font: 500 clamp(1.6rem, 1.25rem + 1vi, 2.25rem)/1.02 var(--display); letter-spacing: -.01em; color: var(--ink-2); transition: color .3s var(--ease); }
.stage__line { font: 400 var(--step-body)/1.4 var(--sans); color: var(--ink-2); }
.stage.is-on { background: var(--surface); box-shadow: var(--glass-clear-light); }
.stage.is-on .stage__bar { background: var(--accent); }
.stage.is-on .stage__name { color: var(--ink); }
.stage:active { background: var(--veil-on-light); }
@media (hover: hover) and (pointer: fine) { .stage:not(.is-on):hover { background: var(--veil-on-light); } }
.process__line { display: none; margin: .75rem 0 0; font: 400 var(--step-lead)/1.45 var(--sans); color: var(--ink-2); }

/* tall shapes (portrait phones and tablets): heading on top, captions at the bottom, house between */
@media (max-aspect-ratio: 23/20) {
  .process__head, .process__caps { width: auto; right: max(var(--gutter), env(safe-area-inset-right)); }
  .process__stages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .stage { min-height: 56px; padding: 1.05rem .5rem .7rem; justify-items: center; text-align: center; }
  .stage__bar { left: 1rem; right: 1rem; top: .45rem; bottom: auto; width: auto; height: 3px; }
  .stage__name { font-size: clamp(1.25rem, 4.6vi, 1.75rem); }
  .stage__line { display: none; }
  .process__line { display: block; }
}

/* without scripts (or if main.js fails, see quality-boot.js): a plain section with the three steps in a column */
html:not(.js) .process__track { height: auto; }
html:not(.js) .process__panel { position: relative; height: auto; display: grid; gap: 2rem; padding: var(--section) var(--gutter); }
html:not(.js) .process__canvas, html:not(.js) .process__hint { display: none; }
html:not(.js) .process__head, html:not(.js) .process__caps { position: static; width: auto; }

@media (prefers-reduced-motion: reduce) {
  .stage, .stage__bar, .stage__name { transition: none; }
}
@media (prefers-contrast: more) {
  .stage__bar { background: var(--ink-2); }
}
