/* Swipeable gallery for wozy.co, driven by /assets/gallery.js.

   <div class="gal" data-gal aria-label="What it shows">
     <ul class="gal-track">
       <li class="gal-item" data-label="Name for its dot">...</li>
     </ul>
   </div>

   Cards are wide, the first lines up with the page's content and the next one
   peeks in from the right, so it's clear there's more. Without JavaScript it's
   still a row you can swipe or scroll; the script adds the dots and arrows.
   Tune per gallery with --gal-w (card width) and --gal-max (content width). */

.gal {
  --gal-max: 1120px;
  --gal-pad: max(24px, calc((100% - var(--gal-max)) / 2));
  position: relative;
  width: 100%;
}
.gal-track {
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 8px var(--gal-pad) 28px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gal-pad);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-track:focus-visible { outline: 3px solid #F39A1E; outline-offset: -3px; border-radius: 12px; }
.gal-item { flex: 0 0 var(--gal-w, min(880px, 86%)); scroll-snap-align: start; display: flex; }
.gal-item > * { flex: 1; min-width: 0; }
.gal-item.peek { cursor: pointer; }

.gal-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 var(--gal-pad); }
.gal-dots { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.gal-dots button {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 99px;
  font: inherit; font-size: 14px; font-weight: 800; line-height: 1;
  color: var(--gal-ink, #2B1F4D);
  background: var(--gal-chip, rgba(43,31,77,0.07));
  transition: background .3s, color .3s;
}
.gal-dots button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, currentColor); }
.gal-dots button:hover { background: var(--gal-chip-hover, rgba(43,31,77,0.13)); }
.gal-dots button[aria-current="true"] { background: var(--gal-ink, #2B1F4D); color: var(--gal-on-ink, #FBF5E6); }
.gal-arrows { display: flex; gap: 10px; flex: none; }
.gal-arrows button {
  all: unset; box-sizing: border-box; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  color: var(--gal-ink, #2B1F4D); background: var(--gal-chip, rgba(43,31,77,0.07));
  transition: background .3s, opacity .3s;
}
.gal-arrows button:hover { background: var(--gal-chip-hover, rgba(43,31,77,0.13)); }
.gal-arrows button:disabled { opacity: .35; cursor: default; }
.gal-arrows svg { width: 18px; height: 18px; }
.gal-arrows .gal-play svg { width: 16px; height: 16px; }

/* autoplay: the current dot fills up until the gallery moves on */
.gal-dots button { position: relative; overflow: hidden; isolation: isolate; }
.gal-dots button.run::after { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(255,255,255,0.24); transform-origin: left; animation: gal-fill var(--gal-dur, 6s) linear forwards; }
@keyframes gal-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.gal-dots button:focus-visible, .gal-arrows button:focus-visible { outline: 3px solid #F39A1E; outline-offset: 2px; }
@media (max-width: 560px) {
  .gal-track { gap: 12px; }
  .gal-dots button { padding: 8px 11px; font-size: 13px; }
  .gal-arrows button:not(.gal-play) { display: none; }
  .gal-arrows button { width: 38px; height: 38px; }
}

/* A grid that turns into a swipeable row on phones, with no script at all. */
@media (max-width: 700px) {
  .swipe-sm {
    display: flex !important; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
    width: calc(100% + 48px) !important; max-width: none !important; margin-left: -24px !important; margin-right: -24px !important;
    padding: 4px 24px 18px !important; scroll-padding-inline: 24px; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .swipe-sm::-webkit-scrollbar { display: none; }
  .swipe-sm > * { flex: 0 0 82%; scroll-snap-align: start; }
}
