/* Front page (home) and problem → fix → result story. Loaded only on the front page. */
:root {
  --ink: #0E1A2B;
  --problem: #C2412D;
  --water: #4BA3E3;
  --fix: #1E9E6A;
  --radius-card: 20px;
  --radius-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Sinhala text: Noto Sans Sinhala (enqueued globally), always paired with English. */
[lang="si"] { font-family: "Noto Sans Sinhala", var(--font-sans); }

[id] { scroll-margin-top: var(--header-h); }
.hm-hero, .hm-about, .hm-story, .hm-ranges, .hm-why, .quote-band { overflow-x: clip; }
.hm-about__inner > * { min-width: 0; }

/* ---------- Shared section heads (used by home and the quote band) ---------- */
.band-eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--richchem-blue);
}
.band-eyebrow--light { color: var(--light-blue); }
.band-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0;
}
.band-title--light { color: var(--white); }
.band-intro { font-size: 17px; line-height: 1.55; color: var(--body-grey); margin: 16px 0 0; }
.band-head { margin-bottom: 32px; }
.band-head__rule { display: block; width: 48px; height: 3px; border-radius: 2px; background: var(--richchem-blue); margin: 20px 0; }
.band-head__rule--light { background: var(--water); }
.band--white { background: var(--white); padding: 72px 0; }

/* ---------- Hero ---------- */
.hm-hero {
  position: relative;
  display: flex;
  align-items: center;
  /* The body already reserves the fixed header and admin bar (--header-h, --admin-h). */
  padding: 32px 0 96px;
  background: var(--white);
  --hp: 0;
}
.hm-hero--photo {
  background: linear-gradient(rgba(255, 255, 255, .92), rgba(255, 255, 255, .92)), var(--hero-img) center / cover no-repeat;
}
.hm-hero__inner { display: grid; gap: 32px; align-items: center; width: 100%; }
.hm-hero__copy { min-width: 0; }
.hm-hero__title {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 8px 0 14px;
}
.hm-hero__tagline {
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 16px;
}
.hm-hero__accent { color: var(--richchem-blue); }
.hm-hero__lead { font-size: 17px; line-height: 1.55; color: var(--body-grey); max-width: 38ch; margin: 0 0 28px; }

/* All published product photos. Phones: one auto-scrolling row of square tiles (rules in the phone block below).
   Desktop (900px and up): a 3 x 3 block beside the text. */
.hm-gallery { min-width: 0; }
.hm-gallery__track {
  list-style: none;
  margin: 0;
  padding: 0;
}
.hm-gallery__item { min-width: 0; }
.hm-gallery__item a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--ink);
  text-decoration: none;
}
.hm-gallery__item img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; }
.hm-gallery__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--ink);
}
@media (max-width: 899px) {
  /* The scroll cue only made sense over the old sideways row. */
  .hm-cue { display: none; }

  /* Phone marquee: full-bleed row, 112px tiles, 12px gap, soft fade at both screen edges. */
  .hm-hero { padding-bottom: 8px; }   /* + 32px marquee margin = 40px down to "About us" */
  .hm-hero__inner { gap: 24px; }      /* 24px between the buttons and the row */
  .hm-gallery {
    position: relative;
    width: 100vw;
    margin: 0 0 32px calc(50% - 50vw);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  }
  .hm-gallery__track {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    width: max-content;
    /* Trailing gap so each copy is exactly half the track: translateX(-50%) lands on the seam. */
    padding-right: 12px;
    animation: hm-marquee 35s linear infinite;
    will-change: transform;
  }
  .hm-gallery:hover .hm-gallery__track,
  .hm-gallery:focus-within .hm-gallery__track,
  .hm-gallery__track:active { animation-play-state: paused; }
  .hm-gallery__item {
    flex: 0 0 112px;
    width: 112px;
    padding: 10px;
    background: #F5F7FA;
    border: 0;
    border-radius: 18px;
  }
  .hm-gallery__item a { height: 100%; }
  .hm-gallery__item img { mix-blend-mode: multiply; }  /* white photo backgrounds melt into the tile */
  .hm-gallery__name { display: none; }                /* alt text on the link carries the name */
}
@keyframes hm-marquee {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  /* No motion: the row becomes a normal horizontal scroll-snap row. */
  .hm-gallery {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
  }
  .hm-gallery::-webkit-scrollbar { display: none; }
  .hm-gallery__track { animation: none; width: auto; padding: 0 16px; will-change: auto; }
  .hm-gallery__item { scroll-snap-align: start; }
  .hm-gallery__item--dup { display: none; }
}

