/* Home intro slider (2026-11, option B "peek"). Loaded by the home pages only when there are slides
   (assets/inc/hero-slider.php). Tablet and desktop: slides as wide as the page content, lined up with the nav;
   the next one peeks into the margin right of the nav (at least 72px, so on narrower screens the slide gets a
   little narrower). Phones: no slider, a row of "Spotlight" cards under the intro. Moves only when asked to
   (one small hint after 3.5 s); prefers-reduced-motion gets a short crossfade instead. */

.hs {
  --hs-gap: 56px;                                                   /* 40px to the nav's edge + 16px */
  --hs-cl: max(40px, calc((100vw - 1100px) / 2 + 40px));             /* where the page content starts */
  --hs-ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  /* As wide as the screen (so the peek can use the margin) and clipped there, so the page never scrolls sideways.
     The padding brings the content back to the page width; .hs-in holds the track and the controls at that width. */
  margin-inline: calc(50% - 50vw); padding-inline: calc(50vw - 50%); overflow-x: clip;
}
.hs-in { position: relative; }
main.home:has(.hs) { overflow-x: visible; }   /* the peek sits outside main; body still clips sideways (style.css) */

/* ---------- Phones: the intro alone, then the cards ---------- */
.hs-slide:not(.hs-intro), .hs-ctrl { display: none; }
.hs-cards { margin: 4px 0 40px; }
.hs-cards .home-kicker { margin: 0 0 12px; }
.hs-cards ul {
  list-style: none; margin: 0 -20px 0 0; padding: 4px 20px 14px 0; display: flex; align-items: flex-start; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.hs-cards ul::-webkit-scrollbar { display: none; }
.hs-cards li { flex: none; width: min(72%, 260px); scroll-snap-align: start; }
.hs-cards li:only-child { width: 100%; }   /* a single card takes the full column */
.hs-card {
  display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 14px; border-radius: 22px; color: var(--ink); text-decoration: none;
  background: linear-gradient(160deg, var(--glass-top), var(--glass-bottom));
  -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.hs-card-img { display: block; overflow: hidden; border-radius: 15px; margin-bottom: 4px; background: var(--accent-soft); }
.hs-card-img img { display: block; width: 100%; height: auto; }   /* shown whole, never cropped */
.hs-card-kicker { padding: 0 6px; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.hs-card-title { padding: 0 6px; font-size: 1rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.hs-card .hs-draft { align-self: flex-start; margin: 2px 6px 0; }
.hs-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.hs-draft {
  display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 8px; border-radius: 6px;
  background: #ffd84d; color: #3d2f00; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}

/* ---------- Tablet and desktop: the slider ---------- */
@media (min-width: 768px) {
  .hs-cards { display: none; }
  .hs-track { display: flex; align-items: stretch; gap: var(--hs-gap); transition: transform 0.8s var(--hs-ease); }
  .hs-slide {
    flex: none; box-sizing: border-box; position: relative;
    width: min(100%, calc(100vw - var(--hs-cl) - var(--hs-gap) - 72px));
    transform-origin: left center;
    transition: opacity 0.6s var(--hs-ease), transform 0.8s var(--hs-ease), translate 0.4s var(--hs-ease), visibility 0s linear 0s;
  }
  .hs-slide:not(.hs-intro) {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-content: center; align-items: center;
    min-height: min(calc(100svh - 108px), 1000px); padding: 40px 0 112px;
  }
  .hs .home-intro { padding-bottom: 112px; }   /* room for the controls under the buttons */
  .hs-slide.no-img { grid-template-columns: minmax(0, 1fr); }

  .hs.is-init .hs-track, .hs.is-init .hs-slide, .hs.is-init .hs-slide * { transition: none !important; }

  /* Before the script runs (or without it): the intro alone */
  .hs:not(.is-ready) .hs-slide:not(.hs-intro) { visibility: hidden; }
  .hs.is-ready .hs-ctrl { display: flex; }

  /* States, set by hero-slider.js */
  .hs-slide.is-prev { opacity: 0; transform: scale(0.94) translateX(-30px); visibility: hidden; transition-property: opacity, transform, translate, visibility; transition-delay: 0s, 0s, 0s, 0.6s; }
  .hs-slide.is-later { opacity: 0; transform: scale(0.86); visibility: hidden; }
  .hs-slide.is-next { opacity: 0.9; transform: scale(0.86) rotate(-2deg); cursor: pointer; }
  .hs-slide.is-next:hover { opacity: 1; translate: -18px 0; }
  .hs-slide.is-next .hs-txt { opacity: 0; transition: opacity 0.25s; }
  .hs-intro.is-prev .hero-art { transform: translateX(-40px) rotate(-3deg); }
  .hs-intro .hero-art { transition: transform 0.9s var(--hs-ease); }

  /* One small hint, once: the peek slides out a little and back (hero-slider.js adds .is-nudge after 3.5 s) */
  .hs-slide.is-next.is-nudge { animation: hs-nudge 1.3s var(--hs-ease) 1 both; }

  /* The round arrow on the peek */
  .hs-peek-go {
    position: absolute; z-index: 3; top: 50%; left: 14px; width: 52px; height: 52px; margin-top: -26px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink);
    background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 10px 24px -10px rgba(20, 33, 61, 0.55);   /* solid: it sits on a photo */
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
  }
  .hs-peek-go svg { width: 22px; height: 22px; }
  .hs-slide.is-next .hs-peek-go { opacity: 1; }

  /* Slide content: text rises in line by line once the slide has arrived; the frame settles into its tilt */
  .hs-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
  .hs-slide:not(.hs-intro) .hs-txt > * { opacity: 0; transform: translateY(16px); transition: opacity 0.45s ease, transform 0.6s var(--hs-ease); }
  .hs-slide.is-on .hs-txt > * { opacity: 1; transform: none; }
  .hs-slide.is-on .hs-txt > :nth-child(1) { transition-delay: 0.28s; }
  .hs-slide.is-on .hs-txt > :nth-child(2) { transition-delay: 0.34s; }
  .hs-slide.is-on .hs-txt > :nth-child(3) { transition-delay: 0.40s; }
  .hs-slide.is-on .hs-txt > :nth-child(4) { transition-delay: 0.46s; }
  .hs-slide.is-on .hs-txt > :nth-child(5) { transition-delay: 0.52s; }

  .hs-frame {
    min-width: 0; padding: 12px; border-radius: 40px; transform: rotate(-5deg) scale(0.97); transition: transform 0.9s var(--hs-ease);
    background: linear-gradient(160deg, var(--glass-top), var(--glass-bottom));
    -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  }
  .hs-slide.is-on .hs-frame { transform: rotate(-1.5deg); }
  .hs-slide.is-next .hs-frame { transform: none; }
  .hs-frame img { display: block; width: 100%; height: auto; border-radius: 30px; background: var(--accent-soft); }   /* shown whole */
  .hs-photo .hs-frame, .hs-free .hs-frame { max-width: 520px; }

  .hs-pill {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 22px; padding: 7px 16px; border-radius: 999px;
    font-size: 0.875rem; font-weight: 700; color: var(--ink);
    background: linear-gradient(160deg, var(--glass-top), var(--glass-bottom));
    -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  }
  .hs-title { margin: 0 0 18px; font-size: clamp(2.5rem, 5.2vw, 4.5rem); font-weight: 800; letter-spacing: -0.045em; line-height: 0.98; text-wrap: balance; overflow-wrap: anywhere; }
  .hs-meta { margin: 0 0 14px; color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
  .hs-text { margin: 0 0 22px; max-width: 46ch; color: var(--muted); font-size: 1.0625rem; line-height: 1.65; }
  .hs-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
  .hs-ctas .btn-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 28px; font-size: 1rem; font-weight: 700; }
  .hs-ctas .btn-pill svg { width: 16px; height: 16px; flex: none; }

  /* Controls, under the slide, lined up with the content */
  .hs-ctrl { position: absolute; z-index: 4; left: 0; bottom: 28px; align-items: center; gap: 12px; }
  .hs-arrow {
    display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
    color: var(--ink); cursor: pointer;
    background: linear-gradient(180deg, var(--lens-top), var(--lens-bottom)); box-shadow: inset 0 1px 0 var(--glass-edge), var(--lens-shadow);
  }
  .hs-arrow svg { width: 18px; height: 18px; }
  .hs-prev svg { transform: scaleX(-1); }
  .hs-arrow:disabled { opacity: 0.4; cursor: default; }
  .hs-dots { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
  .hs-dot { display: flex; align-items: center; justify-content: center; width: 30px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
  .hs-dot i { display: block; width: 8px; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 25%, transparent); transition: width 0.4s var(--hs-ease), background-color 0.3s; }
  .hs-dot.is-on i { width: 26px; background: linear-gradient(90deg, #3e6fb0, #7f6ad6); }
  .hs-count { margin-left: 4px; color: var(--muted); font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
  .hs-arrow:focus-visible, .hs-dot:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 999px; }
}
@media (min-width: 768px) and (prefers-color-scheme: dark) {
  .hs-dot.is-on i { background: linear-gradient(90deg, #7ba3d0, #cbc2f0); }
}

@media (min-width: 900px) {
  .hs-slide:not(.hs-intro) { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 56px; padding-top: 56px; }
  .hs-photo:not(.no-img), .hs-free:not(.no-img) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .hs-slide.no-img { grid-template-columns: minmax(0, 1fr); }
}

@keyframes hs-nudge { 0%, 100% { translate: 0 0; } 35% { translate: -34px 0; } 60% { translate: -26px 0; } }

/* Less motion: no sliding, no tilt, a short crossfade */
@media (prefers-reduced-motion: reduce) {
  .hs-track { transition: none !important; }
  .hs-slide, .hs-slide.is-next, .hs-slide.is-next:hover, .hs-slide.is-prev, .hs-slide.is-later { transform: none !important; translate: none !important; animation: none !important; transition: opacity 0.3s ease, visibility 0s linear 0s !important; }
  .hs-slide .hs-txt > *, .hs-frame, .hs-intro .hero-art { transition: none !important; transform: none !important; }
}
