/* Hero: a tall scroll track with a pinned stage. Scrolling through the track moves the
   3D camera from bay to bay (js/hero). --chapter-scroll = scroll length per chapter.
   After the last chapter the stage stays pinned for one more screen (--reveal) while the next
   section (how.css, pulled up by the same amount) slides up over it. */
:root { --reveal: 100vh; --reveal: 100svh; }
.hero {
  --chapter-scroll: 95vh;
  position: relative;
  height: calc(100vh + var(--chapter-scroll) * 2 + var(--reveal));
  height: calc(100svh + var(--chapter-scroll) * 2 + var(--reveal));
}
/* measuring stick for js/hero/scroll.js: the reveal stretch is not part of the chapter track */
.hero__reveal { position: absolute; bottom: 0; width: 0; height: var(--reveal); visibility: hidden; pointer-events: none; }
.hero__stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: radial-gradient(90% 70% at 30% 70%, #1b1d22 0%, var(--surface-dark) 70%);
}
.hero__gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 55%, rgba(14, 15, 18, 0) 45%, rgba(14, 15, 18, 0.7) 100%),
    linear-gradient(180deg, rgba(14, 15, 18, 0.55) 0%, rgba(14, 15, 18, 0) 22%, rgba(14, 15, 18, 0) 72%, rgba(14, 15, 18, 0.75) 100%);
}
/* keeps the copy readable while a truck passes behind it */
.hero__vignette::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to left, rgba(14, 15, 18, 0.78) 0%, rgba(14, 15, 18, 0.5) 30%, rgba(14, 15, 18, 0) 52%);
}
/* English (LTR): the copy is on the left, so the shade is too */
:root[dir="ltr"] .hero__vignette::after { background: linear-gradient(to right, rgba(14, 15, 18, 0.78) 0%, rgba(14, 15, 18, 0.5) 30%, rgba(14, 15, 18, 0) 52%); }
/* Static film grain: one small tile, no animation (an animated grain layer repaints the
   whole viewport every step and was a source of scroll jank). */
.hero__grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Phone hero (.hero-m): replaces the 3D stage up to 820px wide, where none of the scene loads.
   An ordinary dark hero in the order a visitor needs it: what H10 does (title and one line), the
   three services as tiles, the two buttons, then one fleet photo carrying the insured-flatbeds
   badge. It stays put while the next section slides up over it, like every other page's hero
   (base.css; js/sticky-hero.js keeps a tall one's bottom on screen). */
.hero-m { display: none; }
@media (max-width: 820px) {
  .hero { display: none; }
  main .hero + * { margin-top: 0; }            /* no pinned stage to slide over: an ordinary sheet */
  .hero-m {
    display: block; position: sticky; top: var(--hero-top, 0px); z-index: 0;
    overflow-x: clip;                          /* the closed button menus sit outside the edge */
    padding: calc(max(16px, env(safe-area-inset-top)) + var(--tap-min) + 40px) 16px 28px;
    background: radial-gradient(90% 55% at 85% 12%, rgba(242, 183, 5, 0.14), transparent 70%), var(--surface-dark);
    color: var(--text-on-dark);
  }
  .hero-m:dir(ltr) { background: radial-gradient(90% 55% at 15% 12%, rgba(242, 183, 5, 0.14), transparent 70%), var(--surface-dark); }
  .hero-m ~ * { position: relative; z-index: 1; }
  .hero-m__inner { display: flex; flex-direction: column; gap: 16px; max-width: 560px; margin-inline: auto; }
  .hero-m__eyebrow { margin: 0; font-size: 14px; font-weight: 600; color: var(--h10-yellow); }
  .hero-m__title { margin: 0; font-size: clamp(34px, 10vw, 46px); font-weight: 700; line-height: 1.2; text-wrap: balance; }
  .hero-m__title span { color: var(--h10-yellow); }
  .hero-m__lead { margin: 0; font-size: 16px; line-height: 1.75; color: var(--muted-on-dark); }

  /* the three services: equal tiles, icon over the name, a tap goes to the services page */
  .hero-m__services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
  .hero-m__services a {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    min-height: 100%; padding: 14px 6px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    color: #FFFFFF; text-decoration: none; text-align: center;
    font-size: 14px; font-weight: 600; line-height: 1.35;
    transition: background-color 150ms ease, transform 160ms var(--ease-out);
    -webkit-tap-highlight-color: transparent;
  }
  .hero-m__services a:active { transform: scale(0.97); background: rgba(255, 255, 255, 0.1); }
  .hero-m__services a:focus-visible { outline: 2px solid var(--h10-yellow); outline-offset: 2px; }
  .hero-m__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--h10-yellow); color: var(--h10-ink); }
  .hero-m__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .hero-m__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
  .hero-m__actions > * { flex: 1 1 0; }
  .hero-m__actions .arrow-btn { width: 100%; justify-content: center; }
  /* the second button's menu hangs from its outer edge, so it stays on screen */
  .hero-m__actions > :last-child .app-picker__panel { inset-inline-start: auto; inset-inline-end: 0; transform-origin: top left; }
  .hero-m__actions > :last-child .app-picker__panel:dir(ltr) { transform-origin: top right; }

  /* the photo, with the insured-flatbeds badge on its lower corner */
  .hero-m__photo { position: relative; margin: 8px 0 0; border-radius: 24px; overflow: hidden; background: #1A1C21; }
  .hero-m__photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
  .hero-m__badge {
    position: absolute; inset-inline-start: 12px; bottom: 12px;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px 8px 10px; border-radius: 999px;
    background: #FFFFFF; color: var(--h10-ink);
    font-size: 14px; font-weight: 700; line-height: 1.2;
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
  }
  .hero-m__badge svg { width: 20px; height: 20px; fill: var(--h10-yellow); stroke: var(--h10-ink); stroke-width: 1.6; stroke-linejoin: round; }
}
@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .hero-m__services a { transition: none; }
}