.hm-cue {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 24px;
  height: 40px;
  margin-left: -12px;
  border: 2px solid var(--secondary-grey);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.hm-cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--richchem-blue);
  animation: hm-cue 1.8s var(--ease) infinite;
}
@keyframes hm-cue {
  0% { transform: translateY(0); opacity: 1; }
  80% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(14px); opacity: 0; }
}

@media (min-width: 900px) {
  .hm-hero { padding: 40px 0 120px; }
  .hm-hero__inner { grid-template-columns: 1fr 1fr; gap: 64px; }
  /* Three per row: nine photos form a 3 x 3 block, and a short last row is centred. */
  .hm-gallery__track {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    width: auto;
    padding: 0;
    animation: none;
    will-change: auto;
  }
  .hm-gallery__item--dup { display: none; }
  .hm-gallery__item {
    flex: 0 0 calc((100% - 24px) / 3);
    max-width: none;
    background: var(--background);
    border: 0;
    border-radius: var(--radius-card);
    padding: 12px;
  }
  .hm-gallery__name { font-size: 13px; margin-top: 10px; }
  /* --hp (0 → 1 while the hero scrolls away) lifts the middle column and drops the last slightly. */
  .hm-gallery__item:nth-child(3n+2) { transform: translate3d(0, calc(var(--hp) * -24px), 0); will-change: transform; }
  .hm-gallery__item:nth-child(3n) { transform: translate3d(0, calc(var(--hp) * 12px), 0); }
}

