/* Galerie page — grille 3 colonnes carrées, gap 8 px (Galerie.html V2) */

.thiek-page--gallery {
  --page-gutter: 60px;
  width: min(var(--v2-content-width, 1320px), calc(100% - var(--page-gutter) * 2));
  margin-inline: auto;
  /* The closing CTA carries its own bottom padding: no extra page padding
     and no footer margin on top of it (they added ~220 px of empty band). */
  padding-bottom: 0;
}

body:has(.thiek-page--gallery) .thiek-footer {
  margin-top: 0;
}

.thiek-gallery-hero {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--spacing-md);
  align-items: end;
  padding: 96px 0 48px;
}

.thiek-gallery-hero__title {
  grid-column: span 7;
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(3rem, 9vw, 120px);
  font-weight: var(--font-display-weight);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

.thiek-gallery-hero__lede {
  grid-column: 9 / span 4;
  margin: 0 0 14px;
  color: var(--color-muted);
  font-size: var(--text-body);
  line-height: 1.6;
}

.thiek-gallery-filters-wrap {
  position: sticky;
  top: var(--thiek-announce-h, 0px);
  z-index: 2;
  background: var(--color-bg);
}

/* The announcement bar scrolls away, so once the bar is pinned only the
   header sits above it: header height while shown, 0 while hidden — at every
   width (tablets/desktop kept the banner offset and left a gap). */
.thiek-header.is-solid ~ .thiek-main .thiek-gallery-filters-wrap,
.thiek-js .thiek-gallery-filters-wrap {
  top: var(--header-height);
  transition: top 200ms var(--ease, ease);
}

html body:has(.thiek-header.is-header-hidden) .thiek-main .thiek-gallery-filters-wrap {
  top: 0;
}

@media (prefers-reduced-motion: reduce) {
  .thiek-gallery-filters-wrap {
    transition: none;
  }
}

.thiek-gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}

.thiek-gallery-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target-size);
  padding: 0 20px;
  border: 1px solid var(--color-line);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
}

.thiek-gallery-filter.is-active,
.thiek-gallery-filter[aria-current="page"] {
  background: var(--color-inverse-text);
  border-color: var(--color-inverse-text);
  color: var(--color-inverse-bg);
}

.thiek-gallery-filter__count {
  color: #5c5853;
}

.thiek-gallery-filter:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.thiek-gallery-ig {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-height: var(--target-size);
  color: var(--color-accent-text);
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
}

.thiek-gallery-ig:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.thiek-gallery-grid {
  padding-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.thiek-gallery-tile {
  margin: 0;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-surface-elevated, #1a1918);
}

.thiek-gallery-tile__media {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: inherit;
}

.thiek-gallery-grid__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Ton chaud unifié ; couleur au survol. */
  filter: sepia(0.28) saturate(0.85) brightness(0.92);
  transition: filter 0.25s ease, transform 0.25s ease;
}

.thiek-gallery-tile--photo:hover .thiek-gallery-grid__img,
.thiek-gallery-tile--photo:focus-within .thiek-gallery-grid__img {
  filter: none;
  transform: scale(1.02);
}

/* Légendes visibles retirées (alt conservé sur <img>). */
.thiek-gallery-tile__caption {
  display: none;
}

/*
 * CTA : carré par défaut (span 1).
 * Desktop ≥1024 : span 2/3 = bandeau pour combler la dernière rangée (aucun trou).
 * 29 photos + CTA span 1 = 30 cases = 10 rangées.
 */
@media (min-width: 1024px) {
  .thiek-gallery-tile--cta-span-2 {
    grid-column: span 2;
    aspect-ratio: auto;
    min-height: 0;
    align-self: stretch;
  }

  .thiek-gallery-tile--cta-span-3 {
    grid-column: span 3;
    aspect-ratio: auto;
    min-height: 0;
    align-self: stretch;
  }
}

.thiek-gallery-tile--cta {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  box-sizing: border-box;
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
  text-decoration: none;
}

.thiek-gallery-tile--cta:hover,
.thiek-gallery-tile--cta:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 85%, #000);
  color: var(--color-on-primary, #fff);
}

.thiek-gallery-tile__cta-title {
  font-family: var(--font-heading);
  font-weight: var(--font-display-weight, 500);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.15;
}

.thiek-gallery-tile__cta-action {
  display: block;
  margin-top: 12px;
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.thiek-gallery-empty {
  margin: var(--spacing-xl) 0;
  color: var(--color-muted);
  grid-column: 1 / -1;
}

.thiek-gallery-more {
  display: flex;
  justify-content: center;
  padding: 48px 0 0;
}

.thiek-gallery-more__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 32px;
  border: 1px solid color-mix(in srgb, var(--color-inverse-text) 40%, transparent);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-ui);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}

.thiek-gallery-more__btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.thiek-gallery-cta {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--spacing-md);
  align-items: center;
  margin-top: var(--spacing-section);
  padding: 72px 0;
  border-top: 1px solid var(--color-line);
}

.thiek-gallery-cta__title {
  grid-column: span 7;
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 56px);
  font-weight: var(--font-display-weight);
  line-height: 1.05;
  color: var(--color-text);
}

