*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --rainbow-1: #ff9aa2;
  --rainbow-2: #ffcc99;
  --rainbow-3: #ffeaa7;
  --rainbow-4: #a8e6cf;
  --rainbow-5: #a0c4ff;
  --rainbow-6: #c3a8e1;
  --ink: #302a33;
  --muted: #746d76;
  --paper: #fffafd;
  --glass: rgba(35, 29, 38, 0.58);
  --glass-border: rgba(255, 255, 255, 0.23);
  --shadow: 0 18px 45px rgba(63, 48, 66, 0.14);
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
}

body {
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 8%, rgba(255, 154, 162, 0.26), transparent 25rem),
    radial-gradient(circle at 92% 24%, rgba(160, 196, 255, 0.28), transparent 29rem),
    radial-gradient(circle at 24% 82%, rgba(168, 230, 207, 0.25), transparent 27rem),
    var(--paper);
  font-family: 'Cormorant Garamond', Georgia, serif;
}

body.lightbox-open {
  overflow: hidden;
  touch-action: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--rainbow-5);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gallery-nav {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 6.5rem;
  padding: 0 clamp(1.1rem, 3vw, 2.5rem);
  color: #fff;
}

.gallery-nav__home {
  justify-self: start;
  color: inherit;
  text-decoration: none;
}

.gallery-nav__mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.13em;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.gallery-nav__mark span {
  font-size: 0.72em;
  color: var(--rainbow-3);
}

.gallery-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(20, 16, 22, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: 'Raleway', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.gallery-nav__back:hover {
  color: #fff;
  background: rgba(20, 16, 22, 0.34);
  transform: translateY(-1px);
}

.gallery-nav__back svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.language-switcher {
  justify-self: end;
  display: flex;
  gap: 0.3rem;
}

.language-button {
  min-width: 2.3rem;
  padding: 0.38rem 0.48rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.68);
  background: transparent;
  font-family: 'Raleway', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.language-button:hover,
.language-button.is-active {
  color: #fff;
}

.language-button.is-active {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.09);
}

.gallery-hero {
  position: relative;
  isolation: isolate;
  min-height: clamp(29rem, 68vh, 48rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2vw, 1.6rem);
  padding: 8rem 1.5rem 4.5rem;
  overflow: hidden;
  text-align: center;
  color: #fff;
  background: #29242c;
}

.gallery-hero::before,
.gallery-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
}

.gallery-hero::before {
  background-image: url('../fotokoutek/158_20260906_120907231.jpg');
  background-position: center 42%;
  background-size: cover;
  filter: saturate(0.9);
  transform: scale(1.025);
  animation: hero-settle 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.gallery-hero::after {
  background:
    linear-gradient(180deg, rgba(17, 13, 18, 0.56) 0%, rgba(24, 18, 25, 0.28) 48%, rgba(24, 18, 25, 0.7) 100%),
    radial-gradient(circle at 50% 45%, transparent 0%, rgba(17, 13, 18, 0.14) 70%);
}

.gallery-hero h1 {
  max-width: 100%;
  font-size: clamp(4rem, 11vw, 7.5rem);
  font-weight: 300;
  font-style: italic;
  line-height: 0.95;
  letter-spacing: 0.025em;
  background: linear-gradient(120deg, var(--rainbow-1), var(--rainbow-2), var(--rainbow-3), var(--rainbow-4), var(--rainbow-5), var(--rainbow-6));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 12px rgba(0, 0, 0, 0.4));
  animation: hero-copy 800ms 120ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.gallery-hero > p {
  color: rgba(255, 255, 255, 0.78);
  font-family: 'Raleway', sans-serif;
  font-size: clamp(0.7rem, 2vw, 0.88rem);
  font-weight: 300;
  line-height: 1.7;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: hero-copy 800ms 220ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.rainbow-divider {
  width: min(15rem, 64vw);
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--rainbow-1), var(--rainbow-2), var(--rainbow-3), var(--rainbow-4), var(--rainbow-5), var(--rainbow-6));
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.22);
  animation: divider-reveal 900ms 80ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.gallery-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.42rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(28, 22, 30, 0.26);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: 'Raleway', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: hero-copy 800ms 300ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

#gallery-count {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem;
  font-style: italic;
  letter-spacing: 0;
}

.gallery-shell {
  position: relative;
  z-index: 2;
  max-width: 92rem;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.25rem);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.4vw, 1.15rem);
}

.gallery-item {
  position: relative;
  aspect-ratio: 15 / 17;
  overflow: hidden;
  border: 0;
  border-radius: clamp(0.8rem, 1.6vw, 1.25rem);
  background: #e8e0e7;
  box-shadow: 0 8px 22px rgba(56, 41, 59, 0.1);
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 550ms ease, transform 550ms cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 260ms ease;
}

.gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.gallery-item:hover {
  z-index: 1;
  transform: translateY(-5px) scale(1.012);
  box-shadow: var(--shadow);
}

.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 58%, rgba(22, 17, 23, 0.16));
  opacity: 0;
  transition: opacity 220ms ease;
}

.gallery-item:hover::after {
  opacity: 1;
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 650ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 260ms ease;
}

.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.035);
}

