/*
 * Homepage — final stage ("Explore KiwiTile" → gateways → closing → footer).
 *
 * Structure:
 *   .final-stage                       oxidised olive-bronze stone stage
 *     .final-stage__background         the stone (sticky on desktop)
 *     .final-stage__content
 *       .final-stage__title-card       "Explore KiwiTile" artwork card
 *       .gateway (#gallery-wall)       three gateway cards
 *       .final-closing                 "Enquire with confidence" (sticky on desktop)
 *       .final-stage__pin-scroll       scroll room while the closing stays pinned
 *     .page-end                        dark stone wrapper around the site footer
 *
 * Desktop pinning: the stone background is `position: sticky` and the
 * content is pulled up over it (margin-top: -100svh), so the stone stays
 * fixed for the whole stage. The closing statement is sticky inside the
 * content and is held for --kt-footer-pin-scroll (set by
 * js/home/final-stage.js from the footer height) while .page-end slides
 * up over it.
 *
 * Mobile experience (≤900px or compact touch landscape): everything is in
 * normal flow and the stone is an absolute cover layer behind the section.
 */

.final-stage {
  --kt-footer-pin-sticky-top: clamp(260px, 40vh, 430px);
  --kt-footer-pin-scroll: clamp(120px, 20vh, 240px);
  --stage-rail: 80vw;
  --stage-frame: rgb(224 163 83 / 0.92);
  --stage-radius: 8px;
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Hairline gold edge where the stage meets the charcoal zone. */
.final-stage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  height: 1px;
  background: var(--stage-frame);
  pointer-events: none;
}

.final-stage__background {
  position: sticky;
  top: 0;
  z-index: 0;
  width: 100%;
  height: 100svh;
  min-height: 100vh;
  background: url("../../images/kiwitile-oxidised-olive-bronze-stone.webp") center / 100% 100% no-repeat;
  filter: brightness(0.42) saturate(0.78) hue-rotate(10deg) sepia(0.4) contrast(1.06);
  pointer-events: none;
}

.final-stage__content {
  position: relative;
  z-index: 1;
  margin-top: -100svh;
}

.final-stage__pin-scroll {
  height: var(--kt-footer-pin-scroll);
  pointer-events: none;
}

/* ── "Explore KiwiTile" title card ──
   Desktop and tablets show a pre-composed artwork; the live heading stays
   underneath (transparent) for accessibility and as the fallback. */

.final-stage__title-card {
  display: grid;
  place-content: center;
  width: 100%;
  min-height: 100svh;
  padding: clamp(96px, 10vw, 160px) clamp(24px, 7vw, 120px);
  text-align: center;
}

.final-stage__title-card-inner {
  position: relative;
  width: 80vw;
  max-width: none;
  margin-inline: auto;
  padding: clamp(34px, 5vw, 72px) clamp(22px, 5vw, 72px);
  overflow: hidden;
  background: url("../../images/kiwitile-oxidised-inner-olive-bronze-stone.webp") center / cover no-repeat;
  border: 1px solid transparent;
  box-shadow:
    0 32px 90px rgb(0 0 0 / 0.5),
    inset 0 1px 0 rgb(255 255 255 / 0.05);
}

/* One sharp frame above the artwork, independent of its crop. */
.final-stage__title-card-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 1px solid var(--stage-frame);
  pointer-events: none;
}

.final-stage__preview,
.final-stage__preview-mobile {
  display: none;
}

.final-stage__title {
  max-width: 980px;
  margin: 0 auto;
  color: rgb(238 202 142 / 0.94);
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.8vw, 72px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.08),
    0 24px 74px rgb(0 0 0 / 0.68);
}

.final-stage__rule {
  width: 72%;
  height: 1px;
  min-height: 1px;
  margin: clamp(18px, 1.53vw, 26px) auto clamp(18px, 1.67vw, 28px);
  background: linear-gradient(90deg, transparent, rgb(214 164 91 / 0.72), transparent);
}

.final-stage__subtitle {
  max-width: 980px;
  margin: 0 auto;
  color: rgb(224 178 108 / 0.92);
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.5vw, 38px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0.06em;
  text-wrap: balance;
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.06),
    0 12px 40px rgb(0 0 0 / 0.55);
}

/* ── Gateway cards ── */

.gateway__cards {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 3.4vw, 40px);
}