/* ---------- Who we are: text, then four stat cards (two columns on desktop, one on phones) ---------- */
.hm-about { background: var(--background); padding: clamp(56px, 8vw, 104px) 0; }
.hm-about__inner { display: grid; gap: 36px; align-items: center; }
.hm-about__intro { min-width: 0; }
.hm-about__eyebrow { letter-spacing: .16em; }
.hm-about__title {
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0 0 20px;
}
.hm-about__lead {
  font-size: clamp(20px, 2vw, 22px);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  max-width: 34ch;
  margin: 0 0 16px;
}
.hm-about__body { font-size: 17px; line-height: 1.55; color: var(--body-grey); max-width: 52ch; margin: 0; }
.hm-about__actions { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.hm-about__actions .btn { width: 100%; }

.hm-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.hm-stat {
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 16px;
  transition: transform .3s var(--ease), border-color .3s var(--ease);
}
.hm-stat__icon {
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--light-blue);
  color: var(--richchem-blue);
  display: grid;
  place-items: center;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.hm-stat__icon svg { width: 18px; height: 18px; }
.hm-stat__value {
  display: block;
  font-size: clamp(19px, 5.6vw, 22px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hm-stat__label { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--secondary-grey); }
/* Text values fade and slide in with the card (JS only; with no JS or reduced motion they show at once). */
html.js-story .hm-stat__value--text { opacity: 0; transform: translate3d(0, 10px, 0); transition: opacity .7s var(--ease) .15s, transform .7s var(--ease) .15s; }
html.js-story .hm-stats.is-in .hm-stat__value--text { opacity: 1; transform: none; }
@media (hover: hover) {
  .hm-stat:hover { transform: translateY(-4px); border-color: var(--richchem-blue); }
  .hm-stat:hover .hm-stat__icon { background: var(--richchem-blue); color: var(--white); }
}

@media (min-width: 900px) {
  .hm-about { padding: clamp(56px, 8vw, 104px) 0; }
  .hm-about__inner { grid-template-columns: 1.1fr 1fr; gap: 56px; }
  .hm-about__actions { flex-direction: row; flex-wrap: wrap; }
  .hm-about__actions .btn { width: auto; }
  .hm-stats { gap: 16px; }
  .hm-stat { padding: 24px; }
  .hm-stat__icon { width: 44px; height: 44px; margin-bottom: 20px; border-radius: 12px; }
  .hm-stat__icon svg { width: 22px; height: 22px; }
  .hm-stat__value { font-size: clamp(20px, 2vw, 32px); }
  .hm-stat__label { margin-top: 8px; }
}

/* ---------- Story ---------- */
.hm-story { background: var(--white); padding: 72px 0 24px; }
.hm-story__head { padding-bottom: 8px; }
.hm-story__head .band-intro { max-width: 52ch; }
@media (min-width: 900px) { .hm-story { padding-top: 96px; } }

.story-chapter { position: relative; }
.story-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 max(16px, env(safe-area-inset-left)) 16px max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
/* Scene: 52svh on phones (no band above it), 16:10 on desktop. Three stacked SVG layers. */
.story-stage__scene {
  position: relative;
  flex: none;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--light-blue);
  contain: paint;
}
@media (max-width: 899px) {
  .story-stage__scene { height: min(30svh, 260px); min-height: 200px; }
}
.story-scene-stack { position: absolute; inset: 0; }
.story-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Before = problem state, shown on the left of the split. After = fixed state, shown on the right. */
.story-scene--before { clip-path: inset(0 calc(var(--resp) * 50%) 0 0); }
.story-scene--after { clip-path: inset(0 0 0 calc(var(--resp) * 50%)); }
.story-chapter.is-live .story-scene--before,
.story-chapter.is-live .story-scene--after { will-change: clip-path; }
.story-scene--fx { pointer-events: none; }

.story-stage__si { margin: -6px 0 12px; font-size: 16px; font-weight: 600; color: var(--secondary-grey); }
.story-stage__title {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0 0 14px;
}

/* Progress: three segments, the active one filled. */
.story-progress { display: flex; gap: 8px; list-style: none; margin: 0 0 16px; padding: 0; }
.story-progress__item { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--secondary-grey); }
.story-progress__item::before { content: ""; display: block; height: 4px; margin-bottom: 8px; border-radius: 2px; background: var(--hairline); }
.story-chapter[data-step="1"] .story-progress__item--1,
.story-chapter[data-step="2"] .story-progress__item--2,
.story-chapter[data-step="3"] .story-progress__item--3,
html:not(.js-story) .story-progress__item { color: var(--ink); }
.story-chapter[data-step="1"] .story-progress__item--1::before,
.story-chapter[data-step="2"] .story-progress__item--2::before,
.story-chapter[data-step="3"] .story-progress__item--3::before,
html:not(.js-story) .story-progress__item::before { background: var(--richchem-blue); }

.story-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.story-step { display: flex; flex-direction: column; gap: 4px; }
.story-step__label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.story-step--1 .story-step__label { color: var(--problem); }
.story-step--2 .story-step__label { color: var(--richchem-blue); }
.story-step--3 .story-step__label { color: var(--fix); }
.story-step__text { font-size: 17px; line-height: 1.55; color: var(--body-grey); }
.story-note {
  margin: 16px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--richchem-blue);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

