.gal {
  --forest: #1a2332;
  --gold: #b8935d;
  --gold-light: #d4b896;
  --ink: #1a1a1a;
  --page: #ffffff;
  --sand: #f6f5f2;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Montserrat', system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* —— Hero fluide —— */
.gal-hero {
  position: relative;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  color: #fff;
  padding:
    calc(var(--nav-h, 80px) + clamp(24px, 5vw, 48px))
    clamp(18px, 5vw, 56px)
    clamp(88px, 14vw, 140px);
  overflow: hidden;
  isolation: isolate;
}

.gal-hero__media {
  position: absolute;
  inset: -8% 0 0;
  z-index: 0;
  overflow: hidden;
  will-change: transform;
}

.gal-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.12);
  filter: saturate(1.05);
}

.gal.is-ready .gal-hero__media img {
  animation: gal-ken-fluid 22s ease-in-out infinite alternate;
}

@keyframes gal-ken-fluid {
  0% { transform: scale(1.08) translate3d(0, 0, 0); }
  50% { transform: scale(1.14) translate3d(-1.2%, -0.6%, 0); }
  100% { transform: scale(1.1) translate3d(1%, 0.4%, 0); }
}

.gal-hero__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(115deg, rgba(14, 20, 28, 0.78) 0%, rgba(14, 20, 28, 0.28) 48%, rgba(14, 20, 28, 0.2) 100%),
    linear-gradient(180deg, rgba(14, 20, 28, 0.35) 0%, transparent 38%, rgba(14, 20, 28, 0.72) 100%);
  pointer-events: none;
}

.gal-hero__fluid {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.gal-hero__blob {
  position: absolute;
  border-radius: 60% 40% 55% 45% / 50% 55% 45% 50%;
  filter: blur(40px);
  opacity: 0.45;
  mix-blend-mode: soft-light;
  animation: gal-blob 14s ease-in-out infinite;
}

.gal-hero__blob--1 {
  width: min(52vw, 420px);
  height: min(52vw, 420px);
  left: -8%;
  bottom: 8%;
  background: radial-gradient(circle, rgba(184, 147, 93, 0.75), transparent 70%);
  animation-duration: 16s;
}

.gal-hero__blob--2 {
  width: min(40vw, 320px);
  height: min(40vw, 320px);
  right: 4%;
  top: 18%;
  background: radial-gradient(circle, rgba(212, 184, 150, 0.55), transparent 70%);
  animation-duration: 12s;
  animation-delay: -3s;
}

.gal-hero__blob--3 {
  width: min(34vw, 260px);
  height: min(34vw, 260px);
  right: 28%;
  bottom: 22%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 70%);
  animation-duration: 18s;
  animation-delay: -6s;
}

@keyframes gal-blob {
  0%, 100% {
    border-radius: 60% 40% 55% 45% / 50% 55% 45% 50%;
    transform: translate3d(0, 0, 0) scale(1);
  }
  33% {
    border-radius: 45% 55% 40% 60% / 55% 45% 55% 45%;
    transform: translate3d(4%, -5%, 0) scale(1.08);
  }
  66% {
    border-radius: 55% 45% 60% 40% / 40% 60% 40% 60%;
    transform: translate3d(-3%, 4%, 0) scale(0.94);
  }
}

.gal-hero__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
}

.gal-a {
  opacity: 0;
  transform: translateY(28px);
}