.gateway-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--stage-rail);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: url("../../images/004-dt-services-card-inner-bg.webp") center / cover no-repeat;
  border: 1px solid var(--stage-frame);
  border-radius: var(--stage-radius);
  box-shadow:
    0 32px 90px rgb(0 0 0 / 0.5),
    inset 0 1px 0 rgb(255 255 255 / 0.05);
}

.gateway-card__image {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-top-left-radius: var(--stage-radius);
  border-top-right-radius: var(--stage-radius);
}

.gateway-card__media {
  position: relative;
  aspect-ratio: 1300 / 690;
  overflow: hidden;
}

/* Desktop: an invisible full-card link keeps the whole card clickable. */
.gateway-card__hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  border: 0;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

/* Gallery wall card: Matty | centre panel | Rodrigo. */
.gateway-card--gallery {
  background: #0b0907;
}

.gateway-card--gallery .gateway-card__image,
.gateway-card--gallery .gateway-card__media {
  border-radius: inherit;
}

.gallery-gateway {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  color: rgb(236 222 198 / 0.9);
  font-family: var(--font-sans);
}

.gallery-gateway__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.52fr) minmax(0, 1fr);
  gap: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.gallery-gateway__portrait {
  position: relative;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0b0907;
}

.gallery-gateway__portrait--left {
  border-radius: var(--stage-radius) 0 0 var(--stage-radius);
}

.gallery-gateway__portrait--right {
  border-radius: 0 var(--stage-radius) var(--stage-radius) 0;
}

.gallery-gateway__portrait img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  filter: sepia(0.3) saturate(1.24) contrast(0.98) brightness(0.88);
}

.gallery-gateway__portrait--left img {
  filter: sepia(0.38) saturate(1.22) contrast(0.98) brightness(0.75);
  transform: scale(1.085);
  transform-origin: center center;
}

/* Soft shadow over Matty's side of the frame. */
.gallery-gateway__portrait--left::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 42% 38% at 24% 34%, rgb(0 0 0 / 0.14), transparent 72%),
    linear-gradient(90deg, rgb(0 0 0 / 0.14) 0%, rgb(0 0 0 / 0.05) 28%, transparent 48%);
  pointer-events: none;
}

.gallery-gateway__name {
  position: absolute;
  bottom: clamp(16px, 2vw, 28px);
  left: clamp(18px, 2.2vw, 30px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(6px, 0.58vw, 9px);
  margin: 0;
  color: rgb(240 190 111 / 0.96);
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.4vw, 52px);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 8px 24px rgb(0 0 0 / 0.56);
}

.gallery-gateway__name > span {
  display: block;
}

.gallery-gateway__experience,
.gallery-gateway__role {
  font-family: var(--font-sans);
  line-height: 1;
  text-transform: uppercase;
}

.gallery-gateway__experience {
  padding-top: clamp(6px, 0.65vw, 11px);
  color: rgb(245 235 216 / 0.78);
  font-size: clamp(9.5px, 0.9vw, 13.5px);
  font-weight: 600;
  letter-spacing: clamp(0.2em, 0.28vw, 0.31em);
}

.gallery-gateway__role {
  color: rgb(224 163 83 / 0.72);
  font-size: clamp(8.5px, 0.82vw, 11.5px);
  font-weight: 700;
  letter-spacing: clamp(0.18em, 0.24vw, 0.28em);
}

/* Centre panel: warm bronze ground under the pre-composed artwork
   ("A look at the Gallery Wall"). */
.gallery-gateway__panel {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgb(181 137 77 / 0.14) 0%, rgb(120 91 52 / 0.08) 34%, transparent 68%),
    linear-gradient(180deg, #5a3f24 0%, #46351f 42%, #2f271b 100%);
}

.gallery-gateway__panel-art {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  width: 100%;
  height: 100%;
  transform: scale(1.2, 1.1);
  transform-origin: center;
  pointer-events: none;
}

.gallery-gateway__panel-art img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.gallery-gateway__panel-link {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
}

/* Map and field-notes cards: copy block over a full-bleed image. */
.gateway-card--map {
  background: url("../../images/north-island-new-zealand-satellite-map-kiwitile.webp") center / cover no-repeat;
}

.gateway-card--field-notes {
  background: none;
}

.gateway-card--map .gateway-card__media,
.gateway-card--field-notes .gateway-card__media {
  isolation: isolate;
  border-radius: var(--stage-radius);
}