.gallery-item__video-mark {
  position: absolute;
  z-index: 2;
  right: 0.72rem;
  bottom: 0.72rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  color: #fff;
  background: rgba(25, 20, 27, 0.46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.gallery-item__video-mark svg {
  width: 0.75rem;
  margin-left: 0.08rem;
  fill: currentColor;
}

.lightbox {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-rows: 4.5rem minmax(0, 1fr) 7rem;
  color: #fff;
  background: rgba(14, 11, 15, 0.94);
  opacity: 0;
  transition: opacity 260ms ease;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
}

.lightbox__toolbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
}

.lightbox__status {
  color: rgba(255, 255, 255, 0.73);
  font-family: 'Raleway', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.lightbox__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.lightbox__icon-button,
.lightbox__arrow {
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.lightbox__icon-button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
}

.lightbox__icon-button:hover,
.lightbox__arrow:hover {
  transform: scale(1.06);
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.15);
}

.lightbox__icon-button svg,
.lightbox__arrow svg {
  width: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__stage {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0.5rem 5.5rem 1rem;
  overflow: hidden;
  touch-action: pan-y;
}

.lightbox__media {
  display: block;
  max-width: calc(100vw - 11rem);
  max-height: calc(100dvh - 13rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.55rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox__media--next {
  animation: media-next 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.lightbox__media--previous {
  animation: media-previous 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.lightbox__arrow {
  position: fixed;
  z-index: 5;
  top: 50%;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  transform: translateY(-50%);
}

.lightbox__arrow:hover {
  transform: translateY(-50%) scale(1.06);
}

.lightbox__arrow--previous {
  left: 1.25rem;
}

.lightbox__arrow--next {
  right: 1.25rem;
}

.lightbox__filmstrip {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem max(1.25rem, calc(50vw - 29rem));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.22));
}

.lightbox__filmstrip::-webkit-scrollbar {
  display: none;
}

.filmstrip-item {
  position: relative;
  flex: 0 0 auto;
  width: 4.4rem;
  height: 5rem;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 0.5rem;
  background: #2d2830;
  opacity: 0.48;
  cursor: pointer;
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.filmstrip-item:hover {
  opacity: 0.82;
}

.filmstrip-item.is-active {
  border-color: var(--rainbow-3);
  opacity: 1;
  transform: translateY(-3px);
}

.filmstrip-item img,
.filmstrip-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.filmstrip-item__video-mark {
  position: absolute;
  right: 0.22rem;
  bottom: 0.22rem;
  width: 0;
  height: 0;
  border-top: 0.25rem solid transparent;
  border-bottom: 0.25rem solid transparent;
  border-left: 0.4rem solid #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

@keyframes hero-settle {
  from { opacity: 0; transform: scale(1.07); }
  to { opacity: 1; transform: scale(1.025); }
}

@keyframes hero-copy {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes divider-reveal {
  from { opacity: 0; transform: scaleX(0.25); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes media-next {
  from { opacity: 0; transform: translateX(28px) scale(0.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes media-previous {
  from { opacity: 0; transform: translateX(-28px) scale(0.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .gallery-nav {
    min-height: 5.25rem;
    grid-template-columns: 1fr auto;
  }

  .gallery-nav__back {
    display: none;
  }

  .gallery-hero {
    min-height: min(42rem, 76svh);
    padding-top: 6.5rem;
  }

  .gallery-hero::before {
    background-position: center 35%;
  }

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

  .lightbox {
    grid-template-rows: 4rem minmax(0, 1fr) 6.3rem;
    min-height: 100dvh;
  }

  .lightbox__toolbar {
    padding: 0 0.75rem 0 1rem;
  }

  .lightbox__icon-button {
    width: 2.65rem;
    height: 2.65rem;
  }

  .lightbox__stage {
    padding: 0.5rem 0.65rem 4.3rem;
  }

  .lightbox__media {
    max-width: calc(100vw - 1.3rem);
    max-height: calc(100dvh - 14.8rem);
    border-radius: 0.4rem;
  }

  .lightbox__arrow {
    top: auto;
    bottom: 7.1rem;
    width: 2.9rem;
    height: 2.9rem;
    transform: none;
  }

  .lightbox__arrow:hover {
    transform: scale(1.06);
  }

  .lightbox__arrow--previous {
    left: 0.75rem;
  }

  .lightbox__arrow--next {
    right: 0.75rem;
  }

  .lightbox__filmstrip {
    padding-inline: 0.75rem;
  }

  .filmstrip-item {
    width: 4.05rem;
    height: 4.6rem;
  }
}

@media (max-width: 480px) {
  .gallery-hero::before {
    background-position: center;
    background-size: auto 132%;
  }

  .gallery-hero h1 {
    font-size: clamp(3.55rem, 18vw, 5rem);
  }

  .gallery-shell {
    padding: 0.6rem;
  }

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

  .gallery-item {
    border-radius: 0.8rem;
  }

  .gallery-item__video-mark {
    right: 0.55rem;
    bottom: 0.55rem;
    width: 1.8rem;
    height: 1.8rem;
  }

  .lightbox__status {
    font-size: 0.63rem;
    letter-spacing: 0.1em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
