/* Evening hero: a full-bleed desk photo, the copy on its dark left side, the document chooser.
   Everything here works without script; hero.js and the 3D sheet attach to this later.
   CSS url()s are not versioned by the build (see static/_headers). */

:root { --amber: #F0B565; --night: #0B1113; }

/* ---------- header over the hero: evening (white logo and links) to paper, one continuous value ----------
   --hdr runs 0 (evening: transparent, white) -> 1 (paper: the light header). Without a flight it follows the
   compact class with a soft crossfade (--hdr is a registered number, so it transitions); during the 3D flight
   hero.js drives it per frame with the hero's paper layer (.driven, no transition). The text and logo turn dark
   over a short stretch (--hdr-a .. --hdr-b) where the header behind them is already mid-grey, so white text never
   sits on a light header; the focus ring and the hover colours switch in one step at the middle of it. */
@property --hdr { syntax: '<number>'; inherits: true; initial-value: 0; }
.top-logo .logo-white { display: none; }
/* No script: the dark header scrolls away with the hero instead of sitting, white, over the paper sections. */
.top.on-dark {
  position: absolute; left: 0; right: 0; top: 0;
  --hdr: 0; --hdr-a: .4; --hdr-b: .62;
  --hdr-ink: clamp(0, (var(--hdr) - var(--hdr-a)) / (var(--hdr-b) - var(--hdr-a)), 1);
  --hdr-step: clamp(0, (var(--hdr-ink) - .5) * 1000, 1);
  --hdr-fg: color-mix(in srgb, var(--text) calc(var(--hdr-ink) * 100%), #fff);
  --hdr-ring: color-mix(in srgb, var(--ink) calc(var(--hdr-step) * 100%), #fff);
  transition: padding .3s ease-in-out, --hdr .5s ease;
  background: rgba(243, 242, 239, calc(.9 * var(--hdr)));
  backdrop-filter: blur(calc(8px * var(--hdr)));
  border-bottom-color: rgba(26, 25, 23, var(--hdr));
  color: var(--hdr-fg);
}
@media (scripting: enabled) { .top.on-dark { position: fixed; } }
.top.on-dark.compact { position: fixed; --hdr: 1; }
/* With the 3D sheet off the desk the hero's paper layer lies under the header too, so the text turns dark earlier;
   hero.js then sets --hdr to the paper layer's level on every frame and scroll (.driven: no transition), except
   for a jump of that level, which crossfades. */
.top.on-dark.paced { --hdr-a: .16; --hdr-b: .38; }
.top.on-dark.driven { transition: padding .3s ease-in-out; }
/* The page under the header is light (app.js onHeader): dark text from the start of the crossfade. */
.top.on-dark.over-page { --hdr-a: -1; --hdr-b: -.9; } /* ink 1 at every --hdr */
/* Over a dark band below the demo (app.js onHeader: [data-tone="dark"] under the header's middle) it is evening again:
   white text and logo at every --hdr, and the ground that fades in is night instead of paper. */
.top.on-dark.over-dark { --hdr-a: 2; --hdr-b: 3; background: rgba(11, 17, 19, calc(.9 * var(--hdr))); border-bottom-color: rgba(243, 242, 239, calc(.2 * var(--hdr))); }
.top.on-dark .top-logo { position: relative; display: block; }
.top.on-dark .logo-white { display: block; position: absolute; left: 0; top: 0; opacity: calc(1 - var(--hdr-ink)); }
.top.on-dark .logo-ink { opacity: var(--hdr-ink); }
.top.on-dark .top-nav > a:not(.btn) { color: var(--hdr-fg); }
.top.on-dark .top-nav > a:not(.btn):hover { color: color-mix(in srgb, var(--ink) calc(var(--hdr-step) * 100%), var(--amber)); }
.top.on-dark .btn-sm { color: var(--hdr-fg); border-color: color-mix(in srgb, var(--text) calc(var(--hdr-ink) * 100%), rgba(255, 255, 255, .6)); }
.top.on-dark .btn-sm:hover { background: color-mix(in srgb, var(--text) calc(var(--hdr-step) * 100%), #fff); border-color: color-mix(in srgb, var(--text) calc(var(--hdr-step) * 100%), #fff); color: color-mix(in srgb, #fff calc(var(--hdr-step) * 100%), var(--text)); }
.top.on-dark :focus-visible { outline-color: var(--hdr-ring); }
.top.on-dark .lang ul :focus-visible { outline-color: var(--ink); } /* the language list is always white */

/* ---------- the hero ---------- */
.hero2 {
  /* The hero fills the window on every desktop size, so before any scroll nothing of the demo shows (the type,
     the copy column and the buttons keep their own caps; only this box and the photo grow with the window). */
  --hero-h: max(36rem, 100vh);
  /* The photo layer is never wider than MAX_ZOOM (1.3) × the hero height in 16:9, so on ultra-wide windows
     the photo is not zoomed until the lamp and the desk fall out of view. */
  --photo-w: min(100%, calc(var(--hero-h) * 16 / 9 * 1.3));
  /* Where the layer is narrower than the window its edges fade into the night ground; full width: no fade. */
  --photo-fade: clamp(0px, 100vw - var(--hero-h) * 16 / 9 * 1.3, 12rem);
  /* A tall, narrow window (layer narrower than 1.1 × its height, e.g. a portrait monitor): the photo stops growing in
     height and sits on the hero's bottom, so cover does not crop the stack off its right side; above it the night
     ground shows, faded in. On 16:9-ish windows this is the full hero height. */
  --photo-h: calc(min(100vw, var(--hero-h) * 16 / 9 * 1.3) / 1.1);
  --photo-fade-y: clamp(0px, var(--hero-h) - var(--photo-h), 12rem);
  /* No own stacking context: the photo (z 1), the shade (z 2) the desk layer (#hero-desk, z 3) and the paper (z 4) paint under the fixed 3D canvas (#hero-gl, z 5),
     the copy (z 6) over it, the header (.top, z 10) over all. All positive, so nothing drops under this ground. */
  position: relative;
  height: var(--hero-h); min-height: 36rem;
  /* The night ground shows until the photo has loaded (and beside a bounded photo), so white text is never on paper. */
  background: var(--night); color: #fff;
}
@supports (height: 100svh) { .hero2 { --hero-h: max(36rem, 100svh); } }
/* A very short window: let the copy set the height rather than spill out of the photo. */
@media (max-height: 40rem) { .hero2 { height: auto; } }

/* Geometry contract with hero-math.js: the 3D layer maps photo points on this element's own rectangle with
   coverRect(w, h, PHOTO_ASPECT, FOCUS_Y), FOCUS_Y = 0.8 = the 80% below. Change both together. */
.hero2-bg {
  position: absolute; top: auto; bottom: 0; left: 0; right: 0; z-index: 1;
  /* The height is spelled out (a 1.1 box, capped by the hero), not left to aspect-ratio + max-height: with those
     WebKit narrows the box to 1.1 × the capped height and the photo ends in a hard edge short of the window. */
  width: var(--photo-w); height: min(100%, var(--photo-h)); margin: 0 auto;
  background: var(--night) 50% 80% / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--photo-fade), #000 calc(100% - var(--photo-fade)), transparent 100%),
    linear-gradient(180deg, transparent 0, #000 var(--photo-fade-y));
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--photo-fade), #000 calc(100% - var(--photo-fade)), transparent 100%),
    linear-gradient(180deg, transparent 0, #000 var(--photo-fade-y));
  mask-composite: intersect;
  opacity: 0; transition: opacity 1.1s ease;
}
.hero2-bg[data-scene="home"] { opacity: 1; background-image: url(/assets/scene-home-still.webp); }
.hero2-bg[data-scene="dispatch"] { background-image: url(/assets/scene-dispatch-still-2.webp); }
.hero2-bg[data-scene="office"] { background-image: url(/assets/scene-office-still.webp); }
#hero[data-doc="delivery"] .hero2-bg[data-scene="home"], #hero[data-doc="order"] .hero2-bg[data-scene="home"] { opacity: 0; }
#hero[data-doc="order"] .hero2-bg[data-scene="office"] { opacity: 1; }
#hero[data-doc="delivery"] .hero2-bg[data-scene="dispatch"] { opacity: 1; }
/* With the 3D stack running the sheets are drawn live, so the clean desk shows. */
#hero.has-3d .hero2-bg[data-scene="home"] { background-image: url(/assets/scene-home.webp); }
#hero.has-3d .hero2-bg[data-scene="dispatch"] { background-image: url(/assets/scene-dispatch.webp); }
#hero.has-3d .hero2-bg[data-scene="office"] { background-image: url(/assets/scene-office.webp); }
/* Below 1700px on a screen of at most 1.01 dppx (a ratio a hair above 1 counts as 1) the 1600px files are enough;
   hero.js (preloadCleanDesk) picks the same file by the same rule. */
@media (max-width: 1699px) and (max-resolution: 1.01dppx) {
  .hero2-bg[data-scene="home"] { background-image: url(/assets/scene-home-still-1600.webp); }
  .hero2-bg[data-scene="dispatch"] { background-image: url(/assets/scene-dispatch-still-2-1600.webp); }
  .hero2-bg[data-scene="office"] { background-image: url(/assets/scene-office-still-1600.webp); }
  #hero.has-3d .hero2-bg[data-scene="office"] { background-image: url(/assets/scene-office-1600.webp); }
  #hero.has-3d .hero2-bg[data-scene="home"] { background-image: url(/assets/scene-home-1600.webp); }
  #hero.has-3d .hero2-bg[data-scene="dispatch"] { background-image: url(/assets/scene-dispatch-1600.webp); }
}
/* Phones show the photo as a band of at most ~800px: the 1600 file is enough at any density (with the 3D stack
   too: hero.js preloadCleanDesk picks the same file). */
@media (max-width: 800px) {
  #hero.has-3d .hero2-bg[data-scene="office"] { background-image: url(/assets/scene-office-1600.webp); }
  #hero.has-3d .hero2-bg[data-scene="home"] { background-image: url(/assets/scene-home-1600.webp); }
  #hero.has-3d .hero2-bg[data-scene="dispatch"] { background-image: url(/assets/scene-dispatch-1600.webp); }
  .hero2-bg[data-scene="office"] { background-image: url(/assets/scene-office-still-1600.webp); }
  .hero2-bg[data-scene="home"] { background-image: url(/assets/scene-home-still-1600.webp); }
  .hero2-bg[data-scene="dispatch"] { background-image: url(/assets/scene-dispatch-still-2-1600.webp); }
}

/* Darkens the left side behind the copy (keyed to the copy column, not the window) and the top behind the header. */
.hero2-shade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 7, 6, .88) 0, rgba(8, 7, 6, .74) calc(var(--side) + 26rem), rgba(8, 7, 6, 0) calc(var(--side) + 54rem)),
    linear-gradient(180deg, rgba(8, 7, 6, .6) 0, rgba(8, 7, 6, 0) 10rem);
}

.hero2-copy {
  position: relative; z-index: 6;
  overflow-x: clip; /* the headline word's particle canvas reaches past the word: never a sideways scroll */
  height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 7rem var(--side) 3.5rem;
}
.hero2-copy > * { max-width: 41rem; }
.hero2 .eyebrow { margin: 0; font-size: .8125rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); }
.hero2 h1 { margin: 1.125rem 0 0; font-weight: 700; font-size: clamp(2.4rem, 4.4vw, 4.9rem); line-height: 1.04; letter-spacing: -.012em; color: #fff; text-wrap: balance; }
.hero2 .lead { margin: 1.5rem 0 0; max-width: 36rem; font-size: 1.25rem; line-height: 1.5; color: rgba(255, 255, 255, .86); }
.chooser-ask { margin: 2.25rem 0 0; font-size: .9375rem; color: rgba(255, 255, 255, .7); }
/* "Every [invoice] becomes data.": the word follows the choice (hero-word.js); its slot's width eases along with
   it, so the rest of the sentence moves smoothly. During a change the text is hidden under the particle canvas. */
.hero-line { position: relative; margin: 1.75rem 0 0; font-size: 1.75rem; font-weight: 600; line-height: 1.2; color: #fff; }
.hero-line + .chooser-ask { margin-top: 1rem; }
.hero-word { display: inline-block; white-space: nowrap; color: var(--amber); transition: width .75s cubic-bezier(.65, 0, .35, 1) .45s; }
.hero-word.busy .hero-word-text { opacity: 0; }
.hero-word-fx { position: absolute; pointer-events: none; }
/* The word on a line of its own where any choice would re-wrap the sentence (hero-word.js). */
.hero-line.stack .hero-word { display: block; width: fit-content; }
.chooser { margin-top: .625rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.chooser button {
  font: 500 .9375rem/1.2 'Barlow', sans-serif; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .4); border-radius: 999px; padding: .6em 1.15em;
  transition: background-color .25s, border-color .25s, color .25s;
}
.chooser button:hover { background: rgba(255, 255, 255, .15); }
.chooser button[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #1D1608; font-weight: 600; }
.hero2 :focus-visible { outline-color: #fff; }
/* The buttons' and pills' own borders are light: the ring stands clear of them, in amber. */
.hero2 .btn:focus-visible, .chooser button:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }
.hero-cta { margin-top: 2.25rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.hero2 .btn-primary { background: #fff; border-color: #fff; color: var(--text); }
.hero2 .btn-primary:hover { background: var(--amber); border-color: var(--amber); color: #1D1608; }
/* A dark translucent fill (night at 62%) keeps the label legible over a sheet edge: white on it is >= 5:1 even over white paper. */
.hero2 .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .6); background: rgba(11, 17, 19, .62); }
.hero2 .btn-outline:hover { background: #fff; border-color: #fff; color: var(--text); }

/* The 3D layers, transparent and click-through, empty until hero-3d.js draws on them. The desk layer takes the
   photo's (.hero2-bg's) box, set by hero-3d.js, above the shade and below the copy, and scrolls with it; the fixed
   one holds only the sheet in the air. */
#hero-desk { position: absolute; top: 0; left: 0; z-index: 3; pointer-events: none; visibility: hidden; } /* box: hero-3d.js, from .hero2-bg */
#hero.has-3d #hero-desk { visibility: visible; }
/* Evening turns to paper as the sheet flies (hero.js sets the opacity per frame; 3D only): over the photo and the
   desk layer, under the flying sheet and the copy (which fades out first). */
.hero2-paper { position: absolute; inset: 0; z-index: 4; background: var(--paper); opacity: 0; pointer-events: none; }
#hero-gl { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
/* A phone's window grows and shrinks with its address bar: the canvas keeps the largest height, so the drawing
   buffer is not rebuilt in the middle of a scroll. */
@media (max-width: 760px) { @supports (height: 100lvh) { #hero-gl { bottom: auto; height: 100lvh; } } }
/* On a phone the sheet's way down crosses the copy column (on the wide hero it flies beside it): there the sheet
   is drawn over the copy, still under the header. */
@media (max-width: 760px) { #hero-gl { z-index: 7; } }

@media (prefers-reduced-motion: reduce) { .hero2-bg, .chooser button, .hero-word { transition: none; } }

/* ---------- "your own document": four steps over the demo's data sheet (#form), in the stage's own 900×720 px ---------- */
.custom-steps {
  position: absolute; left: 0; top: 0; width: 340px; height: 720px; box-sizing: border-box; padding: 44px 34px 36px;
  display: flex; flex-direction: column; overflow: hidden; font-size: 16px; color: var(--text);
  box-shadow: 0 1px 2px rgba(40,32,20,.06), 0 30px 60px -40px rgba(40,32,20,.5);
  scale: var(--sf, 1); transform-origin: 0 0; /* exactly on #form: same box, same scale (app.js fitStage) */
}
.custom-steps[hidden] { display: none; }
.custom-steps h2 { margin: 0 0 32px; font-size: 27px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
.custom-steps ol { margin: 0; padding: 0; list-style: none; counter-reset: cs; display: flex; flex-direction: column; gap: 26px; }
.custom-steps li { counter-increment: cs; position: relative; padding: 0 0 0 46px; font-size: 18px; line-height: 1.4; }
.custom-steps li::before {
  content: counter(cs); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border: 1.5px solid var(--ink);
  border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--ink);
}
.custom-note { margin: auto 0 0; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 15px; line-height: 1.45; color: var(--muted); }
/* No 3D sheet to stand on the demo's page: the CMR sample covers it instead (exactly on #doc: its box and scale). */
.custom-page { position: absolute; left: var(--dx, 380px); top: 0; width: 520px; max-width: none; height: 720px; scale: var(--sd, 1); transform-origin: 0 0; box-shadow: 0 1px 2px rgba(40,32,20,.08), 0 30px 60px -40px rgba(40,32,20,.5); }
.custom-page[hidden] { display: none; }
.stage.is-custom .links { visibility: hidden; }
/* While custom the demo's invoice steps collapse (app.js then finds no step to drive) and one own-document step
   stands in their column: what happens with your own document, and the way to it. */
.own-step { display: none; }
#how.is-custom .step { display: none; }
#how.is-custom .own-step { min-height: 51.25rem; display: flex; flex-direction: column; justify-content: center; }
.own-step .step-text { align-items: flex-start; }
.own-step h2 { margin: 0; font-weight: 600; font-size: 2.75rem; line-height: 1.04; letter-spacing: -.01em; text-wrap: balance; overflow-wrap: normal; hyphens: manual; }
/* Wide screens: the same size as the step headings it stands in for (styles.css), not the 2.75rem above. */
@media not all and (max-width: 1100px) { #how .own-step h2 { font-size: clamp(1.5rem, .7rem + 1vw, 2.25rem); line-height: 1; } }
.own-step p { margin: 0; font-size: 1.125rem; line-height: 1.55; color: var(--soft); }
/* While custom: the demo's tab row keeps its place but is hidden, and no tray item looks pressed (visual only;
   aria-pressed stays the demo's truth). */
#how.is-custom .tabs { visibility: hidden; }
#how.is-custom .tray-item[aria-pressed="true"] { border-color: var(--tray-idle-border, rgba(26,25,23,.18)); box-shadow: var(--tray-idle-shadow, 0 1px 2px rgba(40,32,20,.06)); }
#how.is-custom .tray-item[aria-pressed="true"] .tray-label { background: var(--tray-idle-label, rgba(26,25,23,.06)); color: inherit; }

/* ---------- narrower screens: the copy on the night ground, the photo as a band below it ---------- */
@media (max-width: 1100px) {
  .hero2 { --photo: min(44rem, 55.8vw); height: auto; min-height: 0; padding-bottom: var(--photo); }
  .hero2-bg { top: auto; height: var(--photo); width: auto; aspect-ratio: auto; max-height: none; -webkit-mask-image: none; mask-image: none; }
  .hero2-shade { top: auto; height: var(--photo); background: linear-gradient(180deg, var(--night) 0, rgba(11, 17, 19, 0) 35%); }
  .hero2-copy { height: auto; padding: 7.5rem var(--side) 2.5rem; }
}
@media (max-width: 1100px) { #how.is-custom .own-step { min-height: 0; padding: 2.5rem 0 0; } }
@media (max-width: 760px) {
  .own-step h2 { font-size: 2rem; }
  /* Phones: the photo first, as a band at the top under the header, so the lamp and the paper stack are on the
     first screen and the chooser's scene change is seen; the copy follows on the night ground. The band shows the
     photo's right side (the lamp and the stack stand there in all three scenes); its foot fades into the ground. */
  .hero2 { --photo: min(20rem, 58vw, 55svh); padding-top: var(--photo); padding-bottom: 0; } /* 55svh: a phone on its side keeps the headline on the first screen */
  .hero2-bg { top: 0; bottom: auto; background-position: 100% 80%; }
  .hero2-shade { top: 0; bottom: auto; background: linear-gradient(180deg, rgba(8, 7, 6, .62) 0, rgba(8, 7, 6, 0) 5rem), linear-gradient(180deg, rgba(11, 17, 19, 0) 86%, var(--night) 100%); }
  .hero2-copy { padding-top: 1rem; padding-bottom: 2rem; }
  .hero2 h1 { margin-top: .75rem; }
  .hero2 .lead { margin-top: 1rem; font-size: 1.0625rem; }
  .hero-line { margin-top: 1.25rem; font-size: 1.375rem; }
  .hero-cta { margin-top: 1.5rem; }
  .hero-cta .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- the audience pages' hero (slice 3: /accountants/, /enterprise/) ----------
   The same evening photo, shade and copy column as the landing page's, without the chooser, the stack and the 3D:
   the page carries data-doc so the scene rules above pick the desk (invoice -> the study, order -> the office).
   Shorter than the landing hero, so the first band starts on the first screen. */
.hero-sub { --hero-h: max(28rem, 68vh); min-height: 28rem; }
@supports (height: 100svh) { .hero-sub { --hero-h: max(28rem, 68svh); } }
.hero-sub h1 { font-size: clamp(2.1rem, 3.4vw, 3.75rem); }
.hero-sub .lead { margin-top: 1.25rem; }
.hero-sub .hero-cta { margin-top: 2rem; }
