/* ==========================================================================
   Parklane — Five-Step Process
   Visual relief after the visualizer: warm ivory, one continuous horizontal
   sequence joined by a brass rail. Stacks vertically on phones.
   ========================================================================== */

.process {
  --rail-y: 1.9rem;               /* rail sits under the stage numbers */
  --rail: var(--c-brass);
  --divider: rgba(169, 138, 82, 0.34);
  --stage-gap: clamp(2rem, 0.8rem + 2.8vw, 4rem);
  background: var(--c-ivory);
  color: var(--c-ink);
}

.process .eyebrow {
  color: var(--c-bronze);
}

/* Intro --------------------------------------------------------------------- */

.process__head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: var(--s-7);
  align-items: end;
  margin-bottom: clamp(3.5rem, 2rem + 4vw, 6rem);
}

.process__head .heading-section span {
  display: block;
}

.process__intro {
  max-width: 21rem;
  justify-self: end;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--c-ink-muted);
}

/* Sequence ------------------------------------------------------------------ */

.process__track:focus-visible {
  outline-offset: 8px;
}

.process__stages {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: var(--stage-gap);   /* equal columns; dividers sit centred in the gaps */
}

/* The brass rail runs the full sequence and draws itself in on reveal */
.process__stages::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--rail-y);
  height: 1px;
  background: var(--rail);
  transform-origin: left center;
  transform: scaleX(1);
}

.js .process__stages[data-reveal] {
  opacity: 1;
  transform: none;
}

.js .process__stages[data-reveal]::before {
  transform: scaleX(0);
  transition: transform 2400ms var(--ease) 200ms;
}

.js .process__stages[data-reveal].is-visible::before {
  transform: scaleX(1);
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  align-content: start;
  padding-bottom: var(--s-2);
}

/* Vertical divider from the rail down, with a tick crossing the rail */
.stage + .stage::after,
.stage + .stage::before {
  content: "";
  position: absolute;
  left: calc(var(--stage-gap) / -2);
  width: 1px;
}

.stage + .stage::after {
  top: 0;
  bottom: 0;
  background: var(--divider);
}

.stage + .stage::before {
  top: calc(var(--rail-y) - 5px);
  height: 11px;
  background: var(--rail);
}

.stage__num {
  display: block;
  height: var(--rail-y);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--c-bronze);
}

/* Stage visual: a drafting sketch printed on a smoked-glass pane, held off a
   limestone ground on four small stand-offs. Pure CSS + inline SVG. */
.stage__visual {
  position: relative;
  margin: var(--s-6) 0 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  /* limestone ground, lit softly from the upper left */
  background:
    radial-gradient(120% 90% at 18% 8%, rgba(255, 252, 244, 0.55) 0%, rgba(255, 252, 244, 0) 55%),
    linear-gradient(90deg, transparent 63%, rgba(120, 106, 84, 0.28) 63%, rgba(120, 106, 84, 0.28) calc(63% + 1px), transparent calc(63% + 1px)),
    linear-gradient(180deg, transparent 58%, rgba(120, 106, 84, 0.24) 58%, rgba(120, 106, 84, 0.24) calc(58% + 1px), transparent calc(58% + 1px)),
    linear-gradient(180deg, #e3dccd 0%, #d4cab6 100%);
}

/* Stone grain + faint mottling in the ground */
.stage__visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .27 0 0 0 0 .22 0 0 0 .24 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 160px 160px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .03' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .32 0 0 0 0 .25 0 0 0 .7 -.36'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E") 0 0 / 420px 420px;
  pointer-events: none;
}

/* The pane: lightly smoked, matte, with a lit top/left arris and a darker
   lower/right edge; its thickness shows as a narrow offset band. */
.stage__glass {
  position: absolute;
  inset: 8% 10% 12% 10%;
  z-index: 1;
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 32%),
    linear-gradient(180deg, rgba(244, 241, 233, 0.12) 0%, rgba(188, 186, 172, 0.1) 100%),
    rgba(92, 98, 88, 0.045);                      /* faint smoke */
  -webkit-backdrop-filter: blur(1.6px) saturate(0.9);
  backdrop-filter: blur(1.6px) saturate(0.9);    /* diffuses the stone seen through the pane */
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.9),
    inset -1px -1px 0 rgba(96, 104, 92, 0.35),
    2px 3px 0 rgba(150, 158, 140, 0.34),          /* glass edge thickness */
    3px 4px 0 rgba(110, 104, 88, 0.12),
    /* cast onto the stone: soft and broad, distance set by --depth */
    calc(var(--depth) * 1.2) calc(var(--depth) * 1.8) calc(var(--depth) * 3) calc(var(--depth) * -0.6) rgba(64, 52, 36, 0.2),
    3px 5px 12px rgba(64, 52, 36, 0.07);
}

