/*
 * Service type selector — the inverse-cylinder carousel shared by the tile,
 * mosaic and stone material guides (html/primary-service-*-carousel.html).
 *
 * Cards sit on the inside of a cylinder (js/embeds/service-carousel.js sets
 * each card's transform). Selecting the front card "flies" a clone of it to
 * a centred detail sheet (.type-card--fly) over a blurred focus layer.
 *
 * Page themes (modifier on <body>):
 *   --tile    plain photography, per-image exposure tweaks
 *   --mosaic  plain photography, muted cards keep full colour, image crops
 *   --stone   textured photography (grain overlays, gentle grade)
 *
 * Media queries keep the original conditions AND order: several later
 * blocks deliberately override earlier ones (e.g. the short-viewport stage
 * height wins over the phone stage height).
 */

:root {
  --carousel-gold-soft: rgb(221 184 122 / 0.72);
  --carousel-cream: rgb(245 235 214 / 0.88);
  --carousel-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --carousel-fly-ms: 940ms;
  /* Orbit geometry, read by the script (--kt-radius) on every frame. */
  --kt-card-w: min(404px, 76vw);
  --kt-card-h: 420px;
  --kt-radius: 560px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background: #0a0908;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% -10%, rgb(221 167 92 / 0.24), transparent 42%),
    radial-gradient(circle at 14% 82%, rgb(89 122 107 / 0.12), transparent 32%),
    radial-gradient(circle at 88% 72%, rgb(188 120 72 / 0.1), transparent 36%),
    linear-gradient(180deg, #0a0908 0%, #15120f 48%, #0b0a09 100%);
  color: var(--carousel-cream);
  font-family: var(--font-sans);
}

/* Film grain and sheen. */
body::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(120deg, rgb(255 255 255 / 0.035), transparent 34% 66%, rgb(255 255 255 / 0.018)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.35;
  pointer-events: none;
}

/* Warm floor glow. */
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: auto 0 0;
  height: 32svh;
  background:
    radial-gradient(ellipse at 50% 100%, rgb(219 177 108 / 0.18), transparent 66%),
    linear-gradient(180deg, transparent, rgb(0 0 0 / 0.44));
  pointer-events: none;
}

/* Standalone exit (hidden when embedded: the modal supplies its own). */
.carousel__exit {
  position: fixed;
  z-index: 8;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgb(241 199 125 / 0.36);
  border-radius: 50%;
  background: rgb(5 8 7 / 0.68);
  color: #f1c77d;
  cursor: pointer;
}

.carousel__exit::before,
.carousel__exit::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1px;
  background: currentColor;
}

.carousel__exit::before { transform: translate(-50%, -50%) rotate(45deg); }
.carousel__exit::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* ── Layout ────────────────────────────────────────────────────────── */

.carousel {
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: clamp(32px, 5vh, 68px) 22px;
  overflow: hidden;
}

.carousel__shell {
  position: relative;
  width: min(1180px, 100%);
}

/* Soft oval of light behind the orbit. */
.carousel__shell::before {
  content: "";
  position: absolute;
  top: 52%;
  left: 50%;
  width: min(1040px, 96vw);
  height: min(620px, 70svh);
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 47%, rgb(255 246 224 / 0.035), transparent 57%),
    radial-gradient(ellipse at 50% 82%, rgb(194 143 76 / 0.12), transparent 52%);
  box-shadow: 0 44px 130px rgb(0 0 0 / 0.24);
  opacity: 0.9;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.carousel__kicker {
  margin: 0 0 12px;
  color: var(--carousel-gold-soft);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-align: center;
  text-transform: uppercase;
  transform: translateY(-12px);
}

.carousel__title {
  max-width: 820px;
  margin: 0 auto 12px;
  color: rgb(255 242 214 / 0.94);
  font-family: var(--font-serif);
  font-size: clamp(32px, 4.4vw, 66px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: 0;
  text-align: center;
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.12),
    0 16px 48px rgb(0 0 0 / 0.75),
    0 0 42px rgb(194 143 76 / 0.12);
  transform: translateY(-12px);
}

