/* The home page: the engine strip-down. Loads after site.css, which holds the shared header, buttons, form and footer. */
@media (max-width: 959px) {
  :root { --brand-hero: clamp(44px, 12.5vw, 60px); } /* the logo's height in the opening view on phones */
}

/* While the logo travels from the opening view into the header, or fades in on the still page. */
.brand-fade .brand { opacity: 0; transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.brand-fade.brand-in .brand { opacity: 1; }
.brand-morph .strip__logo img { opacity: 0; } /* the header logo stands in for it while it moves */

.strip__logo { margin: 0 0 28px; }
.strip__logo img { display: block; width: min(100%, 21rem); height: auto; }
.lede { color: var(--soft); font-size: 1.05rem; margin: 0 0 26px; max-width: 30rem; }
.actions { margin: 0; }

/* ---------- Still version: no script, or the visitor is saving data ---------- */
.strip { position: relative; padding: 104px var(--edge) 56px; }
.strip__stage { display: flex; flex-direction: column; gap: 32px; }
.strip__copy, .strip__scroll { display: contents; } /* the scroll wrapper only takes shape on phones */
.strip__intro { order: 0; max-width: 36rem; }
.strip__film { order: 1; position: relative; margin: 0 auto; width: min(100%, 760px); aspect-ratio: 1; }
.strip__list { order: 2; }
.strip__cta { order: 3; align-self: center; }
.strip__still { display: block; width: 100%; height: 100%; }
.strip__poster, .strip__canvas, .strip__lines, .strip__cue { display: none; }

.strip__cutout {
  position: absolute; left: calc(var(--x) * 100%); top: calc(var(--y) * 100%);
  width: calc(var(--w) * 100%); height: auto; translate: -50% -50%; pointer-events: none;
}

.marker {
  position: absolute; left: calc(var(--x) * 100%); top: calc(var(--y) * 100%); translate: -50% -50%;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.55);
}

