/* Copper Heron sample. Styles for the hero, at rest and on scroll (home page only).
   Loaded after style.css. Shared tokens and classes are in style.css; see SYSTEM.md.

   The hero sits on the dark ground (data-ground="dark") and is see-through like every
   other section, so its contour lines run on into the statement with no edge.
   Every class here starts with "h" so nothing collides with the other parts.

   Layers in the stage, back to front:
     .hrows   the headline as two giant drifting rows (behind the picture)
     .hshot   the picture: .hframe (the part that scales; photo, wall contours, the wake
              canvas, the dimmer) and what rests on it (.hud card, .hcap caption, .hopen)
     .hlabel  the tiny label above the frame      .hlead  the paragraph
     .hsign   the sign-off stroke, on top

   First the ordinary layout (phones, tablets, reduced motion, no JavaScript). The pinned
   version for wide screens is further down, under html.pins. */

/* ---------- Ordinary layout: picture, label, rows with the stroke over them, paragraph ---------- */
/* The hero is pulled up under the black sample banner. main is made a block formatting
   context so that pull does not drag main (and the phone wordmark inside it) up as well. */
main { display: flow-root; }
/* --vh is one hundredth of the screen height (the small viewport where the browser knows it),
   --strip the height of the phone strip along the bottom, --fh the height of the picture. */
.hero { --p: 0; --banner: 0px; --strip: 0px; --vh: 1vh; --fh: max(440px, calc(100 * var(--vh) - var(--strip))); z-index: 1; padding: 0; margin-top: calc(-1 * var(--banner)); }
@supports (height: 100svh) { .hero { --vh: 1svh; } }
.hstage { position: relative; --after: 0; }
.hvh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The picture. It starts under the black sample banner (p2-hero.js measures the banner
   into --banner) and fills the rest of the first screen. */