.carousel__title-lead,
.carousel__title-rest {
  display: block;
}

.carousel__title-lead {
  font-size: 1.2em;
}

/* ── Stage and cylinder ────────────────────────────────────────────── */

.carousel__stage {
  position: relative;
  display: grid;
  place-items: center;
  height: min(610px, 61svh);
  min-height: 500px;
  overflow: visible;
  perspective: 1300px;
  perspective-origin: 50% 44%;
  user-select: none;
  touch-action: pan-y;
}

/* Elliptical floor reflection under the orbit. */
.carousel__stage::before {
  content: "";
  position: absolute;
  bottom: 22px;
  width: min(900px, 88vw);
  height: 286px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgb(245 210 150 / 0.18), transparent 58%),
    radial-gradient(ellipse at center, rgb(0 0 0 / 0.38), transparent 72%);
  filter: blur(16px);
  opacity: 0.9;
  transform: rotateX(72deg);
  pointer-events: none;
}

.carousel__cylinder {
  position: relative;
  width: var(--kt-card-w);
  height: var(--kt-card-h);
  transform-style: preserve-3d;
  will-change: transform;
  cursor: ew-resize;
}

.carousel__shell--detail-open .carousel__stage {
  pointer-events: none;
}

.carousel__shell--detail-open .carousel__cylinder {
  opacity: 0.24;
  filter: blur(2px) saturate(0.74) brightness(0.62);
  transition: opacity 520ms ease, filter 520ms ease;
}

/* ── Card ──────────────────────────────────────────────────────────── */

.type-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  overflow: hidden;
  border: 1px solid rgb(222 170 92 / 0.42);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.06), rgb(255 255 255 / 0.012)),
    linear-gradient(145deg, rgb(43 36 29 / 0.96), rgb(13 11 9 / 0.98));
  box-shadow:
    0 30px 80px rgb(0 0 0 / 0.58),
    0 0 0 1px rgb(0 0 0 / 0.48),
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    inset 0 -1px 0 rgb(0 0 0 / 0.52);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: opacity 0.45s ease, filter 0.45s ease, box-shadow 0.45s ease, border-color 0.45s ease;
}

/* Inner bevel line. */
.type-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgb(255 239 206 / 0.05);
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
  pointer-events: none;
}

.type-card--muted {
  filter: saturate(0.84) brightness(0.88);
}

.type-card--active {
  border-color: rgb(237 190 112 / 0.74);
  opacity: 1;
  filter: none;
  box-shadow:
    0 34px 86px rgb(0 0 0 / 0.64),
    0 0 54px rgb(220 164 83 / 0.18),
    0 0 0 1px rgb(0 0 0 / 0.42),
    inset 0 1px 0 rgb(255 255 255 / 0.1),
    inset 0 -1px 0 rgb(0 0 0 / 0.52);
}

.type-card--hidden-source {
  visibility: hidden;
}

/* Full-card hit area (focusable for the front card only). */
.type-card__action {
  position: absolute;
  z-index: 6;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.type-card__action:focus-visible {
  outline: 3px solid rgb(255 228 178 / 0.98);
  outline-offset: -5px;
}

.type-card__art {
  position: relative;
  flex: 0 0 auto;
  height: 246px;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: #201c17;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.055),
    inset 0 -34px 52px rgb(0 0 0 / 0.18);
}

.type-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 1;
}

.type-card__copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  padding: 22px 28px 28px;
  text-align: center;
  background:
    radial-gradient(520px 180px at 50% 14%, rgb(255 255 255 / 0.085), rgb(255 255 255 / 0.022) 38%, transparent 70%),
    radial-gradient(420px 150px at 50% 78%, rgb(190 145 92 / 0.09), transparent 72%),
    linear-gradient(180deg, rgb(0 0 0 / 0), rgb(0 0 0 / 0.14));
}

