/* ============================================================
   css/highlights.css — "Highlights" banner at the top of 09 / Proof
   (js/highlights.js, .hl- prefix). Large window-framed screenshots
   drifting in a full-bleed loop (.is-loop), or — under reduced motion /
   "Pause animations" — a horizontal scroll-snap row (.is-snap). Same
   card language as the review wall (panel · 1px line · soft layered
   shadow · −3px hover lift), caption on a glass strip over the shot.
   Theme tokens only (light default, calm graphite dark).
   ============================================================ */
.hl-host { position: relative; z-index: 1; }
.hl-host.is-mounted { margin-bottom: clamp(48px, 6vw, 80px); }

.hl {
  --hl-w: min(600px, 42vw);       /* card width (both modes) */
  --hl-gap: 22px;
  --hl-fade: min(13vw, 190px);    /* edge fade of the loop */
  --hl-bleed: max(var(--gutter), (100vw - 100%) / 2);
}

.hl-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.hl-title {
  font: 700 clamp(22px, 2.4vw, 30px)/1.15 var(--sans); letter-spacing: -.022em; color: var(--text);
  text-wrap: balance;
}
.hl-nav { display: flex; align-items: center; gap: 8px; }
.hl-count {
  font: 600 12px/1 var(--sans); letter-spacing: .06em; color: var(--muted-2); margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.hl-count b { color: var(--text); font-weight: 700; }
.hl-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color .25s, color .25s, opacity .25s, transform .3s var(--ease);
}
.hl-btn:hover:not(:disabled) { border-color: rgb(var(--fg-rgb) / .22); transform: translateY(-1px); }
.hl-btn:active:not(:disabled) { transform: translateY(0) scale(.96); }
.hl-btn:disabled { opacity: .38; cursor: default; }
.hl-btn:focus-visible { outline: 2px solid var(--g2); outline-offset: 2px; }
.hl.is-static .hl-nav { display: none; }

/* ---- groups / items (shared) ---- */
.hl-group { display: flex; gap: var(--hl-gap); margin: 0; padding: 0; list-style: none; flex: none; }
.hl-item { flex: 0 0 var(--hl-w); list-style: none; }

/* ---- loop mode: full-bleed stage, edge fades, transform-driven track ---- */
.hl.is-loop .hl-stage {
  position: relative;
  margin-inline: calc(-1 * var(--hl-bleed));
  padding: 8px 0 26px;                      /* room for the hover lift + card shadows */
  overflow: hidden; overflow-x: clip; overflow-y: visible;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--hl-fade), #000 calc(100% - var(--hl-fade)), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 var(--hl-fade), #000 calc(100% - var(--hl-fade)), transparent 100%);
  touch-action: pan-y;                       /* vertical page scroll stays native; horizontal = scrub */
  cursor: grab;
}
.hl.is-loop .hl-track {
  position: relative; display: flex; width: max-content;
  will-change: transform; backface-visibility: hidden;
}
.hl.is-loop .hl-group { padding-right: var(--hl-gap); }   /* period = group width exactly */
/* centre-depth scale (desktop only, js adds .is-depth): items get their own layer only then */
.hl.is-loop.is-depth .hl-item { will-change: transform; transform-origin: 50% 55%; }
.hl.is-loop.is-dragging .hl-stage { cursor: grabbing; }
.hl.is-dragging .hl-card { pointer-events: none; }

/* ---- static mode: the scroll-snap row (reduced motion / paused) ---- */
.hl.is-snap .hl-track {
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: calc(-1 * var(--hl-bleed)); padding: 6px var(--hl-bleed) 22px;
  scroll-padding-inline: var(--gutter);   /* js copies the real padding in (a % here would be of the scrollport) */
  cursor: grab;
}
.hl.is-snap .hl-track::-webkit-scrollbar { display: none; }
.hl.is-snap .hl-item { scroll-snap-align: start; }
.hl.is-snap.is-dragging .hl-track { scroll-snap-type: none; cursor: grabbing; }