/* Slight depth variation along the row: each pane stands a little further
   from or nearer to the stone. Alignment is untouched. */
.stage:nth-child(1) .stage__glass { --depth: 14px; }
.stage:nth-child(2) .stage__glass { --depth: 19px; }
.stage:nth-child(3) .stage__glass { --depth: 12px; }
.stage:nth-child(4) .stage__glass { --depth: 17px; }
.stage:nth-child(5) .stage__glass { --depth: 15px; }

/* Brass stand-off pins: small, flat, quiet */
.stage__glass::before {
  content: "";
  position: absolute;
  inset: 7px;
  --pin: radial-gradient(circle, rgba(158, 132, 88, 0.85) 0 1.3px, transparent 1.7px);
  background:
    var(--pin) 0 0 / 4px 4px no-repeat,
    var(--pin) 100% 0 / 4px 4px no-repeat,
    var(--pin) 0 100% / 4px 4px no-repeat,
    var(--pin) 100% 100% / 4px 4px no-repeat;
  pointer-events: none;
}

/* The printed sketch, plus its soft shadow falling on the stone behind —
   which is what makes it read as suspended in the glass */
.stage__glass svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(calc(var(--depth) * 0.45) calc(var(--depth) * 0.65) 2px rgba(70, 58, 40, 0.13));
}

.stage__title {
  margin-top: var(--s-5);
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 1.2rem + 0.7vw, 1.875rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: var(--tracking-heading);
}

.stage__text {
  margin-top: var(--s-3);
  max-width: 16rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--c-ink-muted);
}

/* Tablet: the sequence stays continuous and scrolls horizontally -------------- */

@media (min-width: 641px) and (max-width: 1024px) {
  .process__head {
    grid-template-columns: 1fr;
    gap: var(--s-5);
  }

  .process__intro {
    justify-self: start;
  }

  .process__track {
    margin-inline: calc(var(--gutter) * -1);
    padding: 0 var(--gutter) var(--s-5);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: thin;
    scrollbar-color: var(--divider) transparent;
  }

  .process__stages {
    grid-template-columns: repeat(5, minmax(15rem, 38vw));
    width: max-content;
  }

  .stage {
    scroll-snap-align: start;
  }
}

/* Phone: stacked, with the brass rail running down the left ------------------ */

@media (max-width: 640px) {
  .process__head {
    grid-template-columns: 1fr;
    gap: var(--s-5);
    margin-bottom: var(--s-7);
  }

  .process__intro {
    justify-self: start;
  }

  .process__stages {
    grid-template-columns: 1fr;
    row-gap: var(--s-8);
  }

  .process__stages::before {
    left: 1.125rem;
    right: auto;
    top: 0.75rem;
    bottom: 0;
    width: 1px;
    height: auto;
    transform-origin: center top;
  }

  .js .process__stages[data-reveal]::before {
    transform: scaleY(0);
  }

  .js .process__stages[data-reveal].is-visible::before {
    transform: scaleY(1);
  }

  .stage {
    grid-template-columns: 3.5rem minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas:
      "num title"
      "num text"
      "num visual";
    padding: 0;
  }

  .stage + .stage::before,
  .stage + .stage::after {
    display: none;
  }

  .stage__num {
    grid-area: num;
    position: relative;
    align-self: start;
    width: 2.25rem;
    height: auto;
    padding: 0.375rem 0;
    background: var(--c-ivory);   /* the rail passes behind the number */
    text-align: center;
    font-size: 1.375rem;
  }

  .stage__title {
    grid-area: title;
    margin-top: 0;
    font-size: 1.875rem;
  }

  .stage__text {
    grid-area: text;
    max-width: 22rem;
  }

  /* Image fragment stays secondary: a shallow strip beneath the copy */
  .stage__visual {
    grid-area: visual;
    margin-top: var(--s-5);
    aspect-ratio: 16 / 9;
  }

  /* A true 4:5 pane stands centred in the shallow strip, so no sketch is cropped */
  .stage__glass {
    inset: 9% auto 13%;
    left: 50%;
    aspect-ratio: 4 / 5;
    transform: translateX(-50%);
  }

  .stage__glass::before {
    inset: 5px;
  }

  .stage__glass { --depth: 10px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .js .process__stages[data-reveal]::before {
    transform: none;
    transition: none;
  }
}