.thiek-gallery-cta__aside {
  grid-column: 9 / span 4;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.thiek-gallery-cta__note {
  margin: 0;
  font-size: 14px;
  color: var(--color-muted);
}

@media (prefers-reduced-motion: reduce) {
  .thiek-gallery-grid__img {
    transition: none;
  }

  .thiek-gallery-tile--photo:hover .thiek-gallery-grid__img,
  .thiek-gallery-tile--photo:focus-within .thiek-gallery-grid__img {
    transform: none;
  }
}

@media (max-width: 1023px) {
  .thiek-page--gallery {
    --page-gutter: 24px;
  }

  .thiek-gallery-hero,
  .thiek-gallery-cta {
    grid-template-columns: 1fr;
    padding-inline: 0;
  }

  .thiek-gallery-hero__title,
  .thiek-gallery-hero__lede,
  .thiek-gallery-cta__title,
  .thiek-gallery-cta__aside {
    grid-column: 1 / -1;
  }

  .thiek-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* CTA : toujours 1 case carrée (ignore span desktop). */
  .thiek-gallery-tile--cta,
  .thiek-gallery-tile--cta-span-2,
  .thiek-gallery-tile--cta-span-3 {
    grid-column: auto !important;
    aspect-ratio: 1 / 1;
    height: auto;
    align-self: auto;
  }

  .thiek-gallery-ig {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 479px) {
  .thiek-page--gallery {
    --page-gutter: 16px;
  }

  .thiek-gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* Galerie mobile — Instagram profile density: short header, one-line
   scrolling filters, 3-column square grid edge to edge with 2 px gaps. */
@media (max-width: 767px) {
  .thiek-gallery-hero {
    gap: 6px;
    padding: var(--spacing-md) 0 var(--spacing-sm);
  }

  .thiek-gallery-hero__title {
    font-size: 2.25rem;
    line-height: 1;
  }

  .thiek-gallery-hero__lede {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
  }

  .thiek-gallery-filters-wrap {
    margin-inline: calc(var(--page-gutter) * -1);
  }

  .thiek-gallery-filters {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 8px var(--page-gutter);
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 0;
  }

  .thiek-gallery-filters::-webkit-scrollbar {
    display: none;
  }

  .thiek-gallery-filter {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    border-radius: var(--radius);
    font-size: 14px;
    white-space: nowrap;
  }

  .thiek-gallery-ig {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    margin-left: 4px;
    gap: 6px;
    font-size: 14px;
    white-space: nowrap;
  }

  .thiek-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    margin-inline: calc(var(--page-gutter) * -1);
    padding-top: 2px;
  }

  .thiek-gallery-tile--cta {
    padding: 8px;
    gap: 4px;
  }

  .thiek-gallery-tile__cta-title {
    font-size: 15px;
    line-height: 1.15;
  }

  .thiek-gallery-tile__cta-action {
    font-size: 11px;
  }

  .thiek-gallery-more {
    padding-top: var(--spacing-lg);
  }

  .thiek-gallery-cta {
    padding: var(--spacing-xl) 0;
  }
}

/* Galerie mobile — same hero as the home page: photo under a transparent
   header, dark vignette, photo melting into black, copy grouped at the
   bottom left. */
.thiek-gallery-hero__banner {
  display: none;
}

@media (max-width: 767px) {
  .thiek-page--gallery.has-banner {
    padding-top: 0;
  }

  .has-banner .thiek-gallery-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
    --g-banner-h: min(118vw, 72svh);
    min-height: 0;
    margin-inline: calc(var(--page-gutter) * -1);
    padding: calc(var(--g-banner-h) - 120px) var(--page-gutter) var(--spacing-md);
    overflow: hidden;
    text-align: left;
  }

  .has-banner .thiek-gallery-hero__banner {
    display: block;
    position: absolute;
    inset: 0 0 auto;
    height: var(--g-banner-h);
    z-index: 0;
    overflow: hidden;
  }

  .has-banner .thiek-gallery-hero__banner picture {
    display: contents;
  }

  .has-banner .thiek-gallery-hero__banner-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 100%;
    opacity: 0.9;
    /* Zoom from the lower right: the watermark (top left) leaves the frame. */
    transform: scale(1.2);
    transform-origin: 60% 100%;
  }

  /* Shade sits on the banner box itself, so it tracks the photo height. */
  .has-banner .thiek-gallery-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: var(--g-banner-h);
    z-index: 1;
    pointer-events: none;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-bg) 85%, transparent) 0, color-mix(in srgb, var(--color-bg) 40%, transparent) 14%, transparent 30%),
      linear-gradient(90deg, color-mix(in srgb, var(--color-bg) 80%, transparent) 0, transparent 22%, transparent 78%, color-mix(in srgb, var(--color-bg) 80%, transparent) 100%),
      radial-gradient(ellipse 75% 55% at 50% 40%, transparent 40%, color-mix(in srgb, var(--color-bg) 70%, transparent) 100%),
      linear-gradient(180deg, transparent 0, transparent 52%, color-mix(in srgb, var(--color-bg) 85%, transparent) 78%, var(--color-bg) 92%);
  }

  .has-banner .thiek-gallery-hero__title,
  .has-banner .thiek-gallery-hero__lede {
    position: relative;
    z-index: 2;
    grid-column: auto;
  }

  .has-banner .thiek-gallery-hero__lede {
    max-width: 34ch;
    color: var(--color-stone, var(--color-muted));
  }
}

/* Sticky filters: glue to the header when it is shown, to the very top when
   it hides on scroll (the announcement bar has scrolled away by then). */
@media (max-width: 767px) {
  .thiek-js .thiek-gallery-filters-wrap,
  .thiek-header.is-solid ~ .thiek-main .thiek-gallery-filters-wrap {
    top: var(--header-height);
    transition: top 200ms var(--ease, ease);
  }

  /* Must outrank `.thiek-header.is-solid ~ .thiek-main …` (0,4,0). */
  html body:has(.thiek-header.is-header-hidden) .thiek-main .thiek-gallery-filters-wrap {
    top: 0;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .thiek-gallery-filters-wrap {
    transition: none;
  }
}
