/**
 * Vorino Gallery — scoped styles.
 * Desktop geometry guided by APPROVED Master A (1536×1024 MEASURED canvas).
 * Exact px beyond documented tokens: PROVISIONAL where not instrument-measured.
 */

.vorino-gallery {
  --vorino-gallery-cols: 5;
  --vorino-gallery-gap: 8px;
  color: var(--vorino-ink, #30251c);
}

.vorino-gallery__hero {
  position: relative;
  min-height: clamp(220px, 38vw, 420px); /* PROVISIONAL hero height */
  overflow: hidden;
  background: #1a120c;
}

/* Paper strip must paint over the hero photo edge (homepage-style). */
.vorino-gallery--has-paper .vorino-gallery__hero {
  overflow: visible;
  z-index: 2;
}

.vorino-gallery__hero-img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  object-position: center;
  display: block;
}

.vorino-gallery__hero-ph {
  min-height: inherit;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  color: #f3ecdf;
  background:
    linear-gradient(120deg, #2a1a10 0%, #4a3220 45%, #1c2911 100%);
  font-size: 0.95rem;
}

.vorino-gallery__hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 3.25rem;
  background: linear-gradient(90deg, rgba(20, 12, 6, 0.72) 0%, rgba(20, 12, 6, 0.25) 55%, transparent 85%);
  color: #fff;
}

.vorino-gallery__crumbs {
  font-size: 0.8rem; /* PROVISIONAL */
  margin-bottom: 0.75rem;
  opacity: 0.9;
}
.vorino-gallery__crumbs a {
  color: inherit;
}

.vorino-gallery__hero-titles {
  max-width: 36rem;
}