.gateway-card--field-notes .gateway-card__media {
  background: url("../../images/europe/078-dt-sofia-bulgaria-european-mosaic-field-notes..webp") center / cover no-repeat;
}

.gateway-card--field-notes .gateway-card__media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(270deg, rgb(0 0 0 / 0.96) 0%, rgb(0 0 0 / 0.93) 18%, rgb(0 0 0 / 0.82) 30%, rgb(0 0 0 / 0.58) 40%, rgb(0 0 0 / 0.22) 48%, rgb(0 0 0 / 0.06) 54%, transparent 58%);
  pointer-events: none;
}

.gateway-card__copy {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(34vw, 520px);
  max-width: calc(100% - clamp(128px, 12.8vw, 248px));
  color: rgb(228 205 174 / 0.9);
  text-shadow:
    0 2px 2px rgb(0 0 0 / 0.72),
    0 14px 34px rgb(0 0 0 / 0.7);
  transform: translateY(-50%);
}

.gateway-card__copy--left {
  top: calc(50% + clamp(60px, 6.5vw, 112px));
  left: clamp(34px, 3.8vw, 72px);
  align-items: flex-start;
  text-align: left;
}

.gateway-card__copy--right {
  right: clamp(34px, 3.8vw, 72px);
  align-items: flex-end;
  text-align: right;
}

.gateway-card__kicker {
  margin: 0 0 clamp(18px, 1.5vw, 28px);
  color: rgb(224 163 83 / 0.92);
  font-family: var(--font-sans);
  font-size: clamp(10px, 0.78vw, 15px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.38em;
  text-transform: uppercase;
}

.gateway-card__title {
  width: 100%;
  margin: 0;
  color: rgb(240 190 111 / 0.98);
  font-family: var(--font-serif);
  font-size: clamp(42px, 4.3vw, 82px);
  font-weight: 500;
  line-height: 0.82;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.gateway-card--field-notes .gateway-card__title {
  font-size: clamp(46px, 4.7vw, 90px);
}

.gateway-card__title span {
  display: block;
  width: 100%;
}

.gateway-card__title .gateway-card__landscape-break {
  display: none;
}

.gateway-card__rule {
  width: clamp(180px, 17vw, 330px);
  height: 1px;
  margin: clamp(22px, 2vw, 34px) 0 clamp(20px, 1.8vw, 30px);
  background: linear-gradient(90deg, rgb(224 163 83 / 0.78), rgb(224 163 83 / 0.16), transparent);
}

.gateway-card__copy--right .gateway-card__rule {
  background: linear-gradient(270deg, rgb(224 163 83 / 0.78), rgb(224 163 83 / 0.16), transparent);
}

.gateway-card__text {
  max-width: none;
  margin: 0;
  color: rgb(238 226 208 / 0.74);
  font-family: var(--font-sans);
  font-size: clamp(16px, 1.35vw, 26px);
  font-weight: 650;
  line-height: 1.25;
}

/* The CTA carries the real navigation and sits above the card hit area. */
.gateway-card__cta {
  z-index: 3;
  align-self: flex-start;
  width: clamp(250px, 24vw, 420px);
  min-width: 0;
  margin: clamp(22px, 2vw, 36px) 0 0;
  padding: clamp(12px, 1.05vw, 20px) clamp(20px, 2vw, 38px);
  border-width: 2px;
  color: inherit;
  font-size: clamp(10px, 0.82vw, 15px);
  letter-spacing: 0.28em;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.gateway-card__copy--right .gateway-card__cta {
  align-self: flex-end;
}

/* Direct returns from the About page land on the field-notes card. */
#about-gateway-card {
  scroll-margin-top: clamp(150px, 17vh, 200px);
}

/* ── Closing statement ── */

.final-closing {
  position: sticky;
  top: var(--kt-footer-pin-sticky-top);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--stage-rail);
  max-width: none;
  margin-inline: auto;
  padding: clamp(49px, 5.3vw, 84px) clamp(28px, 3.8vw, 48px) clamp(50px, 5.5vw, 86px);
  text-align: center;
}

.final-closing__lead {
  max-width: clamp(900px, 84vw, 1180px);
  margin: 0;
  color: rgb(236 222 198);
  font-family: var(--font-serif);
  font-size: clamp(20px, 1.67vw, 31px);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.12),
    0 4px 18px rgb(0 0 0 / 0.55),
    0 18px 48px rgb(0 0 0 / 0.42);
}

