/* ==========================================================================
   7 · Galeri — equal-height cards (width = height × image ratio), lightbox on click,
   optional category pills. Desktop + motion: the whole block is pinned and the strip
   moves horizontally (gallery.js, .is-pinned). Otherwise: native horizontal scroll-snap.
   Height is capped at the image's own pixels (--h), so nothing is upscaled (brief §6).
   ========================================================================== */
.s-gallery { --gh: clamp(320px, 62vh, 640px); }
.s-gallery__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 3rem; margin-bottom: clamp(32px, 6vh, 72px); }
.s-gallery__titles { display: grid; gap: 1.25rem; max-width: 62ch; }
.s-gallery__intro[hidden] { display: none; }
.s-gallery__filters { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.s-gallery__pill {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 42px; padding: 0 1rem; border-radius: 999px;
  border: var(--hairline) solid var(--fg-faint); color: var(--fg-soft); font-size: 0.875rem;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.s-gallery__pill span { font-size: 0.75rem; opacity: 0.7; font-variant-numeric: tabular-nums; }
.s-gallery__pill[aria-pressed='false']:hover { border-color: var(--fg); color: var(--fg); }
.s-gallery__pill[aria-pressed='true'] { background: var(--fg); border-color: var(--fg); color: var(--page-bg); }

.s-gallery__viewport { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--fg-faint) transparent; padding-bottom: 1rem; }
.s-gallery__track { display: flex; align-items: flex-start; gap: clamp(16px, 2.4vw, 40px); padding-inline: var(--pad); width: max-content; }
.s-gallery__card { flex: none; scroll-snap-align: center; }
.s-gallery__card[hidden] { display: none; }
.s-gallery__frame {
  --fh: min(var(--gh), var(--h, 9999px));
  position: relative; display: block; overflow: hidden; border-radius: var(--radius);
  height: var(--fh); width: calc(var(--fh) * var(--ar));
}
.s-gallery__frame .media { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none !important; }
.s-gallery__frame img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-img, 1.2s) var(--ease-expo); }
.s-gallery__frame:hover img, .s-gallery__frame:focus-visible img, .s-gallery__card.is-active .s-gallery__frame img { transform: scale(1.04); }
.s-gallery__frame::after {
  content: ''; position: absolute; right: 14px; bottom: 14px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(18, 26, 20, 0.7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F7F3EC' stroke-width='1.5'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E") center / 18px no-repeat;
  opacity: 0; transform: translateY(6px); transition: opacity 0.35s ease, transform 0.5s var(--ease-expo);
}
.s-gallery__frame:hover::after, .s-gallery__frame:focus-visible::after { opacity: 1; transform: none; }
.s-gallery__card figcaption { margin-top: 0.75rem; color: var(--fg-muted); }

/* Pinned horizontal strip (desktop + motion). */
.s-gallery.is-pinned { padding-block: 0; }
.s-gallery.is-pinned .s-gallery__pin { height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-block: 6.5rem 2rem; overflow: hidden; }
/* Head on one row (titles left, pills right) so the strip gets the height. */
.s-gallery.is-pinned .s-gallery__head { flex-wrap: nowrap; margin-bottom: clamp(20px, 3.5vh, 40px); }
.s-gallery.is-pinned .s-gallery__titles { max-width: 52ch; gap: 0.9rem; }
.s-gallery.is-pinned .s-gallery__intro { font-size: 0.95rem; }
.s-gallery.is-pinned .s-gallery__filters { justify-content: flex-end; max-width: 560px; }
.s-gallery.is-pinned .s-gallery__viewport { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; }
.s-gallery.is-pinned { --gh: clamp(260px, calc(100svh - 21rem), 600px); }
.s-gallery.is-pinned .s-gallery__viewport { overflow: visible; scroll-snap-type: none; padding-bottom: 0; }
.s-gallery.is-pinned .s-gallery__track { will-change: transform; }

@media (max-width: 767.98px) {
  /* Same height on phones too; very wide images are cropped to the screen width. */
  .s-gallery { --gh: clamp(240px, 46vh, 380px); }
  .s-gallery__frame { width: min(calc(var(--fh) * var(--ar)), 86vw); }
  .s-gallery__frame::after { opacity: 1; transform: none; }
  .s-gallery__filters { overflow-x: auto; flex-wrap: nowrap; margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad); scrollbar-width: none; }
  .s-gallery__pill { flex: none; }
}

/* Catalog interior chapters (living spaces / kitchen / bathroom) after the strip — verbatim texts. */
.s-gallery__notes {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 64px);
  padding-top: clamp(48px, 9vh, 112px);
}
.s-gallery__notes[hidden] { display: none; }
.s-gallery__note { display: grid; align-content: start; gap: 1.1rem; padding-top: 1.4rem; border-top: var(--hairline) solid var(--fg-faint); }
.s-gallery__note-title { font-family: var(--font-display); font-weight: var(--w-light); font-size: clamp(1.9rem, 3vw, 2.8rem); line-height: 1.04; letter-spacing: -0.02em; }
.s-gallery__note-title span { display: block; }
.s-gallery.is-pinned .s-gallery__notes { padding-bottom: clamp(72px, 12vh, 140px); }
@media (max-width: 959.98px) {
  .s-gallery__notes { grid-template-columns: 1fr; gap: 2.5rem; }
}