.type-card__name {
  position: relative;
  margin: 0;
  color: rgb(212 178 124 / 0.96);
  font-family: var(--font-serif);
  font-size: clamp(15px, 2vw, 21px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  -webkit-text-stroke: 0.35px rgb(255 244 224 / 0.22);
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.18),
    2.5px 3.5px 6.5px rgb(0 0 0 / 0.52),
    0 0 16px rgb(255 255 255 / 0.1);
}

/* Soft glow behind the name. */
.type-card__name::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 52%;
  left: 50%;
  width: 128%;
  height: 88%;
  background: radial-gradient(ellipse at center, rgb(255 255 255 / 0.09), rgb(190 145 92 / 0.045) 42%, transparent 72%);
  filter: blur(10px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.type-card__divider {
  width: 135px;
  height: clamp(6px, 0.65vw, 8px);
  margin: clamp(4px, 0.45vw, 6px) auto clamp(6px, 0.7vw, 8px);
  background: url("../../images/008-dt-ornamental-divider.svg") center / 100% 100% no-repeat;
  opacity: 0.94;
  filter:
    drop-shadow(0 1px 1px rgb(0 0 0 / 0.48))
    drop-shadow(0 0 9px rgb(255 211 106 / 0.18));
}

.type-card__summary {
  margin: -4px 0 0;
  color: rgb(222 205 182 / 0.9);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.42;
  letter-spacing: 0.02em;
  opacity: 0.78;
  -webkit-text-stroke: 0.22px rgb(255 255 255 / 0.46);
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.55);
}

/* ── Arrow controls (touch layouts only) ───────────────────────────── */

.carousel__controls {
  position: relative;
  z-index: 3;
  top: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 24px auto 0;
}

.carousel__arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgb(246 226 190 / 0.86);
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.carousel__arrow svg {
  width: 22px;
  height: 22px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.carousel__arrow:active {
  color: rgb(255 244 218 / 0.98);
  transform: scale(0.9);
}

.carousel__arrow:focus-visible {
  outline: 2px solid rgb(224 174 96 / 0.92);
  outline-offset: 0;
  border-radius: 50%;
}

/* ── Detail: focus layer and flying card ───────────────────────────── */

.carousel__focus-layer {
  position: fixed;
  z-index: 70;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgb(211 158 86 / 0.2), transparent 34%),
    radial-gradient(circle at 50% 100%, rgb(110 132 118 / 0.1), transparent 45%),
    rgb(5 4 3 / 0.62);
  opacity: 0;
  backdrop-filter: blur(9px) saturate(0.9);
  transition: opacity 520ms ease;
  pointer-events: none;
}

.carousel__focus-layer--open {
  opacity: 1;
  pointer-events: auto;
}

/* Clone of the front card, animated between its rect and the detail rect
   (left/top/width/height are set inline by the script). */
.type-card--fly {
  position: fixed;
  z-index: 90;
  inset: auto;
  margin: 0;
  transform: none;
  transform-style: flat;
  backface-visibility: visible;
  cursor: default;
  will-change: left, top, width, height, border-radius;
  transition:
    left var(--carousel-fly-ms) var(--carousel-ease),
    top var(--carousel-fly-ms) var(--carousel-ease),
    width var(--carousel-fly-ms) var(--carousel-ease),
    height var(--carousel-fly-ms) var(--carousel-ease),
    border-radius var(--carousel-fly-ms) var(--carousel-ease),
    box-shadow var(--carousel-fly-ms) var(--carousel-ease),
    filter var(--carousel-fly-ms) var(--carousel-ease);
}

.type-card--fly .type-card__art {
  align-self: center;
  width: 100%;
  transition:
    height var(--carousel-fly-ms) var(--carousel-ease),
    width var(--carousel-fly-ms) var(--carousel-ease),
    border-radius var(--carousel-fly-ms) var(--carousel-ease);
}

.type-card--fly .type-card__copy {
  transition: padding var(--carousel-fly-ms) var(--carousel-ease);
}