.final-closing__emphasis {
  max-width: clamp(900px, 84vw, 1180px);
  margin: clamp(21px, 1.85vw, 34px) 0 0;
  color: rgb(245 204 135);
  font-family: var(--font-serif);
  font-size: clamp(33px, 3.3vw, 58px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.16),
    0 6px 22px rgb(0 0 0 / 0.58),
    0 24px 64px rgb(0 0 0 / 0.48);
}

.final-closing__rule {
  display: flex;
  align-items: center;
  gap: 0;
  width: min(clamp(320px, 28vw, 490px), 100%);
  margin: clamp(32px, 2.6vw, 49px) 0 clamp(28px, 2.3vw, 42px);
}

.final-closing__rule-line {
  flex: 1 1 auto;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgb(198 118 48) 18%, rgb(198 118 48) 82%, transparent);
}

.final-closing__rule-diamond {
  flex: 0 0 auto;
  width: clamp(6px, 0.52vw, 10px);
  height: clamp(6px, 0.52vw, 10px);
  margin: 0 clamp(12px, 1vw, 18px);
  background: rgb(198 118 48);
  transform: rotate(45deg);
}

.final-closing__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(clamp(258px, 21.5vw, 388px), 100%);
  min-height: clamp(47px, 3.65vw, 67px);
  padding: clamp(13px, 1.02vw, 18px) clamp(27px, 2.1vw, 40px);
  border: 1.5px solid rgb(222 150 68);
  background: rgb(8 8 8 / 0.72);
  box-shadow:
    0 12px 36px rgb(0 0 0 / 0.42),
    inset 0 1px 0 rgb(255 244 224 / 0.08);
  color: rgb(245 204 135);
  font-family: var(--font-serif);
  font-size: clamp(13px, 1vw, 19px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.24em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 260ms ease,
    color 260ms ease,
    background 260ms ease,
    transform 260ms ease,
    box-shadow 260ms ease;
}

.final-closing__cta:hover,
.final-closing__cta:focus-visible {
  border-color: rgb(246 190 110);
  background: rgb(12 12 12 / 0.88);
  box-shadow:
    0 18px 44px rgb(0 0 0 / 0.5),
    inset 0 1px 0 rgb(255 244 224 / 0.12);
  color: rgb(255 228 176);
  transform: translateY(-2px);
}

.final-closing__cta:focus-visible {
  outline: 2px solid rgb(246 190 110);
  outline-offset: 4px;
}

/* ── Page end: dark stone behind the site footer ── */

.page-end {
  position: relative;
  z-index: 3;
  isolation: isolate;
  overflow: hidden;
  background: #080808;
  color: rgb(245 245 245 / 0.9);
}

.page-end__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("../../images/080-dt-stone-2.webp") center / cover no-repeat;
  filter: saturate(0.88) contrast(1.1) brightness(1);
  transform: scale(1.018);
  pointer-events: none;
}

.page-end::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.13) 0%, rgb(0 0 0 / 0.04) 24%, rgb(0 0 0 / 0.04) 76%, rgb(0 0 0 / 0.27) 100%);
  pointer-events: none;
}

/* ═════════════ Responsive routes ═════════════ */

/* Title card: phone/tablet artwork below 1024px. */
@media (max-width: 1023px) {
  .final-stage__title-card-inner {
    padding-block: calc(clamp(34px, 5vw, 72px) + 55px);
  }

  .final-stage__preview-mobile {
    position: absolute;
    /* Crop inside the image's baked-in frame; the CSS overlay owns the edge. */
    top: calc(-96.77% - 1px);
    left: calc(-4.05% - 1px);
    z-index: 2;
    display: block;
    width: calc(107.95% + 2px);
    max-width: none;
    height: calc(297.77% + 2px);
    object-fit: fill;
    pointer-events: none;
  }
}