.vorino-gallery__flourish {
  display: inline-block;
  width: 2.5rem;
  height: 1.25rem;
  margin-bottom: 0.35rem;
  background:
    radial-gradient(circle at 20% 50%, #c4a574 0 35%, transparent 36%),
    radial-gradient(circle at 55% 40%, #b9c09a 0 28%, transparent 29%),
    radial-gradient(circle at 80% 60%, #c4a574 0 22%, transparent 23%);
  opacity: 0.95;
}

.vorino-gallery__title {
  margin: 0;
  font-family: var(--vorino-font-serif, Georgia, serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem); /* PROVISIONAL vs master script size */
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.vorino-gallery__subtitle {
  margin: 0.65rem 0 0;
  font-size: clamp(0.95rem, 1.6vw, 1.1rem); /* PROVISIONAL */
  max-width: 34ch;
  line-height: 1.45;
  opacity: 0.95;
}

/*
 * Homepage-style parchment divider (assets/img/home/vorino-paper-divider-bottom.png).
 * Anchored to hero bottom; overlaps photo above and tucks into cream body below.
 */
.vorino-gallery__paper-divider {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-2px + var(--vg-paper-y, 0px));
  width: 100%;
  max-width: none;
  height: var(--vg-paper-h, auto);
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  z-index: 4;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  object-fit: fill;
  object-position: center bottom;
  line-height: 0;
}

.vorino-gallery__body {
  position: relative;
  z-index: 3;
  background: var(--vorino-parchment-100, #f8edd8);
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 3rem;
  overflow: hidden;
  /* Tuck under paper so no cream seam shows above the strip. */
  margin-top: -2.75rem;
  padding-top: calc(1.25rem + 2.75rem);
}

@media (max-width: 1024px) {
  .vorino-gallery__paper-divider {
    bottom: calc(-2px + var(--vg-paper-y-tablet, var(--vg-paper-y, 0px)));
    height: var(--vg-paper-h-tablet, var(--vg-paper-h, auto));
  }
}

@media (max-width: 768px) {
  .vorino-gallery__paper-divider {
    bottom: calc(-2px + var(--vg-paper-y-mobile, var(--vg-paper-y-tablet, var(--vg-paper-y, 0px))));
    height: var(--vg-paper-h-mobile, var(--vg-paper-h-tablet, var(--vg-paper-h, auto)));
  }

  .vorino-gallery__body {
    margin-top: -2rem;
    padding-top: calc(1.25rem + 2rem);
  }
}

/* Decorative olive flourishes — CSS approximation (PNG sources MISSING) */
.vorino-gallery__olive {
  position: absolute;
  width: 88px;
  height: 88px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.55;
  background:
    radial-gradient(ellipse 18px 10px at 30% 40%, var(--vorino-olive-700, #52633b) 0 55%, transparent 56%),
    radial-gradient(ellipse 16px 9px at 55% 55%, var(--vorino-olive-800, #314624) 0 55%, transparent 56%),
    radial-gradient(ellipse 14px 8px at 70% 35%, var(--vorino-olive-700, #52633b) 0 55%, transparent 56%),
    linear-gradient(135deg, transparent 46%, var(--vorino-olive-800, #314624) 46% 54%, transparent 54%);
}
.vorino-gallery__olive--tl { top: 0.35rem; left: 0.25rem; transform: rotate(-18deg); }
.vorino-gallery__olive--tr { top: 0.35rem; right: 0.25rem; transform: scaleX(-1) rotate(-18deg); }
.vorino-gallery__olive--bl { bottom: 0.5rem; left: 0.25rem; transform: scaleY(-1) rotate(-12deg); }
.vorino-gallery__olive--br { bottom: 0.5rem; right: 0.25rem; transform: scale(-1) rotate(-12deg); }

.vorino-gallery__filters {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin: 0 auto 1.5rem;
  max-width: var(--vorino-shell-width, 1180px);
}

.vorino-gallery__filter {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--vorino-paper-edge, #dfc9a4);
  background: var(--vorino-parchment-50, #fff8eb);
  color: var(--vorino-ink, #30251c);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.85rem; /* PROVISIONAL */
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vorino-gallery__filter-icon {
  display: inline-flex;
  line-height: 0;
  flex-shrink: 0;
}
.vorino-gallery__filter-icon svg {
  display: block;
}
.vorino-gallery__filter.is-active,
.vorino-gallery__filter[aria-pressed="true"] {
  background: var(--vorino-olive-950, #182713);
  border-color: var(--vorino-olive-950, #182713);
  color: #fff;
}
.vorino-gallery__filter:hover:not(.is-active) {
  border-color: var(--vorino-olive-700, #52633b);
  background: var(--vorino-parchment-100, #f8edd8);
}
.vorino-gallery__filter:focus-visible {
  outline: 2px solid var(--vorino-focus, #c4a574);
  outline-offset: 2px;
}

.vorino-gallery__grid {
  position: relative;
  z-index: 2;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: var(--vorino-shell-width, 1180px);
  display: grid;
  grid-template-columns: repeat(var(--vorino-gallery-cols), minmax(0, 1fr));
  gap: var(--vorino-gallery-gap);
}

.vorino-gallery__item {
  margin: 0;
  border-radius: 6px; /* PROVISIONAL ≈ PRD radius-sm */
  overflow: hidden;
  background: var(--vorino-parchment-200, #efdfc1);
  border: 1px solid rgba(255, 255, 255, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.vorino-gallery__item.is-hidden {
  display: none;
}
.vorino-gallery__item.span-2 {
  grid-column: span 2;
}
.vorino-gallery__item:hover {
  box-shadow: 0 6px 18px rgba(24, 39, 19, 0.12);
}

.vorino-gallery__thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  aspect-ratio: 4 / 3; /* PROVISIONAL default tile ratio */
  overflow: hidden;
}
.vorino-gallery__item.span-2 .vorino-gallery__thumb {
  aspect-ratio: 16 / 10;
}
.vorino-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.vorino-gallery__item:hover .vorino-gallery__thumb img {
  transform: scale(1.04);
}
.vorino-gallery__thumb:focus-visible {
  outline: 2px solid var(--vorino-focus, #c4a574);
  outline-offset: 2px;
}

.vorino-gallery__placeholder {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  gap: 0.35rem;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--vorino-muted, #6a5b49);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(48, 37, 28, 0.04),
      rgba(48, 37, 28, 0.04) 6px,
      transparent 6px,
      transparent 12px
    ),
    var(--vorino-parchment-200, #efdfc1);
}
.vorino-gallery__item.span-2 .vorino-gallery__placeholder {
  aspect-ratio: 16 / 10;
}
.vorino-gallery__ph-badge {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--vorino-terra, #9b633e);
  border: 1px solid var(--vorino-terra, #9b633e);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.vorino-gallery__empty {
  text-align: center;
  color: var(--vorino-muted, #6a5b49);
  margin: 1.5rem 0 0;
}

/* Lightbox */
.vorino-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(10, 14, 8, 0.92);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
}
.vorino-lightbox[hidden] {
  display: none !important;
}
.vorino-lightbox__figure {
  margin: 0;
  text-align: center;
  max-height: 90vh;
}
.vorino-lightbox__img {
  max-width: min(96vw, 1100px);
  max-height: 80vh;
  object-fit: contain;
}
.vorino-lightbox__cap {
  color: #f3ecdf;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.vorino-lightbox__close,
.vorino-lightbox__prev,
.vorino-lightbox__next {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.75rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.vorino-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}
.vorino-lightbox__close:focus-visible,
.vorino-lightbox__prev:focus-visible,
.vorino-lightbox__next:focus-visible {
  outline: 2px solid #c4a574;
  outline-offset: 2px;
}

body.vorino-lightbox-open {
  overflow: hidden;
}

/*
 * Set grid-template-columns directly in media queries.
 * Inline style --vorino-gallery-cols from Elementor would otherwise win over
 * class-based custom property changes (responsive bug).
 */
@media (max-width: 1024px) {
  .vorino-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* PROVISIONAL tablet */
  }
  .vorino-gallery__item.span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .vorino-gallery__grid {
    grid-template-columns: minmax(0, 1fr); /* PROVISIONAL mobile */
  }
  .vorino-gallery__filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
  }
  .vorino-lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .vorino-lightbox__prev,
  .vorino-lightbox__next {
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vorino-gallery * {
    transition: none !important;
  }
}