/* Before | After divider: white line, round handle, labels. Position follows --resp. */
.story-compare { position: absolute; inset: 0; pointer-events: none; opacity: clamp(0, var(--resp) * 6, 1); }
.story-compare__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--resp) * 50%);
  width: 3px;
  margin-left: -1.5px;
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(14, 26, 43, .12);
}
.story-compare__handle {
  position: absolute;
  top: 50%;
  left: calc(var(--resp) * 50%);
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 12px rgba(14, 26, 43, .28);
}
.story-compare__handle::before,
.story-compare__handle::after {
  content: "";
  position: absolute;
  top: 17px;
  width: 8px;
  height: 8px;
  border-top: 2.5px solid var(--ink);
  border-left: 2.5px solid var(--ink);
}
.story-compare__handle::before { left: 12px; transform: rotate(-45deg); }
.story-compare__handle::after { left: 22px; transform: rotate(135deg); }
.story-compare__label {
  position: absolute;
  top: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.story-compare__label--before { left: 12px; color: var(--problem); }
.story-compare__label--after { right: 12px; color: var(--fix); }

.story-end .story-note { margin: 0 0 24px; }
.story-end { padding: 8px 0 64px; border-bottom: 1px solid var(--hairline); margin-bottom: 8px; }
.story-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 16px; padding: 0; }
.story-chip {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.story-chip:hover { border-color: var(--richchem-blue); color: var(--richchem-blue); }
.story-end__ask { margin: 0; }

@media (min-width: 900px) {
  .story-stage {
    display: grid;
    grid-template-columns: 1.75fr 1fr;
    gap: 56px;
    align-items: center;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 16px 16px;
  }
  .story-stage__scene { height: auto; min-height: 0; aspect-ratio: 16 / 10; max-height: calc(100svh - var(--header-h) - var(--admin-h) - 64px); }
  .story-stage__text { min-width: 0; }
  .story-stage__title { margin-bottom: 16px; }
}

/* Short phones (390x667 and similar): tighter stage so the text column fits beside the scene. */
@media (max-width: 899px) and (max-height: 720px) {
  .story-stage { padding-bottom: 8px; }
  .story-stage__scene { height: min(30svh, 250px); }
  .story-progress { margin-bottom: 12px; }
  .story-stage__title { font-size: 24px; margin-bottom: 10px; }
}

/* Scrolling story: only when story.js has started (html.js-story). */
html.js-story .story-chapter { height: 170svh; --p: 0; }
html.js-story .story-chapter .story-stage { position: sticky; top: calc(var(--header-h) + var(--admin-h, 0px)); height: calc(100svh - var(--header-h) - var(--admin-h, 0px)); overflow: hidden; justify-content: flex-start; }
html.js-story .story-steps { display: grid; }
html.js-story .story-step { grid-area: 1 / 1; opacity: 0; transform: translate3d(0, 14px, 0); transition: opacity .5s var(--ease), transform .5s var(--ease); }
html.js-story .story-chapter[data-step="1"] .story-step--1,
html.js-story .story-chapter[data-step="2"] .story-step--2,
html.js-story .story-chapter[data-step="3"] .story-step--3 { opacity: 1; transform: none; }
@media (min-width: 900px) {
  html.js-story .story-chapter { height: 200svh; }
  html.js-story .story-chapter .story-stage { height: calc(100svh - var(--header-h) - var(--admin-h, 0px)); justify-content: normal; }
}

/* Static fallback (no JS, reduced motion): final before | after state, all steps listed. */
html:not(.js-story) .story-chapter { --p: 1; }
.story-chapter { --fixp: clamp(0, (var(--p) - .33) * 3, 1); --resp: clamp(0, (var(--p) - .66) * 3, 1); }

/* Visual column: scene, then the product panel (beside the scene on desktop, under it on phones). */
.story-stage__visual { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Product panel: the pack and its name, with a one-line benefit. Slides in from the FIX phase (--fixp); the name
   cross-fades into a "Used:" badge in RESULT (--resp). Keeps its space from the start, so nothing shifts. */
.story-product {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  opacity: var(--fixp);
  transform: translate3d(0, calc((1 - var(--fixp)) * 16px), 0);
}
.story-product__media { display: flex; align-items: flex-end; gap: 6px; flex: none; }
.story-product__main img { display: block; width: auto; height: 88px; max-width: 96px; object-fit: contain; }
.story-product__thumb img { display: block; width: auto; height: 36px; max-width: 44px; object-fit: contain; }
.story-product__name { grid-area: 1 / 1; margin: 0; font-size: 15px; font-weight: 800; line-height: 1.25; color: var(--ink); opacity: calc(1 - var(--resp)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-product__used {
  grid-area: 1 / 1;
  align-self: start;
  justify-self: start;
  margin: 0;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--light-blue);
  font-size: 13px;
  font-weight: 600;
  color: var(--deep-corporate-blue);
  opacity: var(--resp);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-product__text { display: grid; min-width: 0; flex: 1; }
.story-product__benefit { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--secondary-grey); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (min-width: 900px) {
  .story-stage__visual { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; align-items: center; }
  .story-product {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    transform: translate3d(calc((1 - var(--fixp)) * 48px), 0, 0);
  }
  .story-product { overflow: hidden; min-width: 0; }
  .story-product__media { flex-wrap: wrap; }
  .story-product__main img { height: 180px; max-width: 150px; }
  .story-product__thumb img { height: 56px; max-width: 64px; }
  .story-product__benefit { font-size: 14px; }
}

/* Photos mode: BEFORE full-bleed; AFTER wipes in from the left (--fixp); RESULT splits BEFORE | AFTER (--resp). */
.story-photos { position: absolute; inset: 0; overflow: hidden; }
.story-photos .story-photo--before { clip-path: inset(0 calc(var(--resp) * 50%) 0 0); }
/* Photo layers: <picture> sits over the scene; the img fills it (cover). Before and after share framing, so the split lines up. */
.story-photo { display: block; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.story-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Layers: only the one matching the chosen mode is shown (display:none costs no paint). */
.story-layer { position: absolute; inset: 0; }
.story--photos .story-layer--drawings,
.story--drawings .story-layer--photos { display: none; }
.story--photos .story-chapter--fixed .story-layer--drawings { display: block; }
.story-photo-after { position: absolute; inset: 0; clip-path: inset(0 calc((1 - var(--fixp)) * 100%) 0 0); }
.story-photo-after .story-photo--after { clip-path: inset(0 0 0 calc(var(--resp) * 50%)); }
.story-wipe {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--fixp) * 100%);
  width: 4px;
  margin-left: -2px;
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(14, 26, 43, .12), 0 0 16px rgba(14, 26, 43, .28);
  opacity: calc(clamp(0, var(--fixp) * 8, 1) * (1 - clamp(0, (var(--fixp) - .97) * 33, 1)) * (1 - var(--resp)));
  pointer-events: none;
}

/* ---------- Scene animation: only transform, opacity and clip-path, driven by --p / --fixp / --resp ---------- */
.story-scene--after .sc-fade { opacity: clamp(0, 1 - var(--fixp) * 1.6, 1); }
.story-scene .sc-drip { transform: translateY(calc(var(--p) * 40px)); }
.story-scene .sc-rain { transform: translateY(calc(var(--p) * 26px)); }
.story-scene .sc-stain { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(calc(.6 + var(--p) * .5)); }

/* Roof: coat rolled left to right, roller leads the coat, beads roll off, check. */
.story-scene--after .sc-coat { transform-box: fill-box; transform-origin: 0 50%; transform: scaleX(var(--fixp)); }
.story-scene--fx .sc-roller {
  transform: translateX(calc(var(--fixp) * 760px));
  opacity: calc(min(1, var(--fixp) * 10) * (1 - var(--resp)));
}
.story-scene--fx .sc-beads {
  transform: translate(calc(var(--resp) * 20px), calc(var(--resp) * 160px));
  opacity: calc(min(1, var(--resp) * 6) * (1 - var(--resp)));
}

/* Damp wall: fresh plaster rises from the floor (scaleY from the bottom), trowel leads, picture appears. */
.story-scene--after .sc-plaster { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(var(--fixp)); }
.story-scene--after .sc-pic { opacity: var(--resp); }
.story-scene--fx .sc-trowel {
  transform: translateY(calc(var(--fixp) * -404px));
  opacity: calc(min(1, var(--fixp) * 10) * (1 - clamp(0, (var(--fixp) - .9) * 10, 1)) * (1 - var(--resp)));
}

/* Tiles: adhesive combed in, tiles drop flat in turn (--d), grout fills white. */
.story-scene--before .sc-tile {
  transform: translateY(calc(var(--lift) * -1px)) rotate(calc(var(--tilt) * 1deg));
}
.story-scene--after .sc-tile {
  transform-box: fill-box;
  transform-origin: center;
  transform:
    translateY(calc((1 - clamp(0, (var(--fixp) - var(--d)) * 3, 1)) * var(--lift) * -1px))
    rotate(calc((1 - clamp(0, (var(--fixp) - var(--d)) * 3, 1)) * var(--tilt) * 1deg));
}
.story-scene--after .sc-adhesive {
  transform-box: fill-box;
  transform-origin: 0 50%;
  transform: scaleX(clamp(0, var(--fixp) * 4, 1));
  opacity: calc(clamp(0, var(--fixp) * 6, 1) * (1 - clamp(0, (var(--fixp) - .55) * 3, 1)));
}
.story-scene--after .sc-grout { opacity: clamp(0, (var(--fixp) - .55) * 3, 1); }

/* Concrete: bond coat brushed across the patch, repair mortar fills it from the bottom, strength bar fills. */
.story-scene--after .sc-bond { transform-box: fill-box; transform-origin: 0 50%; transform: scaleX(clamp(0, var(--fixp) * 2.5, 1)); }
.story-scene--after .sc-mortar { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(clamp(0, (var(--fixp) - .35) * 2.5, 1)); }
.story-scene--after .sc-meter { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(var(--fixp)); }

/* Result check, shared. */
.story-scene--fx .sc-check { transform-box: fill-box; transform-origin: 50% 50%; transform: scale(var(--resp)); }

/* Drawings extras. Roof: loupe on the crack; the two crack halves part slightly and the elastic coat covers them. */
.story-scene--fx .sc-loupe { opacity: clamp(0, (var(--fixp) - .5) * 6, 1); }
.story-scene--fx .sc-crack-l { transform: translate(calc(var(--fixp) * -2px), calc(var(--fixp) * -1px)); }
.story-scene--fx .sc-crack-r { transform: translate(calc(var(--fixp) * 2px), calc(var(--fixp) * 1px)); }
.story-scene--fx .sc-loupe-coat {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transform: scaleX(calc(.9 + var(--fixp) * .1));
  opacity: clamp(0, (var(--fixp) - .15) * 2, 1);
}
/* Tiles and concrete: the pull arrow (tiles) and pull-off disc (concrete) appear in RESULT; the tile stays put. */
.story-scene--fx .sc-pull { opacity: clamp(0, var(--resp) * 5, 1); transform: translateY(calc(var(--resp) * -10px)); }
.story-scene--fx .sc-dolly { opacity: clamp(0, var(--resp) * 5, 1); }
/* Damp wall: efflorescence (white salt) fades as the plaster goes on. */
.story-scene .sc-salt { opacity: calc(1 - var(--fixp)); }

/* ---------- Photos / Animation switch, at the top of the story ---------- */
.story-switch-row { display: flex; justify-content: flex-end; margin: 0 auto 16px; }
.story-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--light-blue);
}
.story-switch[hidden] { display: none; }
.story-switch__btn {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.story-switch__btn[aria-pressed="true"] { background: var(--richchem-blue); color: #FFFFFF; }
.story-switch__btn:focus-visible { outline: 3px solid var(--richchem-blue); outline-offset: 2px; }
@media (min-width: 900px) {
  .story-switch { width: auto; min-width: 280px; }
  .story-switch__btn { min-height: 40px; }
}

/* ---------- How well it works: callout pins over the scene, meters in the product panel ----------
   Each callout is a full-scene layer positioned in % coordinates. --at is the progress at which it appears; it
   fades in with --p, staggered. The leader is an SVG line, so the pin and label sit either side of the handle. */
.story-callout {
  --show: clamp(0, (var(--p) - var(--at)) * 8, 1);
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: var(--show);
}
.story-callout__lead { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.story-callout__lead line { fill: none; vector-effect: non-scaling-stroke; }
.story-callout__halo { stroke: #FFFFFF; stroke-width: 4; stroke-linecap: round; }
.story-callout__line { stroke: #0E1A2B; stroke-width: 1.5; stroke-linecap: round; }
.story-callout__pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  background: var(--richchem-blue);
  box-shadow: 0 1px 6px rgba(14, 26, 43, .35);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  transform: scale(calc(.6 + .4 * var(--show)));
}
.story-callout__tag {
  position: absolute;
  left: var(--tx);
  top: var(--ty);
  transform: translateY(-50%);
  width: max-content;
  max-width: 136px;
  padding: 6px 9px;
  border-radius: 10px;
  border-left: 3px solid var(--richchem-blue);
  background: #FFFFFF;
  box-shadow: 0 2px 10px rgba(14, 26, 43, .18);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}
.story-callout__tag--l { transform: translate(-100%, -50%); }
.story-callout__label { display: flex; align-items: center; gap: 5px; font-weight: 700; }
.story-callout__icon { flex: none; }
.story-callout__detail { display: block; margin-top: 2px; font-size: 12px; color: var(--body-grey); }

.story-product__meters { display: grid; gap: 10px; width: 100%; min-width: 0; flex: 1 1 100%; }
.story-meter { min-width: 0; }
.story-meter__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 6px; }
.story-meter__label { font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.story-meter__tag {
  padding: 1px 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--secondary-grey);
  white-space: nowrap;
}
.story-meter__track { display: block; height: 8px; border-radius: 4px; background: var(--light-blue); overflow: hidden; }
.story-meter__fill { display: block; width: 100%; height: 100%; background: var(--richchem-blue); transform-origin: 0 50%; transform: scaleX(var(--mv)); }
.story-meter--down .story-meter__fill { transform: scaleX(calc(1 - var(--mv))); }
/* Gauge: a semicircle dial and a needle that turns from --a to --b degrees with --mv. */
.story-meter--gauge { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 4px 10px; align-items: center; }
.story-meter--gauge .story-meter__head { grid-column: 2; grid-row: 1; margin: 0; }
.story-meter__dial { grid-column: 1; grid-row: 1; display: block; width: 84px; height: auto; overflow: visible; }
.story-meter__needle { transform-origin: 50px 52px; transform: rotate(calc(var(--a) + (var(--b) - var(--a)) * var(--mv))); }

/* Phones: the panel wraps so the meters sit under the pack and name. */
.story-product { flex-wrap: wrap; }
@media (max-width: 899px) {
  .story-product__meters { order: 3; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; }
  .story-stage__visual { gap: 10px; }
  .story-product { padding: 8px 12px; }
  .story-stage { gap: 8px; }
  .story-stage__si { margin-bottom: 8px; }
  .story-progress { margin-bottom: 12px; }
  .story-product__main img { height: 56px; max-width: 64px; }
  .story-product__benefit { -webkit-line-clamp: 1; }
  .story-product__thumb img { height: 30px; max-width: 40px; }
  .story-meter--gauge { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .story-meter--gauge .story-meter__head { grid-column: 1; grid-row: 2; }
  .story-meter__dial { grid-column: 1; grid-row: 1; width: 60px; justify-self: start; }
}

@media (min-width: 900px) {
  .story-callout__tag { max-width: 210px; font-size: 14px; }
  .story-callout__detail { font-size: 13px; }
  .story-callout__pin { width: 26px; height: 26px; margin: -13px 0 0 -13px; font-size: 13px; line-height: 22px; }
  .story-product__meters { flex: none; }
  .story-meter--gauge { grid-template-columns: 1fr; }
  .story-meter--gauge .story-meter__head { grid-column: 1; grid-row: 2; }
  .story-meter__dial { grid-column: 1; grid-row: 1; width: 110px; justify-self: start; }
}

/* ---------- Ranges ---------- */
.hm-ranges { background: var(--white); padding: 72px 0; }
.hm-range-grid { display: grid; gap: 16px; margin-top: 8px; }
@media (min-width: 600px) { .hm-range-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .hm-range-grid { grid-template-columns: repeat(5, 1fr); } }
.hm-range {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--light-blue);
  color: var(--ink);
  text-decoration: none;
  transition: transform .4s var(--ease);
}
@media (hover: hover) { .hm-range:hover { transform: translateY(-4px); } }
.hm-range__count { font-size: 13px; color: var(--secondary-grey); }
.hm-range__name { font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.hm-range__text { font-size: 14px; line-height: 1.5; color: var(--body-grey); flex: 1; }
.hm-range__link { font-size: 14px; font-weight: 600; color: var(--richchem-blue); margin-top: 8px; }

/* ---------- Why / reviews ---------- */
.hm-why { background: var(--background); padding: 72px 0; }
.hm-reasons { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 900px) {
  .hm-reasons { grid-template-columns: repeat(3, 1fr); }
  .hm-why, .hm-ranges, .hm-story { padding-top: 96px; }
  .hm-why { padding-bottom: 96px; }
}
.hm-reason { position: relative; overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease); background: var(--white); border: 1px solid var(--hairline); border-radius: var(--radius-card); padding: 28px; }
.hm-reason__num { display: block; font-size: 13px; font-weight: 600; color: var(--richchem-blue); margin-bottom: 12px; transition: transform .35s var(--ease), color .35s var(--ease); transform-origin: left center; }
/* Top bar that grows across the card on hover (desktop pointers only). */
.hm-reason::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--richchem-blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
@media (hover: hover) {
  .hm-reason:hover, .hm-reason:focus-within {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(36, 82, 143, .14);
    border-color: var(--richchem-blue);
  }
  .hm-reason:hover::before, .hm-reason:focus-within::before { transform: scaleX(1); }
  .hm-reason:hover .hm-reason__num, .hm-reason:focus-within .hm-reason__num { transform: scale(1.15); color: var(--richchem-blue); }
}
.hm-reason h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: var(--ink); }
.hm-reason p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--body-grey); }

/* ---------- Closing quote band ---------- */
.quote-band { background: var(--ink); color: var(--light-blue); padding: 72px 0; }
.quote-band__inner { display: grid; gap: 40px; align-items: start; }
.quote-band__copy p { color: var(--light-blue); font-size: 17px; line-height: 1.55; margin: 0 0 16px; }
.quote-band__copy a { color: var(--white); }
.quote-band__contact { font-size: 18px; font-weight: 600; }
@media (min-width: 900px) {
  .quote-band { padding: 96px 0; }
  .quote-band__inner { grid-template-columns: 1fr 1fr; gap: 72px; }
}

/* ---------- Reveals (fade-up, only with JS) ---------- */
html.js-story [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
html.js-story [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .hm-cue span { animation: none; }
  .hm-gallery__item, .hm-range { transition: none; }
  /* Stat cards: colour change only, no lift. */
  .hm-stat, .hm-stat__icon { transition: border-color .35s, background-color .35s, color .35s; }
  @media (hover: hover) { .hm-stat:hover { transform: none; } }
  /* Reason cards: colour change only, no transforms. */
  .hm-reason, .hm-reason::before, .hm-reason__num { transition: border-color .35s, color .35s, box-shadow .35s; }
  .hm-reason::before { transform: none; opacity: 0; }
  @media (hover: hover) {
    .hm-reason:hover, .hm-reason:focus-within { transform: none; }
    .hm-reason:hover::before, .hm-reason:focus-within::before { opacity: 1; }
    .hm-reason:hover .hm-reason__num, .hm-reason:focus-within .hm-reason__num { transform: none; }
  }
}