@media (max-width: 767px) {
  .final-stage__title {
    font-size: clamp(42px, 6.4vw, 80px);
  }

  .final-closing__lead {
    font-size: 20px;
    line-height: 1.55;
  }

  .page-end__background {
    background-position: center top;
    transform: none;
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  .final-stage__title-card-inner {
    background: none;
    box-shadow: none;
  }

  .final-stage__title-card-inner > :is(.final-stage__title, .final-stage__rule, .final-stage__subtitle) {
    opacity: 0;
  }
}

/* Phone portrait: dedicated centre-panel artwork. */
@media (max-width: 900px) and (orientation: portrait) {
  .gallery-gateway__panel {
    aspect-ratio: 760 / 1000;
  }

  .gallery-gateway__panel-art {
    display: block;
    transform: none;
  }
}

/* Phone landscape keeps the empty panel at its established height. */
@media (max-width: 900px) and (orientation: landscape) {
  .gallery-gateway__panel {
    min-height: clamp(340px, 42.3vw, 380px);
  }
}

@media (pointer: coarse) and (orientation: landscape) and
       (min-width: 1100px) and (max-width: 1180px) and (max-height: 780px) {
  .gallery-gateway__panel {
    min-height: min(49vh, 366px);
  }
}

/* Mobile experience: everything in normal flow over an absolute stone. */
@media (max-width: 900px),
       (pointer: coarse) and (orientation: landscape) and
       (min-width: 1100px) and (max-width: 1180px) and (max-height: 780px) {
  .final-stage {
    overflow: visible;
  }

  .final-stage__background {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    min-height: 100%;
    background-size: cover;
    background-position: center center;
  }

  .final-stage__content {
    z-index: 2;
    margin-top: 0;
    overflow: visible;
  }

  .final-stage__title-card {
    position: relative;
    z-index: 3;
    min-height: 70svh;
    padding: 96px 10px 40px;
  }

  .final-stage__title-card-inner {
    display: block;
    width: calc(100vw - 20px);
  }

  .gateway,
  .gateway__opening {
    position: relative;
    z-index: 3;
    width: 100%;
    overflow: visible;
  }

  .gateway__cards {
    position: relative;
    z-index: 3;
    align-items: center;
    gap: 28px;
    width: 100%;
  }

  .gateway-card {
    z-index: 3;
    flex: 0 0 auto;
    width: calc(100vw - 20px);
    box-shadow: 0 24px 64px rgb(0 0 0 / 0.46);
    cursor: default;
  }

  /* Only the CTA is tappable on touch layouts. */
  .gateway-card__hit {
    display: none;
    pointer-events: none;
  }

  .gateway-card__image {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
  }

  .gateway-card__media {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 460px;
    aspect-ratio: auto;
  }

  /* Map and field-notes: tall portrait cards filled by their image. */
  .gateway-card--map,
  .gateway-card--field-notes {
    height: clamp(460px, 132vw, 700px);
    min-height: 460px;
    max-height: 700px;
  }

  .gateway-card--map .gateway-card__image,
  .gateway-card--field-notes .gateway-card__image,
  .gateway-card--map .gateway-card__media,
  .gateway-card--field-notes .gateway-card__media {
    flex: 1 1 auto;
    min-height: 100%;
  }

  .gateway-card--map {
    background-color: #080706;
    background-position: 42% center;
  }

  .gateway-card--map .gateway-card__media::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgb(0 0 0 / 0.4);
    pointer-events: none;
  }

  .gateway-card--field-notes .gateway-card__media::before {
    background: linear-gradient(180deg, rgb(0 0 0 / 0.16) 0%, rgb(0 0 0 / 0.48) 42%, rgb(0 0 0 / 0.88) 100%);
  }

  .gateway-card__copy,
  .gateway-card__copy--left,
  .gateway-card__copy--right {
    top: 65%;
    right: 24px;
    left: 24px;
    width: auto;
    max-width: none;
  }

  .gateway-card__copy--left {
    top: 72%;
  }

  .gateway-card__kicker {
    margin-bottom: 14px;
  }

  .gateway-card__title,
  .gateway-card--field-notes .gateway-card__title {
    font-size: clamp(34px, 10vw, 44px);
    line-height: 0.92;
  }

  .gateway-card__rule {
    width: min(180px, 70%);
    margin-block: 18px;
  }

  .gateway-card__text > span {
    display: block;
  }

  .gateway-card__cta {
    touch-action: manipulation;
    width: min(100%, 250px);
    margin-top: 20px;
    padding: 12px 14px;
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  /* Gallery card: content height; portraits stacked around the panel. */
  .gateway-card--gallery .gateway-card__image,
  .gateway-card--gallery .gateway-card__media {
    height: auto;
    min-height: 0;
  }

  .gallery-gateway__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(280px, 82vw, 390px) auto clamp(280px, 82vw, 390px);
    height: auto;
  }

  .gallery-gateway__portrait {
    height: auto;
  }

  .gallery-gateway__portrait--left {
    grid-area: 1 / 1;
    border-radius: var(--stage-radius) 0 0 0;
  }

  .gallery-gateway__panel {
    display: block;
    grid-area: 2 / 1;
    height: auto;
    border-radius: 0 0 var(--stage-radius) var(--stage-radius);
  }

  .gallery-gateway__portrait--right {
    grid-area: 3 / 1;
    border-radius: 0 var(--stage-radius) 0 0;
  }

  .gallery-gateway .gallery-gateway__portrait--left img {
    object-position: center 32%;
  }

  .gallery-gateway .gallery-gateway__portrait--right img {
    object-position: center 30%;
  }

  .gallery-gateway__name {
    bottom: 16px;
    left: 16px;
    gap: 7px;
    font-size: clamp(30px, 8vw, 36px);
  }

  .gallery-gateway__experience {
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: 0.14em;
  }

  .gallery-gateway__role {
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: 0.12em;
  }

  /* Closing copy is never sticky on touch layouts. */
  .final-closing {
    position: relative;
    top: auto;
    z-index: 3;
    justify-content: flex-start;
    width: calc(100vw - 32px);
    margin: 48px auto 0;
    padding: 40px 16px 56px;
  }

  .final-closing :is(.final-closing__lead, .final-closing__emphasis, .final-closing__cta) {
    max-width: 100%;
    white-space: normal;
  }

  .final-closing__emphasis {
    font-size: clamp(28px, 9vw, 40px);
    line-height: 1.15;
  }

  .final-stage__pin-scroll {
    height: 48px;
    min-height: 48px;
  }

  /* Visible overflow (as the original) but never wider than the viewport:
     the rebuild scrolls the document, where a horizontal overflow would
     widen the mobile layout viewport. */
  .page-end {
    z-index: 4;
    overflow: visible;
    overflow-x: clip;
  }

  #about-gateway-card {
    scroll-margin-top: 72px;
  }
}

