/* The cleanout: the lawn headers of the cartoon pages, the cleanout in the home hero, and the ride's overlay and cover.
   Art is injected by cleanout.js (SVG, aria-hidden). Finished pose = no state class: cap on the grass, camera head up
   (pages) or peering in (home). Every move sits behind prefers-reduced-motion: no-preference.
   Lengths inside the SVGs are the drawing's own units (1 unit = 1 CSS px of the viewBox), so the moves scale with it.
   The page drawing is 138 x 149 units with its ground line 22 units up; --co-w is its width on screen, --co-r its gap
   to the right edge, --co-g how far its ground line is above the header's foot (12 to 20 px into the lawn). */

/* ---------- Lawn page header: sky, a strip of lawn, the cleanout the camera just came out of ---------- */
.pop { --lawn: 46px; --co-w: clamp(118px, calc((calc(100 * min(1vw, 19.2px)) - 253px) * 1.108), 152px); --co-r: 4px; --co-g: calc(var(--lawn) - 12px); --co-hy: 0.571;
  position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--sky); color: var(--char);
  min-height: 38vh; min-height: 38svh; padding: 28px var(--m) calc(var(--lawn) + 48px); }
.pop::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--lawn); background: var(--grass); }
.pop::after { content: ''; position: absolute; left: 0; right: 0; bottom: calc(var(--lawn) - 1px); height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 12' preserveAspectRatio='none'%3E%3Cpath d='M0 12 V6 Q9 -4 18 6 T36 6 V12 Z' fill='%236CBF57'/%3E%3C/svg%3E") repeat-x left bottom / 20px 8px; }
.pop-copy { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; max-width: 46rem; }
.pop h1 { font-size: clamp(2.1rem, 1.3rem + calc(3.4 * min(1vw, 19.2px)), 4rem); font-weight: 800; letter-spacing: -0.015em; max-width: 16ch; }
.pop .lede { margin: 12px 0 20px; font-size: clamp(1.0625rem, 0.98rem + calc(0.5 * min(1vw, 19.2px)), 1.375rem); line-height: 1.4; max-width: 40ch; }
.pop .lede a { color: var(--char); font-weight: 700; text-underline-offset: 3px; }

/* Back down the line: sends the camera back down the cleanout to the scope run. Phones: 20 px under the lede, and the
   camera head stands in the band beside it (--co-w keeps the head clear of the link's end, 249 px from the left) */
.pop-back { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px 0 14px; border: 2.5px solid var(--char); border-radius: 999px;
  background: #fff; color: var(--char); font: 700 1.0625rem var(--text); text-decoration: none; white-space: nowrap; touch-action: manipulation; }
.pop-back::before { content: ''; flex: none; width: 9px; height: 9px; margin: -4px 3px 0; border: solid var(--char); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
@media (hover: hover) and (pointer: fine) { .pop-back:hover { background: var(--char); color: #fff; } .pop-back:hover::before { border-color: #fff; } }
@media (prefers-reduced-motion: no-preference) {
  .pop-back { transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease; }
  .pop-back:active { transform: scale(.97); }
  .pop-back::before { transition: transform var(--t-hover) var(--ease-out); }
  .pop-back:hover::before, .pop-back:focus-visible::before { transform: translateY(3px) rotate(45deg); }
}

/* The scene: art only. The camera head's button lies over it, outside the hidden art */
.pop-scene { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.pop-sun { position: absolute; right: -38px; top: -38px; width: 68px; height: 68px; border-radius: 50%; background: #F2C230; }
.pop-cloud { display: none; position: absolute; }
.co-art { position: absolute; display: block; overflow: visible; }
.co-art--pop { right: var(--co-r); bottom: calc(var(--co-g) - var(--co-w) * 0.1594); width: var(--co-w); height: calc(var(--co-w) * 1.0797); }
.co-cam-set { transform: translateY(15px); }   /* phones: a shorter neck, so the head stays under the lede */
.co-neck { transform-origin: 0 -69px; }
.co-lid { transform-origin: 0 -7px; transform: scaleY(0); }
.co-riser { transform-origin: 0 10px; }
.co-btn { position: absolute; z-index: 6; margin: 0; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; }
.co-btn[hidden] { display: none; }
/* on a page it is centred on the head: 0.749 of the drawing's width in from its right edge, --co-hy of it above the ground line */
.pop .co-btn { z-index: 3; right: calc(var(--co-r) + var(--co-w) * 0.749); bottom: calc(var(--co-g) + var(--co-w) * var(--co-hy));
  width: max(48px, calc(var(--co-w) * 0.34)); height: max(48px, calc(var(--co-w) * 0.3)); transform: translate(50%, 50%); }

/* Each page's own prop on its lawn (cleanout.js draws them). --pw its width, --pb how far its drawing runs below its
   ground line (as a part of its width), --ink its outline in the drawing's own units, so it lands near 2.5 to 3.5 px.
   Phones: 54 px tall above its ground line, at the left margin on the lawn under the back link (never nearer than
   16 px to it), 22 px into the grass. Wide screens: beside the cleanout, see the per-page rows below. */
.pp { position: absolute; display: block; overflow: visible; left: var(--m); bottom: calc(var(--lawn) - var(--pd, 22px) - var(--pw) * var(--pb)); width: var(--pw); height: auto; }
.pp-i { stroke-width: var(--ink); } .pp-t { stroke-width: calc(var(--ink) * 0.62); }
.pp--pipes { --pw: 98px; --pb: 0.081; --ink: 3px; }
.pp--mark { --pw: 79px; --pb: 0.0897; --ink: 4px; }
.pp--dog { --pw: 49px; --pb: 0.2037; --ink: 2.8px; }
.pp--mail { --pw: 49px; --pb: 0.1522; --ink: 4.6px; }
.pp--roll { --pw: 50px; --pb: 0.0833; --ink: 5px; }
.pp--shore { --pw: 96px; --pb: 0.0758; --ink: 3.3px; }
.pp--sign { --pw: 42px; --pb: 0.1364; --ink: 4.8px; }
.pp--monitor { --pw: 55px; --pb: 0.08065; --ink: 2.7px; }
/* The viewBox grows with the town name; a fixed height keeps its pipe at the lawn's scale. */
.pp--town { --ph: 56px; --ink: 3px; width: auto; height: var(--ph);
  bottom: calc(var(--lawn) - var(--pd, 22px) - var(--ph) * 0.06667); }
.pp-label { stroke: none; font-family: Saira, sans-serif; }
.pp-monitor-label { fill: var(--char); font-size: 15px; font-weight: 800; letter-spacing: 0.04em; }
.pp-monitor-ft { fill: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-town-label { fill: #fff; font-size: 20px; font-weight: 700; }
.pp-town-label--hub { fill: var(--char); font-size: 23px; font-weight: 800; }
@media (max-width: 760px) {
  /* Only the added pages rescale reused drawings; the original seven keep their poses. */
  .pop[data-prop="roll"] .pp--roll { --pw: 46px; }
  .pop[data-prop="pipes"] .pp--pipes { --pw: 82px; }
}

/* Wide screens. The cleanout stands at the right margin under the sun and the page's prop on the lawn to its left.
   --art reserves room at the right margin for the drawings, keeping words clear. */
@media (min-width: 761px) {
  .pop { --lawn: 64px; --co-w: 207px; --co-r: calc(var(--m) - 9px); --co-g: calc(var(--lawn) - 20px); --co-hy: 0.68; --art: 310px;
    min-height: max(340px, 40vh); padding-top: clamp(36px, 6vh, 56px); padding-bottom: calc(var(--lawn) + 22px); }
  .pop--services, .pop--service { --art: 420px; }
  .pop--about, .pop--safety { --art: 396px; }
  .pop--work { --art: 352px; }
  .pop--contact { --art: 322px; }
  .pop--legal, .pop--thanks { --art: 240px; }
  .pop::after { height: 12px; background-size: 34px 12px; }
  .pop-copy { max-width: min(52rem, 100% - var(--art)); }
  .pop h1 { max-width: 24ch; }
  .pop .lede { margin: 14px 0 24px; max-width: 54ch; }
  .pop-sun { right: calc(var(--m) + 8px); top: clamp(24px, 5vh, 48px); width: 88px; height: 88px; }
  .pop-cloud { display: block; right: calc(var(--m) + 76px); top: clamp(44px, 5vh + 20px, 68px); width: 132px; height: auto; }
  .co-cam-set { transform: none; }
  .pp { --pd: 24px; left: auto; right: var(--pr); }
  .pp--pipes { --pw: 145px; --pr: calc(var(--m) + 216px); --ink: 3px; }
  .pp--mark { --pw: 156px; --pr: calc(var(--m) + 200px); --ink: 3px; }
  .pp--dog { --pw: 84px; --pr: calc(var(--m) + 181px); --ink: 2.2px; }
  .pp--mail { --pw: 92px; --pr: calc(var(--m) + 190px); --ink: 3px; }
  .pp--roll { --pw: 128px; --pr: calc(var(--m) + 198px); --ink: 3px; }
  .pp--shore { --pw: 172px; --pr: calc(var(--m) + 200px); --ink: 2.4px; }
  .pp--sign { --pw: 84px; --pr: calc(var(--m) + 202px); --ink: 3.1px; }
  .pop:has(.pp--monitor) { --art: 310px; }
  .pop:has(.pp--town), .pop:has(.pp--roll) { --art: 352px; }
  .pop:has(.pp--pipes) { --art: 420px; }
  .pp--monitor { --pw: 104px; --pr: calc(var(--m) + 196px); --ink: 3px; }
  .pp--town { --ph: 95px; --pr: calc(var(--m) + 196px); --ink: 3px; }
  /* At the new props' fixed right edge, the original riser box would overlap by 2px. */
  .pop:has(.pp--monitor, .pp--town) { --co-r: calc(var(--m) - 17px); }
}
@media (max-width: 360px) {   /* the smallest phones: the link gives up its arrow so the head stands clear of its end */
  .pop-back { padding: 0 16px; }
  .pop-back::before { display: none; }
}
@media (max-width: 340px) { .pop-back { padding: 0 12px; font-size: 1rem; } }

/* ---------- Home hero: the cleanout in the lawn, the camera peering in, a hint ---------- */
.hero-co { position: absolute; inset: 0; z-index: 5; pointer-events: none; visibility: hidden; }
.hero-co.placed { visibility: visible; }
.co-hint { position: absolute; display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; color: var(--char);
  font: 700 1rem/24px var(--display); letter-spacing: 0.01em; }
.co-hint::after { content: ''; flex: none; width: 7px; height: 7px; margin-top: -4px; border: solid var(--char); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.co-hint--tight { font-size: 0.875rem; gap: 7px; }
/* one line of letters: a yellow name tag (the scope run's) over the cable's loop, with a leader down to the cable */
.co-hint--tag { padding: 6px 10px 5px; border: 2.5px solid var(--char); border-radius: 6px; background: #F2C230; line-height: 20px; }
.co-hint--tag::before { content: ''; position: absolute; right: 11.5px; top: 100%; width: 4px; height: var(--lead, 0px); margin-top: 2.5px; background: var(--char); }
.co-hint--soil.co-hint--tag::before { display: none; }
.co-hint--off { display: none; }
.co-hint--gone { opacity: 0; }
/* (the hero's .co-btn gets its box from cleanout.js) */
.co-feed-elb { transform-origin: -49px -10px; }
.co-feed-arch { transform-origin: -17.5px -90px; }
/* the scope is in: head tipped straight and down the hole, four bands of cable fed after it */
.co-in .co-tip { transform: rotate(-22deg); }
.co-in .co-dive { transform: translateY(44px); }
.co-in .co-feed-run { transform: translateX(44px); }
.co-in .co-feed-leg { transform: translateY(-44px); }
.co-in .co-feed-elb { transform: rotate(-180.07deg); }
.co-in .co-feed-arch { transform: rotate(144.06deg); }
.co-in .co-coil-top { transform: translateY(5px); }

/* ---------- The ride's overlay: over the page and in the way of every tap on it (a tap skips the ride), but under
   the top bar (z 30), the menu sheet (29) and the phones' Call dock (40), which stay in view and in reach.
   The cover: a ride that began on the last page is picked up by cleanout.js as it starts (html.co-cover, the flat
   colour in --co-flat), so the first paint of this page is the frame the last one ended on; the canvas takes over
   from it at once. The ribbon stays above it, as it does above the canvas. ---------- */
.co-ride { position: fixed; inset: 0; z-index: 28; display: block; width: 100%; height: 100%; }
html.co-cover::before { content: ''; position: fixed; inset: 0; z-index: 28; background: var(--co-flat, #17100C); }
html.co-cover .ribbon { position: relative; z-index: 30; }
@media (prefers-reduced-motion: reduce) { html.co-cover::before { content: none; } }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* home: the head tips first, then drops with the cable; coming back it rises, then looks in again */
  .co-dive, .co-feed-run, .co-feed-leg, .co-feed-elb, .co-feed-arch, .co-coil-top { transition: transform 460ms var(--ease-in-out); }
  .co-tip { transition: transform 200ms var(--ease-out) 380ms; }
  .co-in .co-dive, .co-in .co-feed-run, .co-in .co-feed-leg, .co-in .co-feed-elb, .co-in .co-feed-arch, .co-in .co-coil-top { transition-delay: 150ms; }
  .co-in .co-tip { transition-delay: 0ms; }
  .co-snap .co-dive, .co-snap .co-tip, .co-snap .co-feed-run, .co-snap .co-feed-leg, .co-snap .co-feed-elb, .co-snap .co-feed-arch, .co-snap .co-coil-top { transition: none; }
  .co-hint { transition: opacity var(--t-ui) ease; }
  .co--blink .co-lid { animation: co-blink 360ms linear both; }
  /* the back link looks down the hole it sends the camera into */
  .pop-scene .co-head, .pop-scene .co-eye { transition: transform var(--t-ui) var(--ease-out); }
  .pop:has(.pop-back:hover) .co-head, .pop:has(.pop-back:focus-visible) .co-head { transform: rotate(-34deg); }
  .pop:has(.pop-back:hover) .co-eye, .pop:has(.pop-back:focus-visible) .co-eye { transform: translate(0.6px, 1.6px); }

  /* arrival (1.4 s, starts as the ride's overlay lets go): the riser shudders, the cap flips off and lands on the
     grass with a wobble, the head pops up, turns to the headline, blinks */
  .co--arrive .co-riser { animation: co-shudder 1400ms linear both; }
  .co--arrive .co-cap-x { animation: co-cap-x 1400ms linear both; }
  .co--arrive .co-cap-y { animation: co-cap-y 1400ms linear both; }
  .co--arrive .co-cap-r { animation: co-cap-r 1400ms linear both; }
  .co--arrive .co-cam { animation: co-pop 1400ms linear both; }
  .co--arrive .co-head { animation: co-look 1400ms linear both; transition: none; }
  .co--arrive .co-eye { animation: co-glance 1400ms linear both; transition: none; }
  .co--arrive .co-lid { animation: co-blink-late 1400ms linear both; }
  /* press the head: down the hole, a beat, back up */
  .co--duck .co-cam { animation: co-duck 1000ms linear both; }
  .co--duck .co-lid { animation: co-blink-late 1000ms linear both; }
}
@keyframes co-shudder {
  0%, 4% { transform: none; }
  8% { transform: scale(1.06, .9); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  13% { transform: scale(.95, 1.09); }
  19%, 100% { transform: none; }
}
/* the cap rests at (46, 3); it starts on the rim at (0, -34): across at a steady pace, up and down like a tossed coin */
@keyframes co-cap-x { 0%, 9% { transform: translateX(-46px); } 41%, 100% { transform: none; } }
@keyframes co-cap-y {
  0%, 9% { transform: translateY(-37px); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  24% { transform: translateY(-96px); animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  41%, 100% { transform: none; }
}
@keyframes co-cap-r {
  0%, 9% { transform: rotate(15deg); }
  41% { transform: rotate(-360deg) scale(1.12, .8); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  47% { transform: rotate(-372deg) scale(.96, 1.06); }
  54% { transform: rotate(-352deg); }
  61% { transform: rotate(-364deg); }
  68%, 100% { transform: rotate(-360deg); }
}
/* the settles after each overshoot run on --ease-in-out, written out: a keyframe's timing function does not take var() */
@keyframes co-pop {
  0%, 20% { transform: translateY(86px); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  36% { transform: translateY(-11px); animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
  44% { transform: translateY(4px); animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
  51%, 100% { transform: none; }
}
/* it comes out nose up (it has just ridden up the riser), then swings down to the headline */
@keyframes co-look {
  0%, 50% { transform: rotate(56deg); animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
  64% { transform: rotate(-8deg); animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
  72%, 100% { transform: none; }
}
@keyframes co-glance { 0%, 50% { transform: translate(0.9px, -1.7px); } 64%, 100% { transform: none; } }
@keyframes co-blink { 0%, 100% { transform: scaleY(0); } 35%, 60% { transform: scaleY(1); } }
@keyframes co-blink-late { 0%, 80%, 94%, 100% { transform: scaleY(0); } 85%, 89% { transform: scaleY(1); } }
@keyframes co-duck {
  0% { transform: none; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  10% { transform: translateY(-7px); animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  26%, 52% { transform: translateY(86px); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  68% { transform: translateY(-10px); animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
  77% { transform: translateY(3px); animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
  84%, 100% { transform: none; }
}
