/* Better Totes · the live hero, on the homepage (scene #stores, its work shot).
   A faithful port of the store's hero: Better Totes/theme/sections/bt-hero.liquid (markup, styles, script).
   Mobile: the column with round swatches. Desktop (a fine pointer, or 1000px and wider, the store's own switch):
   the Diagonal, full bleed field, chips and the big lockup. Both are driven by bt-hero.js.
   Changes from the store: no Better Totes top bar (Adam's masthead sits above; the hero sits under it in a .site
   layer), no Find your tote button (Adam's call: the swatches and lockup sit as they would without it), the hero
   takes a touch only while it is the shot on screen, and it zooms for the title like every .zoomin layer.
   Everything here is the client's depicted site, so it sits inside [data-work]. With the button gone the hero sets
   no type of its own (the lockups are images), so it loads none of the store's fonts. */

/* ---------- in the deck ---------- */
/* the title's layer never takes a touch, so the hero under it can (its canvas already lets them through) */
#stores .layer.knock { pointer-events: none; }

/* the hero fills its layer; it ignores every touch until bt-hero.js marks it live (#stores, the work shot on screen).
   pan-y: a vertical drag always belongs to the deck; the script claims a drag only once it is clearly sideways */
.layer > .bt-hero { position: absolute; inset: 0; }
.bt-hero { touch-action: pan-y; pointer-events: none; }
.bt-hero.is-live { pointer-events: auto; }

/* the title reads through the hero's bright field (the pink, to start): the same zoom as every .zoomin layer
   (film.css), aimed at the empty field above the lockup, held while the camera dives, then eased back to the whole hero */
.bt-hero { --px: 50%; --py: 15%; --zs: 2.6; }
.zoomin > .bt-hero {
  --k: calc(1 - clamp(0, (var(--s, 0) - var(--z0, 0)) / (var(--dz, .92) - var(--z0, 0)), 1));
  transform-origin: var(--px) var(--py);
  transform: translate(calc((var(--cx, 50%) - var(--px)) * var(--k)), calc((var(--cy, 46%) - var(--py)) * var(--k))) scale(calc(1 + var(--zs, 2.4) * var(--k)));
}
html.reduced .zoomin > .bt-hero { transform: none; }

/* ---------- the store's hero ---------- */
/* the starting colourway is Green (the green bag on the pink field, data-start in the markup); bt-hero.js repaints these */
.bt-hero { --field: #98FF98; --text: #AC4DBA; --fg: #1A1818; --ui: #AC4DBA;
  --band-h: clamp(86px, 14.2vh, 128px);
  /* the store measures the lockup from the top of the screen; here the hero starts under the masthead, so the
     lockup keeps the store's exact place on screen */
  --band-top: max(8px, calc(clamp(58px, min(8vw, 8.4vh), 76px) - var(--mast)));
  --band-bot: clamp(94px, calc(var(--band-h) + min(2.4vw, 2.2vh)), 148px); }
.bt-hero { background: var(--field); color: var(--fg);
  transition: background-color .22s ease, color .22s ease; overflow: hidden; isolation: isolate; }
.bt-hero * { margin: 0; padding: 0; box-sizing: border-box; }
/* during a commit the root is included: on mobile the colour field is .bt-hero itself */
.bt-hero.swapping, .bt-hero.swapping * { transition: none !important; }
.bt-hero .bth-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* device switch: mobile by default, the Diagonal on desktop */
.bt-hero .bthd-stage { display: none; }

/* ===================== MOBILE ===================== */
.bt-hero .bth-mobile { height: 100%; }
.bt-hero .bth-stage { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) 14px; }
.bt-hero .bth-main { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 14px; }
.bt-hero .bth-figure { position: relative; min-width: 0; min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.bt-hero .bth-hl { display: block; width: 100%; height: auto; max-width: none; flex: 0 0 auto; min-width: 0; position: relative; z-index: 1; transform: translateY(60px); }
.bt-hero .bth-picker { flex: 0 0 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 10; }
.bt-hero .bth-swatches { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.bt-hero .bth-sw { width: 28px; height: 28px; border-radius: 50%; background: var(--sf); position: relative; cursor: pointer; flex: 0 0 auto;
  border: 0; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); transition: transform .14s ease; }
.bt-hero .bth-sw::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--st); }
.bt-hero .bth-sw[aria-pressed="true"] { transform: scale(1.18); }
.bt-hero .bth-sw[aria-pressed="true"]::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--fg); }
.bt-hero .bth-reveal { position: absolute; inset: 0; z-index: 5; display: none; overflow: hidden; pointer-events: none; will-change: clip-path; }
.bt-hero .bth-reveal.show { display: block; }
.bt-hero .bth-reveal.fromL { clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0); }   /* drag right: the next colourway slides in from the left */
.bt-hero .bth-reveal.fromR { clip-path: inset(0 0 0 calc((1 - var(--p, 0)) * 100%)); }   /* drag left: the next colourway slides in from the right */
.bt-hero .bth-rlk { position: absolute; display: none; max-width: none; }