/* Phones: larger gateway type and CTAs. */
@media (max-width: 767px) {
  .gateway-card__text {
    font-size: 20px;
    line-height: 1.55;
  }

  .gateway-card__cta {
    width: min(100%, 300px);
    min-height: 54px;
    margin-top: 22px;
    padding: 15px 18px;
    font-size: 16px;
    line-height: 1.25;
    letter-spacing: 0.14em;
  }
}

/* Phone landscape and compact touch landscape: Matty | Rodrigo side by
   side with the centre panel full-width underneath. */
@media (max-width: 900px) and (orientation: landscape),
       (pointer: coarse) and (orientation: landscape) and
       (min-width: 1100px) and (max-width: 1180px) and (max-height: 780px) {
  .gateway-card__title .gateway-card__landscape-break {
    display: inline;
  }

  .gallery-gateway__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(300px, 62vh) auto;
  }

  .gallery-gateway__portrait {
    width: 100%;
    height: 100%;
    min-height: min(62vh, 440px);
  }

  .gallery-gateway__portrait--left {
    grid-area: 1 / 1;
    border-radius: var(--stage-radius) 0 0 0;
  }

  .gallery-gateway__portrait--right {
    grid-area: 1 / 2;
    border-radius: 0 var(--stage-radius) 0 0;
  }

  .gallery-gateway__panel {
    grid-area: 2 / 1 / auto / -1;
    width: 100%;
  }

  .gallery-gateway .gallery-gateway__portrait img {
    object-position: center 28%;
  }

  .gallery-gateway__name {
    bottom: 12px;
    left: 12px;
    font-size: clamp(20px, 3.2vw, 28px);
  }
}

/* Tablet portrait: full-bleed gateway cards; narrower portraits. */
@media (min-width: 700px) and (max-width: 1100px) and (orientation: portrait) {
  .gateway-card {
    width: 100vw;
  }
}

@media (min-width: 700px) and (max-width: 900px) and (orientation: portrait) {
  .gallery-gateway__portrait {
    justify-self: center;
    width: 78%;
  }

  .gallery-gateway .gallery-gateway__portrait img {
    object-position: center 23%;
  }
}

@media (min-width: 901px) and (max-width: 1100px) and (orientation: portrait) {
  .gallery-gateway__grid {
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 0.74fr) minmax(0, 0.78fr);
  }

  .gallery-gateway .gallery-gateway__portrait img {
    object-position: center 23%;
  }
}