.hshot { position: relative; height: var(--fh); transform-origin: 50% 100%; }
.hframe { position: absolute; inset: 0; overflow: hidden; background: var(--mid); touch-action: pan-y; animation: h-arrive 1s var(--ease) backwards; }
@keyframes h-arrive { from { scale: 1.045; } }
/* The scene overhangs the frame a little, so it can lean against the pointer */
.hscene { position: absolute; inset: -14px; will-change: transform; }
.hscene > img, .hscene > .ph, .hscene > canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.hscene > img { object-fit: cover; object-position: 58% 45%; }
.hscene > canvas { pointer-events: none; }
/* A grey copy of the photo and a wash of the brand's dark. Only the pinned sequence shows them (further down). */
.hscene > .hgrey, .htone { display: none; }
.hwalls { position: absolute; left: -6%; top: -6%; width: 112%; height: 112%; fill: none; stroke: var(--dark); stroke-width: 1; opacity: .085; pointer-events: none; -webkit-mask-image: linear-gradient(#000 0 52%, transparent 74%); mask-image: linear-gradient(#000 0 52%, transparent 74%); animation: h-drift 46s ease-in-out infinite alternate; }
.hwalls path { vector-effect: non-scaling-stroke; }
@keyframes h-drift { to { transform: translate3d(-3%, 2.5%, 0) scale(1.06); } }
.hdim { display: none; }

/* One small outlined card, bottom left: a tab with its label, and two cells */
.hud { position: absolute; z-index: 3; left: var(--gut); bottom: var(--gut); width: 116px; color: var(--dark); pointer-events: none; }
.htab, .hbox { border: 1px solid var(--dark); background: #f3efe6b8; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
@supports (color: color-mix(in srgb, #000, #fff)) { .htab, .hbox { background: color-mix(in srgb, var(--cream) 72%, transparent); } }
.htab { display: inline-block; margin-bottom: -1px; padding: 6px 9px 5px; border-bottom: 0; border-radius: var(--r-s) var(--r-s) 0 0; }
.hbox { border-radius: 0 var(--r-s) var(--r-s) var(--r-s); }
.hcell { display: grid; justify-items: center; gap: 8px; padding: 14px 8px 12px; text-align: center; overflow-wrap: anywhere; }
.hcell + .hcell { margin: 0 8px; padding-left: 0; padding-right: 0; border-top: 1px solid var(--dark); }
.hud svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hud b { font: 500 19px/1 var(--serif); font-variant-numeric: lining-nums; }
/* The tick in the calendar redraws itself now and then */
.htick { stroke-dasharray: 1 2; animation: h-tick 6s var(--ease-io) infinite; }
@keyframes h-tick { 0%, 78% { stroke-dashoffset: 0; } 84% { stroke-dashoffset: 1.02; } 100% { stroke-dashoffset: 0; } }

/* The one caption for both hero photos */
.hcap { position: absolute; z-index: 3; left: 50%; bottom: var(--gut); transform: translateX(-50%); padding: 6px 9px; border-radius: var(--r-s); background: #0006; color: #fff; box-shadow: inset 0 0 0 1px #fff9; white-space: nowrap; pointer-events: none; }

/* Open the wall: the tap control for phones, and the keyboard way in on wide screens */
.hopen { position: absolute; z-index: 3; left: calc(var(--gut) + 128px); bottom: var(--gut); display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: #fff; font: 700 10px/1.2 var(--sans); text-transform: uppercase; cursor: pointer; }
.hopen i { display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--r-s); background: var(--accent); color: var(--dark); transition: background-color .25s, color .25s; }
.hopen svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hopen span { padding: 6px 9px; border-radius: var(--r-s); background: #0006; box-shadow: inset 0 0 0 1px #fff9; white-space: nowrap; }
.hopen[aria-pressed=true] i { background: var(--dark); color: var(--accent); }
.hopen:focus-visible { outline: 0; }
.hopen:focus-visible i { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--dark); }
html:not(.js) .hopen, html:not(.js) #wake { display: none; }
/* Without script the hero starts under the sample banner, so the picture is that much shorter and still ends on the first screen. */
html:not(.js) .hero { --fh: max(440px, calc(100 * var(--vh) - var(--strip) - 34px)); }
/* Wide screens with a pointer do not need the button, so it stays out of sight until the keyboard reaches it */
@media (min-width: 981px) and (prefers-reduced-motion: no-preference) {
  .hopen:not(:focus-visible) { opacity: 0; pointer-events: none; }
}

/* The tiny label that goes with the sign-off */
.hlabel { position: relative; display: grid; justify-items: center; gap: 12px; margin-top: clamp(56px, 9vw, 110px); padding: 0 var(--gut); color: var(--ink); text-align: center; }
.hlabel .mark { width: 22px; height: 27px; }
.hclip { display: block; overflow: hidden; }
.hclip .label { display: block; padding: 1px 0; }

/* The headline, as two giant rows that never stop drifting: the serif one to the left,
   the sans one to the right. Each .hrun holds its words four times and slides a quarter
   of its own width, so the loop has no seam. Scroll pushes the rows further the same way. */
.hsigned { position: relative; }
.hrows { font: 700 clamp(34px, 10.5vw, 88px)/.93 var(--sans); letter-spacing: -.03em; text-transform: uppercase; white-space: nowrap; pointer-events: none; }
.hrow { display: flex; will-change: transform; }
.hrow.a { font-family: var(--serif); font-weight: 600; font-size: 1.04em; line-height: .9; letter-spacing: -.022em; font-variant-numeric: lining-nums; color: var(--em); }
.hrow.b { justify-content: flex-end; color: var(--ink); }
.hrun { flex: none; display: flex; animation: h-run-a 50s linear infinite; }
.hrun > span { flex: none; padding-right: .45em; }
.hrow.b .hrun { animation-name: h-run-b; animation-duration: 66s; }
@keyframes h-run-a { to { transform: translate3d(-25%, 0, 0); } }
@keyframes h-run-b { to { transform: translate3d(25%, 0, 0); } }
.hero:not(.live) .hrun, .hero:not(.live) .hwalls, .hero:not(.live) .htick { animation-play-state: paused; }

/* The sign-off stroke. It is a .mark, so it draws itself the first time it is seen
   (style.css); here the four strokes follow one another, the bolt last. Pinned, it is laid
   over the dimmed frame (further down). In the ordinary layout there is no frame under it,
   so it stands in a band of its own between the label and the rows, clear of the words:
   label, sign-off, rows. */
.hsign { position: absolute; z-index: 4; left: 50%; top: 50%; width: min(86vw, 88 * var(--vh), 800px); transform: translate(-50%, -50%); }
html:not(.pins) .hsigned { display: flex; flex-direction: column; padding-bottom: clamp(40px, 9vw, 96px); }
html:not(.pins) .hsign { position: relative; order: -1; left: auto; top: auto; align-self: center; width: min(62vw, 340px); margin: 16px 0 clamp(34px, 7vw, 60px); transform: rotate(-3deg); }
html:not(.js) .hsign path, html:not(.js) .hlabel .mark path { stroke-dashoffset: 0; }
.hsign path:nth-child(1) { transition-duration: 1.2s; }
.hsign path:nth-child(2) { transition-delay: 1.3s; transition-duration: .8s; }
.hsign path:nth-child(3) { transition-delay: 2s; transition-duration: .4s; }
.hsign path:nth-child(4) { transition-delay: 2.4s; transition-duration: .4s; }

/* Who we are, in one sentence, and the two ways to reach us */
.hlead { position: relative; display: grid; justify-items: start; gap: 16px; padding: 0 var(--gut) clamp(8px, 2vw, 30px); }
.hlead p { max-width: 44ch; font-size: clamp(15px, 1.16vw, 20px); color: var(--body); text-wrap: pretty; }
.hlead .hnext { display: none; font-size: 10px; }
.htail { position: absolute; left: 0; bottom: 0; width: 1px; height: 0; }

/* Leaving the picture without a pin: it draws back into a frame on the dark ground as it
   goes, and the rows are pushed along by the scroll. (--p here runs over the height of the
   hero; p2-hero.js writes it on the picture and the rows only.) The card lets go at the
   first touch of scroll, before it would pass under the wordmark. */
html.js:not(.pins) .hud { opacity: calc(1 - var(--p, 0) * 6); }
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.pins) .hshot { transform: scale(calc(1 - .22 * var(--p, 0))); will-change: transform; }
  html.js:not(.pins) .hrow.a { transform: translate3d(calc(var(--p, 0) * -22vw), 0, 0); }
  html.js:not(.pins) .hrow.b { transform: translate3d(calc(var(--p, 0) * 22vw), 0, 0); }
}

/* ---------- Pinned version: wide screens, motion allowed (site.js sets html.pins) ----------
   The section is two screens tall and the stage sticks for the extra one. --p is 0 at the
   top and 1 when the stage lets go. --e is --p on a quad ease-in-out, --s the scale of the
   picture: 1 down to about a third.  --after counts the next screen, once it has let go. */
html.pins .hero { height: calc(200 * var(--vh)); --a: min(var(--p), .5); --b: calc(1 - max(var(--p), .5)); --e: calc(2 * var(--a) * var(--a) + .5 - 2 * var(--b) * var(--b)); --s: calc(1 - .672 * var(--e)); }
html.pins .hstage { position: sticky; top: 0; height: calc(100 * var(--vh)); overflow: hidden; }
html.pins .hshot { position: absolute; z-index: 2; inset: 0; height: auto; }
html.pins .hframe { transform: scale(var(--s)); will-change: transform; }
/* The wake lets go early, then the photo sinks into the ground color so the stroke reads */
html.pins #wake { opacity: calc(1 - clamp(0, (var(--p) - .2) / .22, 1)); }
html.pins .hdim { display: block; position: absolute; inset: 0; z-index: 3; background: var(--dark); opacity: calc(.72 * clamp(0, (var(--p) - .3) / .62, 1)); pointer-events: none; }
/* The color drains with the scroll, between 30% and 80% of the pin: the grey copy of the
   photo fades in over it, and the wash, laid on as a color, gives that grey the hue of the
   brand's dark, so the frame reads as a lighter panel of the ground under every color pair.
   Nothing is filtered per frame: the two opacities are all that change. */
html.pins .hscene > .hgrey { display: block; filter: grayscale(1) contrast(1.05); opacity: clamp(0, (var(--p) - .3) / .5, 1); will-change: opacity; }
html.pins .htone { display: block; position: absolute; inset: 0; background: var(--dark); mix-blend-mode: color; opacity: clamp(0, (var(--p) - .3) / .5, 1); will-change: opacity; pointer-events: none; }
/* While the frame's edge is crossing the wordmark (p2-hero.js puts .hedge on the header and
   writes where the frame's left and top edges are, --hx and --hy), the wordmark is painted
   in two inks split along those edges: dark over the picture, cream over the ground. */
html.pins:not(.menu-open) header.hedge .bar .logo { color: transparent; background: linear-gradient(var(--cream), var(--cream)) 0 0 / 100% max(0px, var(--hy, 0px) - 17px) no-repeat, linear-gradient(90deg, var(--cream) calc(var(--hx, 0px) - var(--gut)), var(--dark) 0); -webkit-background-clip: text; background-clip: text; }
/* What rests on the picture leaves at the first touch of scroll; the caption rides the frame's bottom edge all the way */
html.pins .hud, html.pins .hopen { opacity: calc(1 - clamp(0, var(--p) * 16, 1)); transform: translateY(calc(clamp(0, var(--p) * 16, 1) * 12px)); }
html.pins .hopen:not(:focus-visible) { opacity: 0; }
html.pins .hcap { transform: translate(-50%, calc((var(--s) - 1) * 50 * var(--vh))); }
/* Rows: behind the picture, across the middle of the stage */
html.pins .hsigned { position: static; padding: 0; }
html.pins .hrows { position: absolute; z-index: 1; left: 0; right: 0; top: 50%; transform: translateY(-50%); font-size: clamp(40px, 7.6vw, 150px); }
html.pins .hrow.a { transform: translate3d(calc((var(--p) + var(--after)) * -70vw), 0, 0); }
html.pins .hrow.b { transform: translate3d(calc((var(--p) + var(--after)) * 70vw), 0, 0); }
/* The strokes draw with the scroll over the last third, one after the other; the bolt lands as the stage leaves */
html.pins .hsign { width: min(55vw, 88 * var(--vh)); transform: translate(-50%, -50%) rotate(-3deg); }
html.pins .hsign path { stroke-dashoffset: calc(1.02 - 1.02 * var(--d)); transition: none; }
html.pins .hsign path:nth-child(1) { --d: clamp(0, (var(--p) - .62) / .22, 1); }
html.pins .hsign path:nth-child(2) { --d: clamp(0, (var(--p) - .83) / .11, 1); }
html.pins .hsign path:nth-child(3) { --d: clamp(0, (var(--p) - .93) / .06, 1); }
html.pins .hsign path:nth-child(4) { --d: clamp(0, var(--after) / .18, 1); }
/* The label wipes up from behind its own edge, a little above the frame */
html.pins .hlabel { position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(50% + 16.4 * var(--vh) + clamp(40px, 9.4 * var(--vh), 96px)); margin: 0; }
html.pins .hclip .label { transform: translateY(calc((1 - clamp(0, (var(--p) - .72) / .18, 1)) * 110%)); }
html.pins .hlabel .mark { opacity: clamp(0, calc((var(--p) - .78) / .12), 1); }
/* The paragraph comes in last, small, in the bottom left corner where the card was. It
   fades again as the stage leaves, before it would pass under the wordmark. */
html.pins .hlead { position: absolute; z-index: 3; left: 0; bottom: var(--gut); padding-bottom: 0; opacity: calc(clamp(0, (var(--p) - .8) / .14, 1) - clamp(0, (var(--after) - .35) / .3, 1)); transform: translateY(calc((1 - clamp(0, (var(--p) - .8) / .14, 1)) * 16px)); }
html.pins .hlead p { max-width: 36ch; font-size: clamp(14.5px, 1.05vw, 18px); text-wrap: balance; }
html.pins .hlead .row { display: none; }

/* ---------- Tablets and phones ---------- */
@media (max-width: 980px) {
  /* The strip along the bottom (push to call, Make it yours) takes the last 52px of the screen */
  .hero { --strip: calc(52px + env(safe-area-inset-bottom, 0px)); }
  .hscene > img { object-position: 72% 50%; }
  /* Make it yours is in the strip here, so the caption can have the corner */
  .hcap { left: auto; right: var(--gut); transform: none; }
}
@media (max-width: 700px) {
  /* The crop keeps the breaker panel and the doorway and leaves the television out. */
  .hscene > img { object-position: 91% 50%; }
  /* The wordmark and its one line sit on the top of the picture, so the card is not needed */
  .hud { display: none; }
  .hopen { left: var(--gut); }
  .hlead .hnext { display: block; }
  .hlead .row { width: 100%; }
  .hlead .btn { flex: 1; }
}

/* Reduced motion: nothing drifts, so the two rows are set as one centred headline that
   wraps and reads whole (one copy of each row's words, not four cut by the screen edges). */
@media (prefers-reduced-motion: reduce) {
  .hframe, .hwalls, .hero .hrow .hrun, .htick { animation: none; }
  .hsign path, .hopen i { transition: none; }
  .hrows { padding: 0 var(--gut); white-space: normal; text-align: center; text-wrap: balance; }
  .hrow, .hrow .hrun { display: block; }
  .hrun > span { display: block; padding: 0; }
  .hrun > span + span { display: none; }
  .hrow.b { margin-top: .12em; }
}
