/* gallery.css — /showcase/ "shelves": one horizontal row of clips per product.
 * Shared DK + EN (keep byte-identical). Loaded via $page_styles after chrome.css.
 * Markup: showcase/index.php · behaviour: assets/js/gallery.js
 * Type: display (Bebas, h1/h2) · body 1rem. Colours derive
 * from the chrome.css tokens only. */

.sg-gallery, .gal-viewer {
  /* Plain fallbacks first; color-mix() versions (derived from the tokens) win where supported. */
  --gal-muted: rgba(240, 238, 255, 0.66);
  --gal-line:  rgba(240, 238, 255, 0.14);
  --gal-ease:  cubic-bezier(0.22, 1, 0.36, 1);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .sg-gallery, .gal-viewer {
    --gal-muted: color-mix(in srgb, var(--white) 66%, transparent);
    --gal-line:  color-mix(in srgb, var(--white) 14%, transparent);
  }
}
.sg-gallery {
  --gal-gutter: 3rem;
  --gal-card: 200px;
  padding: 8.5rem 0 6rem;
}
.sg-gallery ::selection, .gal-viewer ::selection { background: var(--purple); color: var(--white); }

/* ── Intro ── */
.gal-intro { padding: 0 var(--gal-gutter); }
.gal-intro h1 {
  font-family: var(--font-h);
  font-size: clamp(4rem, 8vw, 5.5rem);
  font-weight: 400; line-height: 0.9; letter-spacing: 0.01em;
  margin: 0;
}

/* ── Shelf ── */
.gal-shelf {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head actions" "row row";
  align-items: end;
  row-gap: 1.5rem;
  padding-top: 3.5rem;
}
/* The page title belongs to the first shelf: keep it close, and give the
   real break to the space between products. */
.gal-intro + .gal-shelf { padding-top: 2rem; }
.gal-head { grid-area: head; padding-left: var(--gal-gutter); min-width: 0; }
.gal-head h2 {
  font-family: var(--font-h);
  font-size: clamp(2.25rem, 3.5vw, 3rem);   /* ≥1.6× below the H1: the page title leads */
  font-weight: 400; line-height: 0.95; letter-spacing: 0.01em;
  margin: 0 0 0.5rem;
}
.gal-head p { margin: 0; color: var(--gal-muted); font-size: 1rem; line-height: 1.5; }
/* Sub-heading for a product's model rows (e.g. SB 3 + SB 4 / SB MIX): smaller
   than the shelf's h2, white like it (the accent is for UI, not headline text). */
.gal-head h3 {
  font-family: var(--font-h);
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  font-weight: 400; line-height: 1; letter-spacing: 0.04em;
  color: var(--white);
  margin: 0;
}
.gal-head p + h3 { margin-top: 1.5rem; }
/* Continuation row of the same product: no big gap above it. */
.gal-shelf.gal-shelf--sub { padding-top: 2rem; }

.gal-actions { grid-area: actions; display: flex; align-items: center; gap: 0.75rem; padding-right: var(--gal-gutter); }
.gal-shop {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0 1.4rem; border-radius: 999px;
  background: var(--white); color: var(--bg);
  font-family: var(--font-b); font-size: 1rem; font-weight: 600; white-space: nowrap;
  transition: background-color 0.2s var(--gal-ease);
}
.gal-shop:hover { background: var(--white); background: color-mix(in srgb, var(--white) 82%, var(--gal-accent, var(--purple))); }
.gal-arrow {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--white);
  border: 1px solid var(--gal-line); cursor: pointer; padding: 0;
  transition: border-color 0.2s var(--gal-ease), opacity 0.2s var(--gal-ease);
}
.gal-arrow:hover { border-color: var(--white); border-color: color-mix(in srgb, var(--white) 40%, transparent); }
.gal-arrow:disabled { opacity: 0.3; cursor: default; }
.gal-shelf.is-static .gal-arrow { display: none; }  /* every card fits: no dead arrows */
.gal-arrow svg, .gal-shop svg { width: 18px; height: 18px; }

/* Row: native horizontal scroll with snap; arrows are a desktop convenience. */
.gal-row {
  grid-area: row;
  display: flex; gap: 1rem;
  list-style: none; margin: 0;
  padding: 0 var(--gal-gutter) 0.5rem;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gal-gutter);
  scrollbar-width: none;
}
.gal-row::-webkit-scrollbar { display: none; }
.gal-row > li { flex: 0 0 var(--gal-card); scroll-snap-align: start; }