.type-card--fly .type-card__name {
  transition: font-size var(--carousel-fly-ms) var(--carousel-ease), margin var(--carousel-fly-ms) var(--carousel-ease);
}

.type-card--fly .type-card__summary {
  transition:
    opacity 220ms ease,
    transform 360ms ease,
    font-size var(--carousel-fly-ms) var(--carousel-ease),
    line-height var(--carousel-fly-ms) var(--carousel-ease),
    color var(--carousel-fly-ms) ease;
}

.type-card--expanding {
  border-radius: 30px;
  filter: none;
  box-shadow:
    0 48px 138px rgb(0 0 0 / 0.76),
    0 0 90px rgb(214 157 78 / 0.18),
    inset 0 1px 0 rgb(255 255 255 / 0.1);
}

.type-card--expanding .type-card__art {
  height: clamp(282px, 51svh, 430px);
}

.type-card--expanding .type-card__copy {
  padding: 4px 18px 12px;
}

.type-card--expanding .type-card__name {
  margin: 16px 0 8px;
  font-size: clamp(29px, 4vw, 48px);
  line-height: 0.98;
}

.type-card--expanding .type-card__summary {
  color: rgb(232 220 198 / 0.76);
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.64;
}

.type-card--swapping .type-card__summary {
  opacity: 0;
  transform: translateY(8px);
}

.type-card--detail .type-card__summary {
  opacity: 1;
  transform: translateY(0);
}

.type-card--closing * {
  pointer-events: none;
}

.type-card__close {
  position: absolute;
  z-index: 6;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgb(218 166 94 / 0.35);
  border-radius: 999px;
  background: rgb(8 7 6 / 0.78);
  color: var(--carousel-cream);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 360ms ease, transform 520ms var(--carousel-ease);
}

.type-card--detail .type-card__close {
  opacity: 1;
  transform: translateY(0);
}

.type-card__close:focus-visible {
  outline: 2px solid rgb(224 174 96 / 0.92);
  outline-offset: 3px;
}

/* ── Page themes ───────────────────────────────────────────────────── */

/* Tile: lift a few under-exposed orbit photographs. */
.service-carousel--tile .type-card__image[src*="kiwitile-timber-look-tile-bathroom-floor-installation"] {
  filter: brightness(0.96) contrast(1.32) saturate(1.08);
}

.service-carousel--tile .type-card__image[src*="porcelain-floor-tiling-living-area"],
.service-carousel--tile .type-card__image[src*="handmade-tile-moroccan-kitchen-splash"] {
  filter: brightness(1.16) contrast(1.02) saturate(1.02);
}

.service-carousel--tile .type-card__image[src*="rounded-subway-tile-bathroom-vanity-wall"] {
  filter: brightness(1.02) contrast(1.04) saturate(1.02);
}

/* Mosaic: side cards keep full colour; two crops. */
.service-carousel--mosaic .type-card--muted {
  filter: none;
}

.service-carousel--mosaic .type-card__image[src*="mosaic-tile-bathroom-recessed-niche-installation"] {
  object-position: right center;
}

.service-carousel--mosaic .type-card__image[src*="herringbone-laundry-floor-glass-mosaics-nz"] {
  object-position: center 34%;
}

/* Stone: graded photography with sheen and grain overlays. */
.service-carousel--stone .type-card__image {
  filter: saturate(0.86) contrast(1.06) brightness(1);
  transform: scale(1.02);
}

.service-carousel--stone .type-card--fly .type-card__image {
  filter: saturate(0.95) contrast(1.04) brightness(1);
}

.service-carousel--stone .type-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgb(235 190 121 / 0.18), transparent 34%),
    linear-gradient(105deg, transparent 0 22%, rgb(255 255 255 / 0.08) 38%, transparent 54%),
    linear-gradient(180deg, rgb(255 255 255 / 0.035), transparent 36%);
  opacity: 0.68;
  pointer-events: none;
}

.service-carousel--stone .type-card__art::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(118deg, rgb(255 255 255 / 0.15), transparent 16% 68%, rgb(0 0 0 / 0.2)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23m)' opacity='.27'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.54;
  pointer-events: none;
}