.gal.is-ready .gal-a {
  animation: gal-up 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.gal-a--1 { animation-delay: 0.15s !important; }
.gal-a--2 { animation-delay: 0.32s !important; }
.gal-a--3 { animation-delay: 0.55s !important; }

@keyframes gal-up {
  to { opacity: 1; transform: none; }
}

.gal-hero__brand {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.gal-hero__brand em {
  font-style: italic;
  color: var(--gold-light);
}

.gal-hero__inner h1 {
  margin: 0 0 clamp(28px, 5vw, 40px);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.8rem, 9vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.gal-hero__line {
  display: block;
  overflow: hidden;
}

.gal-hero__line--em {
  font-style: italic;
  color: var(--gold-light);
  font-size: 0.72em;
  margin-top: 0.06em;
}

.gal.is-ready .gal-hero__line {
  animation: gal-line 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gal.is-ready .gal-hero__line--em {
  animation-delay: 0.18s;
}

@keyframes gal-line {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transform: translateY(40%);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: none;
  }
}

.gal-hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.gal-hero__scroll-orb {
  width: 28px;
  height: 44px;
  border: 1.5px solid rgba(212, 184, 150, 0.55);
  border-radius: 999px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.gal-hero__scroll-orb span {
  width: 4px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold-light);
  animation: gal-orb 1.7s ease-in-out infinite;
}

@keyframes gal-orb {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(14px); }
}

.gal-hero__scroll-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.gal-hero__scroll:hover .gal-hero__scroll-label {
  color: var(--gold-light);
  opacity: 1;
}

.gal-hero__wave-fill {
  fill: var(--sand);
}

.gal-hero__wave {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -1px;
  width: 104%;
  height: clamp(56px, 10vw, 110px);
  z-index: 3;
  display: block;
  pointer-events: none;
  animation: gal-wave-sway 9s ease-in-out infinite alternate;
}

@keyframes gal-wave-sway {
  from { transform: translateX(0) scaleY(1); }
  to { transform: translateX(-1.5%) scaleY(1.12); }
}

/* Bento collage */
.gal-body {
  background: var(--sand);
  padding: clamp(28px, 5vw, 56px) clamp(14px, 2.5vw, 28px) clamp(48px, 7vw, 80px);
}

.gal-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(140px, 18vw);
  gap: 10px;
  max-width: 1280px;
  margin: 0 auto;
}

.gal-cell {
  position: relative;
  border: none;
  padding: 0;
  margin: 0;
  background: var(--forest);
  cursor: pointer;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.gal-cell.is-in {
  opacity: 1;
  transform: none;
}

.gal-cell--1 { grid-column: span 7; grid-row: span 2; }
.gal-cell--2 { grid-column: span 5; grid-row: span 1; }
.gal-cell--3 { grid-column: span 5; grid-row: span 1; }
.gal-cell--4 { grid-column: span 4; grid-row: span 2; }
.gal-cell--5 { grid-column: span 4; grid-row: span 1; }
.gal-cell--6 { grid-column: span 4; grid-row: span 1; }
.gal-cell--7 { grid-column: span 4; grid-row: span 1; }
.gal-cell--8 { grid-column: span 8; grid-row: span 2; }

.gal-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
}

.gal-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(18, 24, 32, 0.25) 100%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.gal-cell:hover img,
.gal-cell:focus-visible img {
  transform: scale(1.05);
  filter: brightness(1.04);
}

.gal-cell:hover::after,
.gal-cell:focus-visible::after {
  opacity: 1;
}

.gal-cell:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  z-index: 1;
}