/* ── Card: one grammar for clips and how-to videos (media only; the title lives in aria-label) ── */
.gal-card {
  display: flex; flex-direction: column; gap: 0.6rem;
  width: 100%; padding: 0; margin: 0;
  background: none; border: 0; color: inherit; text-align: left;
  font: inherit; cursor: pointer;
}
.gal-media {
  position: relative; display: block;
  aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden;
  background: var(--bg2);
}
.gal-media img, .gal-media video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: opacity 0.4s var(--gal-ease), transform 0.5s var(--gal-ease);
}
.gal-media video { opacity: 0; }
.gal-media video.is-playing { opacity: 1; }
@media (hover: hover) {
  .gal-card:hover .gal-media img, .gal-card:hover .gal-media video { transform: scale(1.03); }
}
.gal-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--white);
}
.gal-play svg { width: 20px; height: 20px; margin-left: 2px; }

.sg-gallery :focus-visible { outline: 2px solid var(--gal-accent, var(--purple)); outline-offset: 3px; border-radius: 16px; }
.sg-gallery .gal-shop:focus-visible, .sg-gallery .gal-arrow:focus-visible { border-radius: 999px; }

/* ── Viewer (full-screen clip) ── */
.gal-viewer {
  position: fixed; inset: 0; z-index: 9990;
  display: none; align-items: center; justify-content: center;
  padding: 4.5rem 1rem 1.5rem;
  background: var(--bg); background: color-mix(in srgb, var(--bg) 96%, transparent);
}
.gal-viewer.is-open { display: flex; }
.gal-stage {
  position: relative;
  height: min(78vh, 900px); aspect-ratio: 9 / 16; max-width: 100%;
  border-radius: 16px; overflow: hidden; background: var(--bg);
}
.gal-stage video, .gal-stage iframe, .gal-stage img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: var(--bg); }
.gal-vbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem;
}
.gal-vlabel { display: flex; align-items: center; gap: 0.6rem; font-size: 1rem; font-weight: 600; min-width: 0; }
.gal-vlabel span:last-child { color: var(--gal-muted); font-variant-numeric: tabular-nums; }
.gal-vtools { display: flex; gap: 0.5rem; }
.gal-vbtn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--white);
  border: 1px solid var(--gal-line); cursor: pointer; padding: 0; flex-shrink: 0;
}
.gal-vbtn:hover { background: var(--bg2); background: color-mix(in srgb, var(--white) 16%, var(--bg)); }
.gal-vbtn svg { width: 20px; height: 20px; }
.gal-vpause svg + svg, .gal-vpause.is-paused svg:first-child { display: none; }
.gal-vpause.is-paused svg + svg { display: block; }
.gal-vnav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.gal-vprev { left: 1rem; }
.gal-vnext { right: 1rem; }
.gal-vbtn[hidden] { display: none; }
.gal-vshop { position: absolute; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 2; }
.gal-viewer :focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }

/* ── Desktop: everything centred ── */
@media (min-width: 769px) {
  .gal-intro { margin: 0 auto; text-align: center; }
  .gal-shelf {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "row" "actions";
    justify-items: center; text-align: center;
    row-gap: 1.25rem; padding-top: 7rem;
  }
  .gal-intro + .gal-shelf { padding-top: 2.5rem; }
  .gal-head { padding: 0 var(--gal-gutter); }
  .gal-actions { padding: 0 var(--gal-gutter); }
  .gal-shelf.gal-shelf--sub { padding-top: 3rem; }
  .gal-row { justify-self: stretch; justify-content: safe center; margin: 0.75rem 0 0.5rem; }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .sg-gallery { --gal-gutter: 1rem; --gal-card: 160px; padding: 6.5rem 0 4rem; }
  .gal-shelf {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "row" "actions";
    row-gap: 1rem; padding-top: 4.5rem;
  }
  .gal-intro + .gal-shelf { padding-top: 1.5rem; }
  .gal-head h2 { font-size: 2.25rem; }
  .gal-shelf.gal-shelf--sub { padding-top: 2.5rem; }
  .gal-row { gap: 0.625rem; }
  .gal-actions { padding: 0.25rem var(--gal-gutter) 0; }
  .gal-shop { flex: 1; min-height: 52px; }
  .gal-arrow { display: none; }
  .gal-viewer { padding: 0; }
  .gal-stage { height: 100%; width: 100%; aspect-ratio: auto; border-radius: 0; }
  .gal-vnav { display: none; }
  .gal-vshop { left: 1rem; right: 1rem; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gal-media img, .gal-media video { transition: none; }
  .gal-card:hover .gal-media img, .gal-card:hover .gal-media video { transform: none; }
}