/* Wordmark (loader) */
.logo { display: flex; color: var(--h10-yellow); }
.logo .h10-wordmark { height: 30px; width: auto; }

/* Chapter copy: crossfades per chapter, never scrubs */
.hero__copy {
  position: absolute; z-index: 4;
  inset-inline-start: clamp(16px, 6vw, 96px);
  top: max(96px, calc(50% - 200px));
  width: min(520px, 42vw);
}
.chapter { position: absolute; inset: 0 0 auto 0; display: flex; flex-direction: column; gap: clamp(10px, 2vh, 18px); }
.chapter > * {
  opacity: 0; transform: translateY(14px); filter: blur(6px);
  transition: opacity 480ms var(--ease-out), transform 640ms var(--ease-out), filter 480ms var(--ease-out);
}
.chapter.is-on > * { opacity: 1; transform: none; filter: blur(0); }
.chapter.is-on > :nth-child(2) { transition-delay: 60ms; }
.chapter.is-on > :nth-child(3) { transition-delay: 120ms; }
.chapter.is-on > :nth-child(4) { transition-delay: 180ms; }
.chapter.is-on > :nth-child(5) { transition-delay: 220ms; }
.chapter.is-leaving > * { transition-duration: 240ms; transform: translateY(-10px); }

.eyebrow { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; color: var(--h10-yellow); }
.eyebrow .sf { font-size: 13px; }
.chapter h1, .chapter h2 {
  margin: 0; font-weight: 700; line-height: 1.2; text-wrap: balance;
  font-size: clamp(36px, min(5vw, 8.5vh), 76px);
}
.chapter h1 span, .chapter h2 span { color: var(--h10-yellow); }
.chapter__sub { margin: 0; max-width: 46ch; font-size: clamp(16px, 1.35vw, 20px); line-height: 1.8; color: var(--muted-on-dark); }

/* App first, website second */
.chapter__get { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }

/* Chapter rail */
.rail {
  position: absolute; z-index: 4;
  inset-inline-end: clamp(16px, 3vw, 40px); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
}
.rail button {
  all: unset; cursor: pointer;
  display: flex; flex-direction: row-reverse; align-items: center; gap: 12px;
  min-height: 32px; padding: 4px 0;
}
.rail .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); transition: transform 240ms var(--ease-out), background-color 240ms ease; }
.rail .lbl { font-size: 13px; font-weight: 600; color: var(--dim-on-dark); opacity: 0; transform: translateX(6px); transition: opacity 240ms ease, transform 240ms var(--ease-out); }
.rail button[aria-current="true"] .dot { background: var(--h10-yellow); transform: scale(1.8); }
.rail button[aria-current="true"] .lbl { opacity: 1; transform: none; color: #FFFFFF; }
.rail button:focus-visible { outline: 2px solid var(--h10-yellow); outline-offset: 4px; border-radius: 4px; }

.hero__count { position: absolute; z-index: 4; bottom: 32px; inset-inline-end: clamp(16px, 3vw, 40px); display: flex; align-items: baseline; gap: 8px; color: var(--dim-on-dark); }
.hero__count b { font-size: 28px; font-weight: 700; color: #FFFFFF; }

.scroll-cue {
  position: absolute; z-index: 4; bottom: 28px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 13px; color: var(--dim-on-dark);
  transition: opacity 300ms ease;
}
.scroll-cue.is-hidden { opacity: 0; }
.scroll-cue .track { position: relative; width: 1px; height: 44px; overflow: hidden; background: var(--line-on-dark); }
.scroll-cue .track::after {
  content: ""; position: absolute; inset: 0; background: var(--h10-yellow);
  transform: translateY(-100%); animation: cue 1.8s var(--ease-out) infinite;
}
@keyframes cue { 0% { transform: translateY(-100%); } 60%, 100% { transform: translateY(100%); } }

/* Loader */
.hero__loader {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center;
  background: var(--surface-dark);
  transition: opacity 600ms ease, visibility 600ms;
}
.hero__loader.is-done { opacity: 0; visibility: hidden; }
/* if the scene's scripts are slow to arrive (or never do), the loader still steps aside */
.hero__loader:not(.is-done) { animation: hero-loader-out 600ms ease 4s forwards; }
@keyframes hero-loader-out { to { opacity: 0; visibility: hidden; } }
.hero__loader .box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero__loader .bar { width: 180px; height: 2px; overflow: hidden; background: var(--line-on-dark); }
.hero__loader .bar i { display: block; height: 100%; background: var(--h10-yellow); transform: scaleX(0); transform-origin: right; transition: transform 200ms linear; }
.hero__loader .pct { font-size: 13px; color: var(--dim-on-dark); }

@media (max-width: 820px) {
  .hero { --chapter-scroll: 85vh; }
  .hero__copy { top: 96px; width: auto; inset-inline: 16px; }
  .hero__vignette::after { background: linear-gradient(180deg, rgba(14, 15, 18, 0.8) 0%, rgba(14, 15, 18, 0.55) 45%, rgba(14, 15, 18, 0) 62%); }
  .chapter { gap: 12px; }
  .chapter__sub { font-size: 15px; line-height: 1.7; }
  .chapter__get { gap: 12px; }
  .store { min-height: 48px; padding: 0 12px; }
  .store b { font-size: 15px; }
  .rail { top: auto; bottom: 22px; transform: none; flex-direction: row; gap: 4px; inset-inline-end: 12px; }
  .rail button { min-width: 32px; justify-content: center; }
  .rail .lbl { display: none; }
  /* physical sides: the counter is dir=ltr, so its logical sides would flip */
  .hero__count { bottom: 26px; right: 16px; left: auto; }
  :root[dir="ltr"] .hero__count { right: auto; left: 16px; }   /* the rail sits on the right in English */
  .scroll-cue { display: none; }
}
@media (max-width: 380px) {
  .chapter__sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chapter > * { transition-duration: 1ms !important; transform: none !important; filter: none !important; }
  .scroll-cue .track::after { animation: none; }
}


/* Whatever section follows the hero is the sheet that slides up over its pinned stage: pulled up
   by the reveal stretch, stacked above it, rounded top corners and a soft shadow so it reads as a
   sheet rising off the hero. (Set here, not on one section, so the home page can be reordered.) */
.hero + * {
  position: relative; z-index: 10;
  margin-top: calc(var(--reveal) * -1);
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -24px 48px -24px rgba(0, 0, 0, 0.45);
}
@media (max-width: 900px) {
  .hero + * { border-radius: 24px 24px 0 0; }
}