.service-carousel--stone .type-card__art::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    radial-gradient(circle at 50% 25%, transparent 0 42%, rgb(0 0 0 / 0.32) 100%),
    linear-gradient(180deg, rgb(255 255 255 / 0.06) 0%, transparent 28%, rgb(0 0 0 / 0.34) 100%);
  pointer-events: none;
}

/* Onyx is a portrait photograph: keep its detail frame narrow. */
.service-carousel--stone .type-card--expanding:has(.type-card__image[src*="onyx-stone-luxury-ensuite-install-kiwitile"]) .type-card__art {
  align-self: center;
  width: min(74%, 330px);
}

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

/* Phones (portrait / landscape) and compact touch landscape tablets. */
@media (max-width: 900px) and (orientation: portrait),
       (max-width: 900px) and (max-height: 500px),
       (pointer: coarse) and (orientation: landscape) and
       (min-width: 1100px) and (max-width: 1180px) and (max-height: 780px) {
  :root { --kt-radius: 390px; }

  .service-carousel {
    --kt-card-w: min(384px, 90vw);
    --kt-card-h: 500px;
  }

  .carousel {
    min-height: 100dvh;
    padding: clamp(12px, 2.4vh, 28px) 0;
  }

  .carousel__shell::before {
    width: min(1200px, 100vw);
    height: min(700px, 80svh);
  }

  .carousel__kicker { font-size: 15px; }

  .carousel__title {
    max-width: 420px;
    font-size: clamp(40px, 7.2vw, 48px);
    line-height: 0.96;
  }

  .carousel__stage {
    height: 64svh;
    min-height: 530px;
    overflow: hidden;
  }

  .type-card__art { height: 260px; }

  .type-card__copy {
    gap: 11px;
    padding: 18px 20px 22px;
  }

  /* Phone sizes apply to the flying card as well. */
  .type-card__name,
  .type-card--expanding .type-card__name {
    font-size: clamp(33px, 7.4vw, 36px);
    letter-spacing: 0.045em;
  }

  .type-card__summary,
  .type-card--expanding .type-card__summary {
    font-size: 18.5px;
    line-height: 1.52;
  }

  .type-card__divider {
    width: 156px;
    height: 8px;
  }
}

@media (max-width: 720px) and (orientation: portrait),
       (max-width: 720px) and (max-height: 500px) {
  :root { --kt-radius: 338px; }

  .service-carousel {
    --kt-card-w: min(364px, 92vw);
    --kt-card-h: 484px;
  }

  .carousel { padding: clamp(10px, 2vh, 22px) 0; }

  .carousel__shell::before {
    width: min(1160px, 100vw);
    height: min(680px, 78svh);
  }

  .carousel__title {
    max-width: 380px;
    font-size: clamp(38px, 9.5vw, 46px);
  }

  .carousel__stage {
    height: 62svh;
    min-height: 510px;
    perspective: 1120px;
  }

  .carousel__stage::before {
    bottom: 24px;
    left: 50%;
    width: min(100vw, 420px);
    height: 340px;
    transform: translateX(-50%) rotateX(72deg);
  }

  .type-card__art { height: 248px; }
  .type-card__copy { padding: 16px 18px 20px; }

  .type-card__name,
  .type-card--fly.type-card--expanding .type-card__name {
    font-size: clamp(32px, 7.6vw, 35px);
  }

  .type-card__summary,
  .type-card--expanding .type-card__summary { font-size: 18px; }

  .type-card__divider { width: 154px; }

  .type-card--expanding .type-card__copy { padding: 4px 12px 12px; }
}