.strip__list {
  list-style: none; margin: 0 auto; padding: 0; width: 100%; max-width: 1000px;
  display: grid; gap: 6px 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.callout a {
  display: grid; grid-template-columns: 2.4em 1fr; grid-template-areas: "num name" ". line";
  column-gap: 10px; padding: 10px 0; text-decoration: none;
}
.callout__num { grid-area: num; color: var(--accent); font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; padding-top: 0.15em; }
.callout__name { grid-area: name; font-weight: 700; font-size: 1.02rem; line-height: 1.5; }
.callout__line { grid-area: line; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.callout a:hover .callout__name, .callout a:focus-visible .callout__name { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
/* Each service opens its own page; the arrow after its name says so. */
.callout .i-arrow { display: inline-block; width: 0.78em; height: 0.78em; margin-left: 0.32em; vertical-align: -0.04em; color: var(--accent); transition: translate 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.callout a:hover .i-arrow, .callout a:focus-visible .i-arrow { translate: 3px 0; }

/* ---------- Film version ---------- */
.film-on { --film: min(100vh - 128px, 46vw); }
/* The small-viewport (svh) sizes sit in @supports. In a custom property, or beside var(), a browser that doesn't know
   svh would drop the whole value rather than fall back to vh, and the engine would shrink to nothing. */
@supports (height: 1svh) { .film-on { --film: min(100svh - 128px, 46vw); } }
.film-on .strip { height: 720vh; padding: 0; }
.film-on .strip__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: block; }
.film-on .strip__film { position: absolute; margin: 0; left: 50%; top: 50%; width: var(--film); translate: -50% -50%; }
.film-on .strip__still { display: none; }
.film-on .strip__poster, .film-on .strip__canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.film-on .strip__film.is-drawn .strip__poster { visibility: hidden; }
/* Until it has drawn its first frame the canvas is an opaque black square, so it stays hidden and the poster shows
   (on a slow connection that can take a few seconds on phones, which play the smaller frames). */
.film-on .strip__canvas { visibility: hidden; }
.film-on .strip__film.is-drawn .strip__canvas { visibility: visible; }
.film-on .strip__cutout { visibility: hidden; opacity: 0; translate: none; } /* the script centres them */
.film-on .marker { display: none; }

.film-on .strip__intro {
  position: absolute; z-index: 2; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center;
  left: var(--edge); width: min(30rem, calc((100vw - var(--film)) / 2 - var(--edge) - 24px));
}
.film-on .strip__intro.is-gone { pointer-events: none; }

.film-on .strip__lines { display: block; position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: visible; }
.lines { opacity: 0; visibility: hidden; }
.lines[data-beat="A"] { opacity: 1; visibility: visible; }
.line { fill: none; stroke: var(--faint); stroke-width: 1; }
.line.is-fresh { stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 1; }
.dot { fill: var(--bg); stroke: var(--muted); stroke-width: 1.25; }
.dot.is-fresh { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.line.is-hot { stroke: var(--accent); stroke-width: 1.6; }
.dot.is-hot { fill: var(--accent); stroke: #fff; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.lines[data-beat="A"] .line.is-fresh { animation: draw 1s 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; }

.film-on .strip__list { position: absolute; inset: 0; z-index: 2; display: block; max-width: none; margin: 0; pointer-events: none; }
.film-on .callout { position: absolute; top: 0; pointer-events: auto; visibility: hidden; }
.film-on .callout[data-beat="A"] { visibility: visible; }
.film-on .callout a { padding: 0; }
.film-on .callout[data-side="left"] a { grid-template-columns: 1fr 2.4em; grid-template-areas: "name num" "line ."; text-align: right; }
.film-on .callout[data-side="left"] .callout__num { text-align: left; }
.film-on .callout__line { font-size: 0.86rem; }
.film-on .callout[data-state="past"] .callout__num,
.film-on .callout[data-state="past"] .callout__name { color: var(--muted); }
.film-on .callout[data-state="past"] .callout__line,
.film-on .strip__list.is-compact .callout__line { display: none; }
.film-on .strip__list.is-full .callout__line { display: block; }
.film-on .callout[data-state="past"] a:hover .callout__name { color: var(--ink); }

.film-on .strip__cta { position: absolute; z-index: 2; left: 0; right: 0; bottom: 26px; width: max-content; margin: 0 auto; visibility: hidden; }
.film-on .strip__cue {
  display: block; position: absolute; left: 50%; bottom: 22px; translate: -50% 0; margin: 0; white-space: nowrap;
  color: var(--muted); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
}

/* Phones and narrow windows: the logo in the header, the film under it, and under that a window onto the
   services, numbered to match markers on the parts. When a stage has more than fits, the window scrolls
   with the page while the film holds, so nothing is cut off on small screens. */
@media (max-width: 959px) {
  .film-on { --film: max(160px, min(100vw - 24px, 50vh, 100vh - 264px)); }
  @supports (height: 1svh) { .film-on { --film: max(160px, min(100vw - 24px, 50svh, 100svh - 264px)); } }
  .film-on .strip { height: 900vh; }
  .film-on .strip__film { top: var(--head); translate: -50% 0; }
  .film-on .strip__lines { display: none; }
  .film-on .strip__copy {
    --fade-top: 0px; --fade-bottom: 0px;
    display: block; position: absolute; z-index: 2; left: var(--edge); right: var(--edge);
    top: calc(var(--head) + var(--film) + 14px); bottom: 0; overflow: hidden;
    -webkit-mask-image: linear-gradient(transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
    mask-image: linear-gradient(transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
  }
  .film-on .strip__copy.has-above { --fade-top: 16px; }
  .film-on .strip__copy.has-below { --fade-bottom: 36px; }
  .film-on .strip__scroll { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
  .film-on .strip__intro { position: static; display: block; width: auto; }
  .film-on .strip__intro.is-gone { display: none; }
  /* The logo shows in the header on phones; the heading itself stays for screen readers. */
  .film-on .strip__logo { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .film-on .lede { font-size: 1rem; margin-bottom: 16px; }
  .film-on .strip__list { position: static; display: flex; flex-direction: column; gap: 14px; }
  .film-on .callout { position: static; display: none; }
  .film-on .callout[data-state="current"] { display: block; }
  .film-on .callout[data-side="left"] a { grid-template-columns: 2.4em 1fr; grid-template-areas: "num name" ". line"; text-align: left; }
  /* The end: all ten by name, then the booking button. */
  .film-on .strip[data-phase="list"] .callout { display: block; }
  .film-on .strip[data-phase="list"] .strip__list { gap: 0; }
  .film-on .strip[data-phase="list"] .callout a { padding: 5px 0; }
  .film-on .strip__cta { display: none; position: static; width: auto; margin: 4px 0 0; align-self: flex-start; }
  .film-on .strip[data-phase="list"] .strip__cta { display: inline-block; }
  .film-on .strip__cue { top: calc(var(--head) + var(--film) - 2.4em); bottom: auto; }
  .film-on .marker { display: grid; opacity: 0; scale: 0.6; transition: opacity 0.25s, scale 0.25s; }
  .film-on .marker.is-on { opacity: 0.5; scale: 0.75; }
  .film-on .marker.is-current { opacity: 1; scale: 1; }
  .film-on .strip__film.is-moving .marker { opacity: 0; }
  /* No header links on the home page here, to keep the opening view clear: with script, the menu button stands in. */
  .site-head nav > .nav-svc, .site-head nav > a { display: none; }
  .js .nav-menu { display: inline-flex; }
}

/* Phones on their side: too short to stack, so the services window sits on the left under the logo and the film on the right. */
@media (max-width: 959px) and (orientation: landscape) and (max-height: 520px) {
  :root { --brand-hero: 44px; } /* the logo starts just above the text here, so it starts smaller */
  .film-on { --film: min(100vh - var(--head) - 12px, 48vw); }
  @supports (height: 1svh) { .film-on { --film: min(100svh - var(--head) - 12px, 48vw); } }
  .film-on .strip__film { top: var(--head); left: auto; right: var(--edge); translate: none; }
  .film-on .strip__copy { top: calc(var(--head) + 10px); right: calc(var(--edge) + var(--film) + 24px); }
  .film-on .strip__cue { left: calc(100% - var(--edge) - var(--film) / 2); }
}

/* ---------- Why bring it to us: after the ten services, before the booking form ---------- */
/* It shares the booking form's column, so the heading, the story and "Book a service" keep one left edge. */
.why { max-width: 640px; margin: 0 auto; padding: clamp(80px, 12vh, 140px) 20px 0; }
/* The same size as "Book a service" below it, so the two headings read as one sequence into the form. */
.why__title { margin: 0 0 22px; font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.1; text-wrap: balance; }
.why__story { display: grid; gap: clamp(18px, 2.4vh, 26px); }
.why__story p {
  position: relative; margin: 0; padding-left: 32px; text-wrap: pretty;
  color: var(--soft); font-size: clamp(1.05rem, 0.96rem + 0.42vw, 1.3rem); line-height: 1.5;
}
.why__story strong { color: var(--ink); font-weight: 700; }
/* Each paragraph's leader: the red dot and line of the film's labels, running into its first line. On phones it
   sits in a gutter; on wider screens it hangs in the margin, so the text keeps the column's edge. */
.why__lead { position: absolute; left: 0; top: calc(0.75em - 6px); width: 24px; height: 12px; overflow: visible; }
.why__lead line { stroke: var(--accent); stroke-width: 1.4; }
.why__lead circle { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.why__story a {
  color: var(--ink); font-weight: 700; white-space: nowrap;
  text-decoration: underline 1px var(--faint); text-underline-offset: 4px; transition: text-decoration-color 0.15s;
}
.why__story a:hover, .why__story a:focus-visible { text-decoration-color: var(--accent); }
.why__story .i-arrow {
  display: inline-block; width: 0.78em; height: 0.78em; margin-left: 0.32em; vertical-align: -0.04em;
  color: var(--accent); transition: translate 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.why__story a:hover .i-arrow, .why__story a:focus-visible .i-arrow { translate: 3px 0; }
/* The leaders draw in once, like the film's lines, as each paragraph comes into view (main.js arms them). */
.why.is-armed .why__lead :is(line, circle) { transform-box: fill-box; }
.why.is-armed .why__lead line { transform-origin: left center; transform: scaleX(0); }
.why.is-armed .why__lead circle { transform-origin: center; transform: scale(0); }
.why.is-armed .is-in .why__lead circle { transform: none; transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i) * 0.14s); }
.why.is-armed .is-in .why__lead line { transform: none; transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i) * 0.14s + 0.12s); }
@media (min-width: 760px) {
  .why__story p { padding-left: 0; }
  .why__lead { left: -72px; width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .lines[data-beat="A"] .line.is-fresh { animation: none; }
  .film-on .marker { transition: none; }
  .why.is-armed .why__lead :is(line, circle) { transform: none; transition: none; }
}


/* ---------- ?freeze=0.37 shows one moment without scrolling, for checking and screenshots ---------- */
.is-frozen .strip { height: 100vh; height: 100svh; }
.is-frozen .strip__stage { position: relative; }
.is-frozen *, .is-frozen *::before, .is-frozen *::after { animation: none !important; transition: none !important; }

/* ---------- ?debug ---------- */
.is-debug .strip[data-beat="A"] .lines[data-beat="A"],
.is-debug .strip[data-beat="B"] .lines[data-beat="B"],
.is-debug .strip[data-beat="C"] .lines[data-beat="C"],
.is-debug .strip[data-beat="D"] .lines[data-beat="D"] { opacity: 1 !important; visibility: visible !important; }
.is-debug .strip__film { outline: 1px dashed #0ff; cursor: crosshair; }
.debug-panel {
  position: fixed; right: 12px; bottom: 12px; z-index: 50; margin: 0; padding: 6px 10px;
  background: #0ff; color: #000; font: 12px/1.4 ui-monospace, monospace; border-radius: 3px;
}