/* ===================== DESKTOP · Diagonal ===================== */
.bt-hero .bthd-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
.bt-hero .bthd-field { position: absolute; inset: 0; z-index: 0; background: var(--field); transition: background .45s ease; }
.bt-hero .bthd-lockwrap { position: absolute; z-index: 3; top: var(--band-top); left: 1.5vw; right: 1.5vw; bottom: var(--band-bot); pointer-events: none; }
.bt-hero .bthd-lock { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: center; }
.bt-hero .bthd-reveal { position: absolute; inset: 0; z-index: 5; display: none; overflow: hidden; pointer-events: none; will-change: clip-path;
  background: var(--rbg, #F6FBFC); clip-path: inset(0 calc(var(--p, 0) * 100%) 0 0); }
.bt-hero .bthd-reveal.show { display: block; }
.bt-hero .bthd-rev-lockwrap { position: absolute; top: var(--band-top); left: 1.5vw; right: 1.5vw; bottom: var(--band-bot); }
.bt-hero .bthd-rev-lock { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: center; }
.bt-hero .bthd-band { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; height: var(--band-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; padding: 0 40px; }
.bt-hero .bthd-swatches { grid-column: 2; display: flex; align-items: center; justify-content: center; gap: 9px; }
.bt-hero .bthd-sw { position: relative; width: clamp(38px, min(3.5vw, 5.8vh), 50px); height: clamp(38px, min(3.5vw, 5.8vh), 50px); border: 0; padding: 0; cursor: pointer; background: transparent; border-radius: 11px; display: flex; align-items: flex-end; justify-content: flex-start; transition: transform .22s cubic-bezier(.2,.7,.2,1); }
.bt-hero .bthd-sw .chip { position: absolute; inset: 0; border-radius: 11px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(20,24,32,.12); }
.bt-hero .bthd-sw .chip::before { content: ''; position: absolute; inset: 0; background: var(--c-field); }
.bt-hero .bthd-sw .chip::after { content: ''; position: absolute; inset: 0; background: var(--c-text); clip-path: polygon(58% 0, 100% 0, 100% 100%, 38% 100%); }
.bt-hero .bthd-sw[aria-pressed="true"] { transform: translateY(-3px); }
.bt-hero .bthd-sw[aria-pressed="true"] .chip { box-shadow: inset 0 0 0 1px rgba(20,24,32,.12), 0 0 0 2.5px var(--ui, #141920); }
@media (hover: hover) {
  .bt-hero .bthd-sw:hover { transform: translateY(-3px); }
}

/* the store's device switch: a fine pointer with hover, or a screen 1000px and wider, gets the Diagonal */
@media (min-width: 1000px), (hover: hover) and (pointer: fine) {
  .bt-hero .bth-mobile { display: none; }
  .bt-hero .bthd-stage { display: block; }
  /* the title, through the empty field between "the" and the bag */
  .bt-hero { --px: 47%; --py: 11.5%; --zs: 3.6; }
}
/* narrow desktop (a mouse on a small window still gets the Diagonal): the band stacks, so the swatch rail wraps */
@media (hover: hover) and (pointer: fine) and (max-width: 999px) {
  .bt-hero .bthd-lockwrap,
  .bt-hero .bthd-rev-lockwrap { top: max(8px, calc(clamp(50px, min(11vw, 9vh), 64px) - var(--mast))); bottom: clamp(150px, min(34vw, 34vh), 210px); left: 4vw; right: 4vw; }
  .bt-hero .bthd-band { height: auto; display: flex; flex-direction: column; gap: clamp(8px, 2.4vh, 14px); align-items: stretch; padding: 0 18px clamp(14px, 3.5vh, 22px); }
  .bt-hero .bthd-swatches { justify-content: center; gap: 8px; flex-wrap: wrap; }
  .bt-hero .bthd-sw { width: clamp(32px, min(8.4vw, 9vh), 46px); height: clamp(32px, min(8.4vw, 9vh), 46px); }
}

/* keyboard focus: a ring in the hero's own ink, so it shows on every colourway (the store had none on the chips) */
.bt-hero :focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.bt-hero .bth-sw:focus-visible { outline-offset: 6px; }
.bt-hero .bthd-sw:focus-visible { outline-offset: 5px; border-radius: 11px; }

@media (prefers-reduced-motion: reduce) {
  .bt-hero, .bt-hero .bthd-field { transition: none; }
}