@media (max-height: 740px) {
  .carousel {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .carousel__title {
    margin-bottom: 10px;
    line-height: 0.96;
  }

  .carousel__stage {
    height: min(540px, 66svh);
    min-height: 500px;
  }
}

/* The phone blocks' own padding must win over the short-viewport padding. */
@media (max-height: 740px) and (max-width: 900px) and (orientation: portrait),
       (max-height: 740px) and (max-width: 900px) and (max-height: 500px),
       (max-height: 740px) and (pointer: coarse) and (orientation: landscape) and
       (min-width: 1100px) and (max-width: 1180px) {
  .carousel { padding: clamp(12px, 2.4vh, 28px) 0; }
}

@media (max-height: 740px) and (max-width: 720px) and (orientation: portrait),
       (max-height: 740px) and (max-width: 720px) and (max-height: 500px) {
  .carousel { padding: clamp(10px, 2vh, 22px) 0; }
}

@media (max-width: 420px) and (orientation: portrait),
       (max-width: 420px) and (max-height: 500px) {
  :root { --kt-radius: 310px; }

  .service-carousel {
    --kt-card-w: min(346px, 94vw);
    --kt-card-h: 470px;
  }

  .carousel__stage {
    height: 60svh;
    min-height: 490px;
  }

  .type-card__art { height: 236px; }

  .type-card__copy {
    gap: 10px;
    padding: 14px 16px 18px;
  }

  .type-card__name,
  .type-card--fly.type-card--expanding .type-card__name {
    font-size: clamp(31px, 7.8vw, 34px);
  }

  .type-card__summary,
  .type-card--expanding .type-card__summary { font-size: 17.5px; }
}

@media (max-height: 660px) {
  .carousel__kicker { display: none; }

  .carousel__stage {
    height: min(500px, 64svh);
    min-height: 440px;
  }
}

/* Phones: chevrons under the orbit. */
@media (max-width: 767px) and (orientation: portrait),
       (max-width: 767px) and (max-height: 500px) {
  .carousel__controls {
    top: auto;
    display: flex;
    gap: 18px;
    width: max-content;
    margin: 4px auto 0;
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  .type-card--expanding .type-card__art {
    height: clamp(220px, 44svh, 360px);
  }
}

/* Tablet portrait: the stage grows with the viewport height, so pull the
   controls up through its unused lower half to sit 8px below the card. */
@media (min-width: 768px) and (max-width: 900px) and (orientation: portrait) {
  .carousel__controls {
    top: auto;
    display: flex;
    gap: 18px;
    width: max-content;
    margin: min(-7px, calc(258px - 32svh)) auto 0;
  }

  .carousel__arrow {
    width: 56px;
    height: 56px;
  }

  .carousel__arrow svg {
    width: 30px;
    height: 30px;
  }
}

/* Tablets using the desktop-size card: chevrons 8px below the front card… */
@media (min-width: 768px) and (max-width: 1099px) and (min-height: 501px) and (orientation: landscape),
       (min-width: 1100px) and (max-width: 1180px) and (min-height: 781px) and (orientation: landscape),
       (min-width: 901px) and (max-width: 1180px) and (orientation: portrait) {
  .carousel__controls {
    top: auto;
    display: flex;
    gap: 18px;
    width: max-content;
    margin: clamp(-87px, calc(218px - 30.5svh), -32px) auto 0;
  }

  .carousel__arrow {
    width: 56px;
    height: 56px;
  }

  .carousel__arrow svg {
    width: 30px;
    height: 30px;
  }
}

/* …and 26px below it in landscape. */
@media (min-width: 768px) and (max-width: 1099px) and (min-height: 501px) and (orientation: landscape),
       (min-width: 1100px) and (max-width: 1180px) and (min-height: 781px) and (orientation: landscape) {
  .carousel__controls {
    margin: clamp(-69px, calc(236px - 30.5svh), -14px) auto 0;
  }
}

/* Phone landscape and compact touch landscape: wide horizontal cards with
   chevrons at the sides. Standard / larger tablets keep the desktop orbit. */
@media (max-width: 1000px) and (max-height: 500px) and (orientation: landscape),
       (pointer: coarse) and (orientation: landscape) and
       (min-width: 1100px) and (max-width: 1180px) and (max-height: 780px) {
  .service-carousel {
    --kt-card-w: min(620px, 74vw);
    --kt-card-h: 280px;
    --kt-radius: 430px;
    min-height: 100dvh;
    overflow: hidden;
  }

  /* Twelve mosaic planes: a larger radius keeps the neighbours from
     intersecting the front card while still showing the 3D sides. */
  .service-carousel--mosaic {
    --kt-card-w: min(520px, 68vw);
    --kt-card-h: 270px;
    --kt-radius: 980px;
  }

  .carousel {
    place-items: center;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 8px 0;
    overflow: hidden;
  }

  .carousel__shell { width: 100%; }
  .carousel__kicker { display: none; }

  .carousel__title {
    max-width: 460px;
    margin: 0 auto 2px;
    font-size: clamp(25px, 4.1vw, 31px);
    line-height: 0.92;
    transform: none;
  }

  .carousel__title-lead { font-size: 1em; }

  .carousel__stage {
    height: 292px;
    min-height: 292px;
    overflow: hidden;
    perspective: 1120px;
  }

  .service-carousel--mosaic .carousel__stage {
    height: 282px;
    min-height: 282px;
    overflow: visible;
  }

  .type-card { flex-direction: row; }

  .service-carousel--mosaic .carousel__cylinder .type-card--active {
    border: 2px solid rgb(237 190 112 / 0.82);
    box-shadow:
      0 24px 64px rgb(0 0 0 / 0.58),
      0 0 34px rgb(220 164 83 / 0.14),
      inset 0 0 0 1px rgb(255 239 206 / 0.08);
  }

  .service-carousel--mosaic .carousel__cylinder .type-card--active::after {
    z-index: 8;
    inset: 5px;
    border-color: rgb(255 239 206 / 0.12);
  }

  .type-card__art,
  .type-card--fly .type-card__art,
  .type-card--expanding .type-card__art,
  .service-carousel--stone .type-card--expanding:has(.type-card__image[src*="onyx-stone-luxury-ensuite-install-kiwitile"]) .type-card__art {
    flex: 0 0 46%;
    width: 46%;
    height: 100%;
    border-radius: 20px 0 0 20px;
  }

  .type-card__copy {
    gap: 8px;
    padding: 16px 20px;
    overflow-y: auto;
  }

  .type-card--expanding .type-card__copy { padding: 18px 24px; }

  .type-card__name,
  .type-card--expanding .type-card__name {
    font-size: clamp(24px, 3.5vw, 30px);
    line-height: 1;
    letter-spacing: 0.035em;
  }

  /* Opacity also wins over the swap fade here, as in the original. */
  .type-card__summary,
  .type-card--expanding .type-card__summary,
  .type-card--swapping .type-card__summary,
  .type-card--detail .type-card__summary {
    font-size: clamp(14px, 1.9vw, 16px);
    line-height: 1.46;
    opacity: 0.92;
  }

  .type-card__divider {
    width: 130px;
    height: 7px;
    margin: 2px auto 4px;
  }

  .carousel__controls {
    position: absolute;
    z-index: 12;
    top: 50%;
    right: max(8px, env(safe-area-inset-right, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    display: flex;
    justify-content: space-between;
    width: auto;
    margin: 0;
    transform: translateY(-50%);
    pointer-events: none;
  }

  .carousel__arrow {
    width: 56px;
    height: 56px;
    border: 1px solid rgb(224 176 102 / 0.34);
    border-radius: 50%;
    background: rgb(8 7 6 / 0.54);
    color: rgb(255 235 198 / 0.96);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.42);
    pointer-events: auto;
  }

  .carousel__arrow svg {
    width: 30px;
    height: 30px;
  }

  .type-card__close {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 860px) {
  .carousel__exit {
    z-index: 12;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel__cylinder,
  .type-card,
  .type-card--fly,
  .type-card--fly *,
  .carousel__focus-layer,
  .carousel__shell--detail-open .carousel__cylinder {
    transition-duration: 1ms !important;
    animation: none !important;
  }

  .carousel__cylinder {
    will-change: auto;
  }
}
