/* The one mechanic (paint.js): in each scene a roller lays a new coat over the old, and the new is
   underneath. Layers, back to front: the new (.coat__new: a live sample site, or a photograph), the
   old (.coat__old), the canvas the paint is drawn on, the roller. The old is the first frame wherever
   the script runs; with no paint (no script, no GPU, reduced motion: .is-off) only the new shows. */
.coat { position: relative; overflow: hidden; background: var(--ink); }
.coat > *, .coat picture > img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.coat picture img { object-fit: cover; object-position: 50% 50%; }
.stage .coat picture img { object-position: 50% 0; } /* a site is seen from its top, as a browser shows it */
/* A sample sees a taller screen than the frame, scaled down to fit (--z), so it lays out as on a phone. */
/* --vh: the least height it may see, below which a sample's own phone layout crowds; its foot is cut. */
.coat iframe { position: absolute; inset: 0; width: calc(100% / var(--z, 1)); height: max(calc(100% / var(--z, 1)), var(--vh, 0px)); border: 0;
  transform: scale(var(--z, 1)); transform-origin: 0 0; pointer-events: none; background: var(--paper); }
.coat iframe:not([src]) { visibility: hidden; } /* until it loads, the poster under it shows */
.coat__old, .coat canvas { display: none; }
.js .coat__old { display: block; }
.is-off .coat__old { display: none; } /* paint.js: this scene cannot paint */
.is-wet .coat__old { display: none; } /* while wet, the canvas draws the old itself */
.is-wet canvas { display: block; }
.is-dry .coat__old, .is-dry canvas { display: none; }

/* The roller is the Newcoat mark, drawn flat, its sleeve the colour it lays (--sleeve).
   paint.js sets --L (the sleeve's width) and --x, --y (the sleeve's centre). */
.roller { --L: 160px; width: calc(var(--L) * 40 / 26); height: calc(var(--L) * 40 / 26); pointer-events: none; z-index: 3; display: none; overflow: visible;
  transform: translate(calc(var(--x, -400px) - var(--L) * 16 / 26), calc(var(--y, -400px) - var(--L) * 11 / 26));
  filter: drop-shadow(0 0 1px rgb(251 248 242 / .9)) drop-shadow(0 8px 12px rgb(0 0 0 / .22)); will-change: transform; }
.coat > .roller { inset: 0 auto auto 0; }
.is-wet .roller { display: block; }
.roller path { fill: none; stroke: var(--handle, var(--ink)); stroke-width: 2.6; stroke-linejoin: round; }
.roller rect { fill: var(--handle, var(--ink)); }
.roller .roller__sleeve { fill: var(--sleeve, var(--coat)); stroke: var(--ink); stroke-width: .5; }