/* Desktop and tablets with the desktop layout: centre-panel artwork. */
@media (min-width: 1181px),
       (min-width: 901px) and (pointer: fine),
       (min-width: 901px) and (orientation: portrait),
       (min-width: 901px) and (min-height: 781px),
       (pointer: coarse) and (orientation: landscape) and
       (min-width: 901px) and (max-width: 1099px) {
  .gallery-gateway__panel-art {
    display: block;
  }
}

@media (min-width: 1181px),
       (min-width: 901px) and (max-width: 1099px),
       (min-width: 901px) and (pointer: fine),
       (min-width: 901px) and (orientation: portrait),
       (min-width: 901px) and (min-height: 781px) {
  .final-closing__lead {
    max-width: none;
    white-space: nowrap;
  }
}

@media (min-width: 1024px) {
  .final-stage__title-card-inner {
    background: none;
    box-shadow: none;
  }

  .final-stage__title-card-inner > :is(.final-stage__title, .final-stage__rule, .final-stage__subtitle) {
    opacity: 0;
  }

  /* Bleed the artwork's transparent export space and baked-in frame outside
     the card so only the CSS frame remains visible. */
  .final-stage__preview {
    position: absolute;
    top: calc(-25.88% - 1px);
    left: calc(-2.32% - 1px);
    z-index: 2;
    display: block;
    width: calc(104.64% + 2px);
    max-width: none;
    height: calc(150.75% + 2px);
    object-fit: fill;
    pointer-events: none;
  }
}

/* 1440p and up: type grows with the smaller viewport ratio. */
@media (min-width: 1921px) and (min-height: 1081px) {
  .final-stage__title {
    font-size: clamp(72px, min(3.75vw, 6.666667vh), 104.4px);
  }

  .final-stage__subtitle {
    font-size: clamp(38px, min(1.979167vw, 3.518519vh), 55.1px);
  }

  .gallery-gateway__name {
    font-size: clamp(52px, min(2.708333vw, 4.814815vh), 75.4px);
  }

  .gallery-gateway__experience {
    font-size: clamp(13.5px, min(0.703125vw, 1.25vh), 20.925px);
  }

  .gallery-gateway__role {
    font-size: clamp(12px, min(0.625vw, 1.111111vh), 18.6px);
  }
}

/* 1080p and 2160p: gateway card outlines stay proportional to 1280×720
   (Chromium floors 1.5px borders, so never thinner than 2px). */
@media (min-width: 1600px) and (max-width: 2200px) and (min-height: 900px) and (max-height: 1250px),
       (min-width: 3200px) and (max-width: 4400px) and (min-height: 1800px) and (max-height: 2500px) {
  .final-stage {
    --s720: min(calc(100vw / 1280), calc(100vh / 720));
  }

  .gateway-card {
    border-width: max(2px, var(--s720));
    border-radius: calc(8 * var(--s720));
  }
}