.gal-cell__likes {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(14, 18, 24, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  transform: perspective(400px) rotateX(8deg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.gal-cell__likes svg {
  color: #ff6b7a;
  fill: #ff6b7a;
}

/* Lightbox */
.gal-lb {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(14, 18, 24, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: gal-fade 0.25s ease both;
  perspective: 1200px;
}

@keyframes gal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gal-lb__stage {
  position: relative;
  width: min(920px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform-style: preserve-3d;
  animation: gal-stage-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes gal-stage-in {
  from {
    opacity: 0;
    transform: translateZ(-80px) rotateX(6deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.gal-lb__visual {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  transform-style: preserve-3d;
}

.gal-lb__pic {
  max-width: 100%;
  max-height: min(62vh, 640px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(255, 255, 255, 0.06);
  animation: gal-zoom 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes gal-zoom {
  from {
    opacity: 0;
    transform: translateZ(-40px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Burst 3D particles */
.gal-burst {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 0;
  height: 0;
  pointer-events: none;
  perspective: 600px;
  z-index: 5;
}

.gal-burst__p {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.35rem;
  color: #ff6b7a;
  text-shadow: 0 4px 12px rgba(255, 80, 100, 0.45);
  animation: gal-burst-fly 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-style: preserve-3d;
}

@keyframes gal-burst-fly {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateZ(0) scale(0.4);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--bx), var(--by), var(--bz)) rotateZ(var(--br)) scale(1.15);
  }
}

/* React bar 3D */
.gal-react {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  perspective: 800px;
}

.gal-react__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 108px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 16px;
  transform-style: preserve-3d;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.35s ease;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.gal-react__btn:hover {
  transform: translateY(-4px) rotateX(8deg);
  border-color: rgba(184, 147, 93, 0.55);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(184, 147, 93, 0.2);
}

.gal-react__btn.is-pop {
  animation: gal-btn-3d 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.gal-react__btn--like.is-pop {
  border-color: rgba(255, 107, 122, 0.7);
}

.gal-react__btn--dislike.is-pop {
  border-color: rgba(154, 163, 178, 0.7);
}

.gal-react__btn--comment.is-on,
.gal-react__btn--like.is-on,
.gal-react__btn--dislike.is-on {
  border-color: var(--gold);
  background: rgba(184, 147, 93, 0.22);
}

@keyframes gal-btn-3d {
  0% { transform: scale(1) rotateY(0) rotateX(0); }
  30% { transform: scale(1.14) rotateY(-18deg) rotateX(12deg); }
  55% { transform: scale(0.96) rotateY(12deg) rotateX(-8deg); }
  100% { transform: scale(1) rotateY(0) rotateX(0); }
}

.gal-react__3d {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
}

.gal-react__btn--like .gal-react__3d {
  color: #ff6b7a;
}

.gal-react__btn.is-pop .gal-react__3d {
  animation: gal-icon-spin 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gal-icon-spin {
  0% { transform: rotateY(0) scale(1); }
  40% { transform: rotateY(180deg) scale(1.35); }
  100% { transform: rotateY(360deg) scale(1); }
}

.gal-react__btn--like.is-pop .gal-react__3d svg {
  fill: #ff6b7a;
}

.gal-react__count {
  display: inline-block;
  min-width: 1.5ch;
  transform-style: preserve-3d;
}

.gal-react__count.is-flip {
  animation: gal-count-flip 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gal-count-flip {
  0% { transform: rotateX(0); opacity: 1; }
  45% { transform: rotateX(-90deg); opacity: 0.4; }
  55% { transform: rotateX(90deg); opacity: 0.4; }
  100% { transform: rotateX(0); opacity: 1; }
}

/* Comments panel 3D */
.gal-comments {
  width: min(520px, 100%);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: rotateX(-12deg) translateY(12px);
  transform-origin: top center;
  transition:
    max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.35s ease;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.9);
}

.gal-comments.is-open {
  max-height: 280px;
  opacity: 1;
  transform: none;
  padding: 16px 16px 12px;
  border-color: rgba(255, 255, 255, 0.12);
  overflow-y: auto;
}

.gal-comments h3 {
  margin: 0 0 12px;
  font-size: 0.88rem;
  font-weight: 600;
}

.gal-comments__form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.gal-comments__form input,
.gal-comments__form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  padding: 12px;
  font: inherit;
  font-size: 0.88rem;
  resize: vertical;
}

.gal-comments__form button {
  justify-self: start;
  border: none;
  background: var(--gold);
  color: var(--forest);
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gal-comments__form button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.gal-comments__form button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gal-comments__empty {
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
}

.gal-comments__item {
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  animation: gal-comment-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes gal-comment-in {
  from {
    opacity: 0;
    transform: translateZ(-20px) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.gal-comments__item strong {
  display: block;
  font-size: 0.84rem;
}

.gal-comments__item time {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  margin: 2px 0 6px;
}

.gal-comments__item p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.45;
}

.gal-lb__x,
.gal-lb__btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  z-index: 3;
}

.gal-lb__x:hover,
.gal-lb__btn:hover {
  background: rgba(184, 147, 93, 0.4);
  border-color: var(--gold);
}

.gal-lb__x {
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}

.gal-lb__btn--prev {
  left: max(16px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
}

.gal-lb__btn--next {
  right: max(16px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
}

.gal-lb__n {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

.gal-navlinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  padding: 36px 20px 48px;
  background: var(--page);
}

.gal-navlinks a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0.65;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.gal-navlinks a:hover {
  color: var(--gold);
  opacity: 1;
}

@media (max-width: 900px) {
  .gal-hero {
    min-height: 92svh;
    padding-bottom: clamp(72px, 16vw, 110px);
  }

  .gal-hero__blob--3 {
    display: none;
  }

  .gal-bento {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(120px, 28vw);
    gap: 8px;
  }

  .gal-cell--1 { grid-column: span 6; grid-row: span 2; }
  .gal-cell--2,
  .gal-cell--3 { grid-column: span 3; grid-row: span 1; }
  .gal-cell--4 { grid-column: span 3; grid-row: span 2; }
  .gal-cell--5,
  .gal-cell--6,
  .gal-cell--7 { grid-column: span 3; grid-row: span 1; }
  .gal-cell--8 { grid-column: span 6; grid-row: span 2; }
}

@media (max-width: 560px) {
  .gal-hero {
    min-height: 88svh;
    min-height: 88dvh;
    align-items: flex-end;
    padding:
      calc(var(--nav-h, 72px) + 20px)
      18px
      clamp(72px, 18vw, 100px);
  }

  .gal-hero__inner h1 {
    font-size: clamp(2.4rem, 12vw, 3.2rem);
  }

  .gal-hero__scroll-label {
    font-size: 0.65rem;
  }

  .gal-hero__blob--2 {
    opacity: 0.3;
  }

  .gal-bento {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 42vw;
  }

  .gal-cell--1,
  .gal-cell--8 {
    grid-column: span 2;
    grid-row: span 1;
  }

  .gal-cell--2,
  .gal-cell--3,
  .gal-cell--4,
  .gal-cell--5,
  .gal-cell--6,
  .gal-cell--7 {
    grid-column: span 1;
    grid-row: span 1;
  }

  .gal-lb__btn {
    top: auto;
    bottom: max(52px, env(safe-area-inset-bottom));
    transform: none;
  }

  .gal-lb__stage {
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding-bottom: 72px;
  }

  .gal-lb__pic {
    max-height: 48vh;
  }

  .gal-react__btn {
    min-width: 96px;
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gal-hero__media img,
  .gal-hero__blob,
  .gal-hero__wave,
  .gal-hero__scroll-orb span,
  .gal-hero__line,
  .gal-a,
  .gal-cell,
  .gal-cell img,
  .gal-lb,
  .gal-lb__stage,
  .gal-lb__pic,
  .gal-react__btn,
  .gal-react__3d,
  .gal-react__count,
  .gal-burst__p,
  .gal-comments,
  .gal-comments__item {
    animation: none !important;
    transition: none !important;
  }

  .gal-a,
  .gal-cell,
  .gal-hero__line {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}