/* ---- the card ---- */
.hl-card {
  display: block; width: 100%; padding: 0; text-align: left; cursor: pointer;
  border: 0; background: none; color: inherit; font: inherit;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.hl-card:focus-visible { outline: none; }
.hl-card:focus-visible .hl-win { outline: 2px solid var(--g2); outline-offset: 3px; }
.hl-win {
  display: block; overflow: hidden; border-radius: 18px; border: 1px solid var(--line);
  background: var(--panel); box-shadow: var(--sx-shadow, var(--shadow-card));
  transition: transform .5s var(--ease), border-color .3s, box-shadow .5s var(--ease);
}
.hl-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--line-soft);
}
.hl-bar i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; flex: none; }
.hl-bar i:nth-child(2) { background: #febc2e; }
.hl-bar i:nth-child(3) { background: #28c840; }
.hl-tag {
  margin-left: auto; padding: 5px 9px; border-radius: 99px; white-space: nowrap;
  font: 700 10px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--sx-accent-soft, rgb(255 27 141 / .07));
  border: 1px solid var(--sx-accent-line, rgb(200 19 111 / .22));
}
.hl-shot { position: relative; display: block; aspect-ratio: 1430 / 930; overflow: hidden; background: var(--panel-2); }
.hl-shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: var(--hl-focus, top center); display: block;
  -webkit-user-drag: none; transition: scale .8s var(--ease);
  /* data.js focus / zoom: the card shows the key message a little larger (the gallery shows it all) */
  transform-origin: var(--hl-focus, 50% 0); scale: var(--hl-zoom, 1);
}
/* dark theme: the (white) screenshots sit a touch softer on graphite, full brightness on hover */
[data-theme="dark"] .hl-shot img { filter: brightness(.9); transition: scale .8s var(--ease), filter .4s; }
[data-theme="dark"] .hl-card:is(:hover, :focus-visible) .hl-shot img { filter: none; }
.hl-shot.is-missing::before {
  content: ""; position: absolute; inset: 18%; border-radius: 12px;
  background: repeating-linear-gradient(-45deg, var(--line-soft) 0 10px, transparent 10px 20px);
}
.hl-zoom {
  position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgb(10 10 12 / .55);
  border: 1px solid rgb(255 255 255 / .2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; translate: 0 -6px; transition: opacity .3s, translate .4s var(--ease);
}

/* caption: a glass strip floating over the bottom of the screenshot */
.hl-cap {
  position: absolute; left: 12px; right: 12px; bottom: 12px; display: block;
  padding: 11px 14px 12px; border-radius: 12px;
  background: rgb(255 255 255 / .8); color: var(--text);
  border: 1px solid rgb(21 17 20 / .08);
  box-shadow: 0 1px 2px rgb(21 17 20 / .06), 0 10px 24px -14px rgb(21 17 20 / .35);
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
  transition: background .3s, translate .5s var(--ease);
}
.hl-cap > span {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font: 500 13.5px/1.45 var(--sans); letter-spacing: -.003em; text-wrap: pretty;
}
[data-theme="dark"] .hl-cap {
  background: rgb(22 24 28 / .78); border-color: rgb(255 255 255 / .08);
  box-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 28px -14px rgb(0 0 0 / .7);
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .hl-cap { background: rgb(255 255 255 / .94); }
  [data-theme="dark"] .hl-cap { background: rgb(22 24 28 / .94); }
}

@media (hover: hover) {
  .hl-card:hover .hl-win { transform: translateY(-3px); border-color: var(--sx-hover-line, rgb(var(--fg-rgb) / .16)); box-shadow: var(--sx-shadow-hi, var(--shadow-lg)); }
  .hl-card:hover .hl-shot img { scale: calc(var(--hl-zoom, 1) * 1.025); }
  .hl-card:hover .hl-zoom { opacity: 1; translate: 0 0; }
  .hl-card:hover .hl-cap { background: rgb(255 255 255 / .9); }
  [data-theme="dark"] .hl-card:hover .hl-cap { background: rgb(22 24 28 / .88); }
}
.hl-card:focus-visible .hl-zoom { opacity: 1; translate: 0 0; }

.hl-note {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 2px;
  font: 500 12.5px/1.3 var(--sans); color: var(--muted-2);
}
.hl-note svg { flex: none; color: var(--muted); }

/* entrance: cards slide in, staggered (js adds .is-pre → .is-in). Animated on the
   card, never on the item itself — the loop scales the item, the snap row snaps it */
.hl.is-pre .hl-card { opacity: 0; translate: 36px 0; }
.hl.is-in .hl-card {
  opacity: 1; translate: 0 0;
  transition: opacity .8s var(--ease), translate 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
html.motion-paused .hl .hl-card { opacity: 1; translate: 0 0; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .hl .hl-card { opacity: 1 !important; translate: none !important; transition: none !important; }
  .hl-win, .hl-shot img, .hl-zoom, .hl-cap { transition: none; }
}

@media (max-width: 1023px) {
  .hl { --hl-w: min(520px, 62vw); --hl-gap: 18px; --hl-fade: 9vw; }
}
@media (max-width: 640px) {
  .hl { --hl-w: 84vw; --hl-gap: 12px; --hl-fade: 18px; }
  .hl.is-loop .hl-stage { padding-bottom: 20px; }
  .hl.is-snap .hl-track { padding-bottom: 18px; }
  .hl-head { margin-bottom: 12px; }
  .hl-count { display: none; }
  .hl-btn { width: 40px; height: 40px; }
  .hl-win { border-radius: 16px; }
  /* a touch taller shot on phones so the glass caption leaves the message readable */
  .hl-shot { aspect-ratio: 1430 / 1080; }
  .hl-cap { left: 8px; right: 8px; bottom: 8px; padding: 9px 11px 10px; border-radius: 10px; }
  .hl-cap > span { font-size: 12.5px; line-height: 1.42; -webkit-line-clamp: 3; }
  /* phones: the strip rides along with its own shot, so the blur never changes —
     skip the per-frame backdrop blur on the moving track, near-opaque glass instead */
  .hl.is-loop .hl-cap { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(255 255 255 / .93); }
  [data-theme="dark"] .hl.is-loop .hl-cap { background: rgb(22 24 28 / .92); }
}
@media (pointer: coarse) { .hl-btn { width: 44px; height: 44px; } .hl-stage, .hl-track { cursor: auto !important; } }
@media (forced-colors: active) {
  .hl-win { border: 1px solid CanvasText; }
  .hl-cap { background: Canvas; border: 1px solid CanvasText; }
  .hl.is-loop .hl-stage { -webkit-mask-image: none; mask-image: none; }
}