/* 2160p: the opener, gateway copy and closing scale from 1280×720. */
@media (min-width: 3200px) and (max-width: 4400px) and (min-height: 1800px) and (max-height: 2500px) {
  .final-stage__title-card {
    padding: calc(128 * var(--s720)) calc(89.6 * var(--s720));
  }

  .final-stage__title-card-inner {
    padding: calc(64 * var(--s720));
    border-width: var(--s720);
  }

  .final-stage__title {
    max-width: calc(980 * var(--s720));
    font-size: calc(61.44 * var(--s720));
    text-shadow:
      0 var(--s720) 0 rgb(255 255 255 / 0.08),
      0 calc(24 * var(--s720)) calc(74 * var(--s720)) rgb(0 0 0 / 0.68);
  }

  .final-stage__rule {
    width: calc(643.68 * var(--s720));
    height: var(--s720);
    min-height: var(--s720);
    margin: calc(19.584 * var(--s720)) auto calc(21.376 * var(--s720));
  }

  .final-stage__subtitle {
    max-width: calc(980 * var(--s720));
    font-size: calc(32 * var(--s720));
    text-shadow:
      0 var(--s720) 0 rgb(255 255 255 / 0.06),
      0 calc(12 * var(--s720)) calc(40 * var(--s720)) rgb(0 0 0 / 0.55);
  }

  .gateway__cards {
    gap: calc(40 * var(--s720));
  }

  .gallery-gateway__grid {
    grid-template-columns: minmax(0, 1fr) minmax(calc(220 * var(--s720)), 0.52fr) minmax(0, 1fr);
  }

  .gallery-gateway__name {
    bottom: calc(25.6 * var(--s720));
    left: calc(28.16 * var(--s720));
    gap: calc(7.424 * var(--s720));
    font-size: calc(43.52 * var(--s720));
    text-shadow: 0 calc(8 * var(--s720)) calc(24 * var(--s720)) rgb(0 0 0 / 0.56);
  }

  .gallery-gateway__experience {
    padding-top: calc(8.32 * var(--s720));
    font-size: calc(11.52 * var(--s720));
  }

  .gallery-gateway__role {
    font-size: calc(10.496 * var(--s720));
  }

  .gateway-card__copy {
    width: min(34vw, calc(435.2 * var(--s720)));
    max-width: calc(100% - calc(163.84 * var(--s720)));
    text-shadow:
      0 calc(2 * var(--s720)) calc(2 * var(--s720)) rgb(0 0 0 / 0.72),
      0 calc(14 * var(--s720)) calc(34 * var(--s720)) rgb(0 0 0 / 0.7);
  }

  .gateway-card__copy--left {
    top: calc(50% + calc(83.2 * var(--s720)));
    left: calc(48.64 * var(--s720));
  }

  .gateway-card__copy--right {
    right: calc(48.64 * var(--s720));
  }

  .gateway-card__kicker {
    margin-bottom: calc(19.2 * var(--s720));
    font-size: calc(10 * var(--s720));
  }

  .gateway-card__title {
    font-size: calc(55.04 * var(--s720));
  }

  .gateway-card--field-notes .gateway-card__title {
    font-size: calc(60.16 * var(--s720));
  }

  .gateway-card__rule {
    width: calc(217.6 * var(--s720));
    height: var(--s720);
    margin: calc(25.6 * var(--s720)) 0 calc(23.04 * var(--s720));
  }

  .gateway-card__text {
    font-size: calc(17.28 * var(--s720));
  }

  .gateway-card__cta {
    width: calc(307.2 * var(--s720));
    margin-top: calc(25.6 * var(--s720));
    padding: calc(13.44 * var(--s720)) calc(25.6 * var(--s720));
    border-width: calc(2 * var(--s720));
    font-size: calc(10.496 * var(--s720));
  }

  .final-closing {
    padding: calc(67.84 * var(--s720)) calc(48 * var(--s720)) calc(70.4 * var(--s720));
  }

  .final-closing__lead {
    font-size: calc(21.376 * var(--s720));
    text-shadow:
      0 var(--s720) 0 rgb(255 255 255 / 0.12),
      0 calc(4 * var(--s720)) calc(18 * var(--s720)) rgb(0 0 0 / 0.55),
      0 calc(18 * var(--s720)) calc(48 * var(--s720)) rgb(0 0 0 / 0.42);
  }

  .final-closing__emphasis {
    max-width: calc(1075.2 * var(--s720));
    margin-top: calc(23.68 * var(--s720));
    font-size: calc(42.24 * var(--s720));
    text-shadow:
      0 var(--s720) 0 rgb(255 255 255 / 0.16),
      0 calc(6 * var(--s720)) calc(22 * var(--s720)) rgb(0 0 0 / 0.58),
      0 calc(24 * var(--s720)) calc(64 * var(--s720)) rgb(0 0 0 / 0.48);
  }

  .final-closing__rule {
    width: min(calc(358.4 * var(--s720)), 100%);
    margin: calc(33.28 * var(--s720)) 0 calc(29.44 * var(--s720));
  }

  .final-closing__rule-line {
    height: calc(1.5 * var(--s720));
  }

  .final-closing__rule-diamond {
    width: calc(6.656 * var(--s720));
    height: calc(6.656 * var(--s720));
    margin-inline: calc(12.8 * var(--s720));
  }

  .final-closing__cta {
    width: min(calc(275.2 * var(--s720)), 100%);
    min-height: calc(47 * var(--s720));
    padding: calc(13.056 * var(--s720)) calc(27 * var(--s720));
    border-width: calc(1.5 * var(--s720));
    font-size: calc(13 * var(--s720));
    box-shadow:
      0 calc(12 * var(--s720)) calc(36 * var(--s720)) rgb(0 0 0 / 0.42),
      inset 0 var(--s720) 0 rgb(255 244 224 / 0.08);
  }
}