/* A sample's site runs off both edges of the screen, under a browser's address bar. */
.stage { position: relative; margin: 0; display: flex; flex-direction: column; }
.stage__bar { display: flex; align-items: center; gap: 7px; height: 34px; flex: none; padding-inline: var(--gut); background: #e8e0d1; border-block: 1px solid #d6cbb7; font-size: 13px; color: #6a6252; }
.stage__bar i { width: 10px; height: 10px; border-radius: 50%; background: #cdc2ae; }
.stage__bar span { margin: 0 auto 0 14px; display: flex; align-items: center; gap: 7px; }
.stage__bar span::before { content: ""; width: 9px; height: 11px; flex: none; background: currentColor; opacity: .75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 11'%3E%3Cpath d='M2 5V3.5a2.5 2.5 0 0 1 5 0V5h1v6H1V5zm1.3 0h2.4V3.5a1.2 1.2 0 0 0-2.4 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 11'%3E%3Cpath d='M2 5V3.5a2.5 2.5 0 0 1 5 0V5h1v6H1V5zm1.3 0h2.4V3.5a1.2 1.2 0 0 0-2.4 0z'/%3E%3C/svg%3E") center / contain no-repeat; }
.tape--stage { top: -16px; right: var(--gut); }
.stage .coat { flex: 1 1 auto; min-height: 0; }
.stage figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding-block: 12px 0; font-size: 15px; color: var(--muted); }
.stage figcaption span { flex: 1 1 24em; }
.stage figcaption a { font-weight: 600; color: var(--ink); }

/* The first screen: the headline, then the plumber's site, painted by itself. */
.hero { display: grid; padding-bottom: clamp(36px, 5vw, 72px); }
.hero__kick { margin: clamp(4px, 1.4vw, 20px) auto 10px; font-size: 15px; }
.hero__h { font: clamp(50px, 9vw, 150px)/.88 var(--serif); letter-spacing: -.035em; margin: 0 auto clamp(16px, 2.2vw, 30px); }
.coat-word { color: var(--coat); display: inline-block; }
.hero .coat { height: clamp(400px, calc(100svh - 250px), 700px); --z: .92; --vh: 760px; }
.hero__side { display: grid; gap: 22px; padding-top: 26px; }
.hero__act { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
@media (min-width: 900px) {
  /* One line of headline, the button beside it, then as much of the plumber's site as the screen holds. */
  .hero { grid-template-columns: 1fr auto; grid-template-areas: "k act" "h fine" "stage stage"; column-gap: 4vw; }
  .hero__side, .hero__act { display: contents; }
  .hero__kick { grid-area: k; margin-right: 0; padding-right: 0; }
  .hero__h { grid-area: h; margin-right: 0; padding-right: 0; font-size: clamp(56px, 6.9vw, 124px); white-space: nowrap; }
  .hero__act .btn { grid-area: act; align-self: center; margin-right: var(--gut); }
  .hero .stage { grid-area: stage; }
  .hero .coat { height: clamp(440px, calc(100svh - 300px), 820px); --z: .82; --vh: 780px; }
  .hero .fine { grid-area: fine; padding: 10px var(--gut) 0 0; max-width: 17em; font-size: 14px; align-self: start; }
}
@media (max-width: 899px) {
  .tape--stage { font-size: 12px; padding: 7px 11px 8px; top: -12px; }
  .hero__side { padding-top: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  .js .coat-word { clip-path: inset(0 100% 0 0); animation: lay 1.1s .25s var(--ease) forwards; }
}
@keyframes lay { to { clip-path: inset(0 -4% 0 0); } }

/* A scene the visitor's scroll paints: pinned for its length while the coat goes on. */
.scene__pin { min-height: 100svh; display: flex; flex-direction: column; }
.scene--roll.is-armed { height: 260svh; } /* kept when dry: the page never jumps under the reader */
.wall.is-armed, .close.is-armed { height: 150svh; } /* a short pass: the words are already there */
.scene--roll.is-armed .scene__pin { position: sticky; top: 0; height: 100svh; }
.scene__head { padding-block: clamp(22px, 4svh, 56px) clamp(14px, 2svh, 26px); display: grid; gap: 4px 4vw; }
.scene__head .h2 { margin: 0; }
.scene__head .intro { margin: 0; font-size: clamp(17px, .9vw + 11px, 21px); color: var(--muted); }
.scene--roll .stage { flex: 1 1 auto; min-height: 0; padding-bottom: 18px; }
.scene--roll .coat { --z: .92; }
.scene__say { margin: 0; font-size: 15px; color: var(--muted); }
.scene__say a { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* The bakery on a desktop: its phone site, in a phone, beside the words. */
@media (min-width: 900px) {
  .scene--bakery .scene__pin { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 6vw; padding-inline: var(--gut); }
  .scene--bakery .scene__head { padding: 0; max-width: 40rem; margin-left: auto; gap: 18px; }
  .scene--bakery .stage { flex: none; padding: 0; height: min(820px, calc(100svh - 80px)); aspect-ratio: 390 / 844; border: 12px solid var(--ink); border-radius: 46px;
    background: var(--ink); box-shadow: 0 30px 60px -30px rgb(0 0 0 / .55); margin-right: max(0px, calc((100vw - 1440px) / 2)); }
  .scene--bakery .stage__bar { display: none; }
  .scene--bakery .coat { border-radius: 34px; }
  .scene--bakery .tape--stage { top: 28px; right: auto; left: -34px; }
}
