.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
}

.gallery-modal.is-open {
  pointer-events: auto;
  visibility: visible;
}

.gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal.is-open .gallery-modal__backdrop {
  opacity: 1;
}

.gallery-modal__panel {
  position: relative;
  z-index: 1;
  width: min(920px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal.is-open .gallery-modal__panel {
  opacity: 1;
  transform: translateY(0);
}

.gallery-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}

.gallery-modal__title {
  font-family: var(--font-d);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text);
}

.gallery-modal__meta {
  font-size: 12px;
  color: var(--soft);
  margin-top: 6px;
  letter-spacing: 0.06em;
}

.gallery-modal__close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 20px;
  flex-shrink: 0;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal__close:hover {
  border-color: #444;
}

.gallery-modal__stage {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal__stage.is-video {
  background: #0a0a0a;
}

.gallery-modal__stage.is-video .gallery-modal__media {
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: min(56vh, 560px);
  height: auto;
}

.gallery-modal__media {
  width: 100%;
  min-height: min(56vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 56px;
}

.gallery-modal__image {
  width: 100%;
  height: min(56vh, 560px);
  max-height: min(56vh, 560px);
  object-fit: contain;
  display: block;
}

.gallery-modal__image.is-hidden,
.gallery-modal__video.is-hidden,
.gallery-modal__placeholder.is-hidden {
  display: none;
}

.gallery-modal__video {
  width: 100%;
  height: 100%;
  min-height: min(56vh, 560px);
  max-height: min(56vh, 560px);
  object-fit: contain;
  display: block;
  background: #0a0a0a;
}

.gallery-modal__stage.is-video .gallery-modal__video {
  min-height: 0;
  height: 100%;
  object-fit: contain;
}

.gallery-modal__video::-webkit-media-controls-panel {
  background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.6) 100%);
}

.gallery-modal__video::-webkit-media-controls-overlay-play-button {
  display: none;
}

.gallery-modal__video::-webkit-media-controls-start-playback-button {
  display: none;
}

.gallery-modal__placeholder {
  width: 100%;
  max-width: 400px;
  padding: 48px 24px;
  text-align: center;
  color: var(--soft);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .gallery-modal__media {
    min-height: min(44vh, 400px);
    padding: 0 48px;
  }

  .gallery-modal__stage.is-video .gallery-modal__media {
    max-height: min(44vh, 400px);
  }

  .gallery-modal__image {
    height: min(44vh, 400px);
    max-height: min(44vh, 400px);
  }
}

@media (max-width: 520px) {
  .gallery-modal__media {
    min-height: min(38vh, 320px);
    padding: 0 40px;
  }

  .gallery-modal__stage.is-video .gallery-modal__media {
    max-height: min(38vh, 320px);
  }

  .gallery-modal__image {
    height: min(38vh, 320px);
    max-height: min(38vh, 320px);
  }

  .gallery-modal__nav {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .gallery-modal__nav--prev {
    left: 6px;
  }

  .gallery-modal__nav--next {
    right: 6px;
  }
}

.gallery-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 10, 10, 0.72);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 22px;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal__nav:hover {
  border-color: #444;
}

.gallery-modal__nav--prev {
  left: 12px;
}

.gallery-modal__nav--next {
  right: 12px;
}

.gallery-modal__nav.is-hidden {
  display: none;
}

.gallery-modal__thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.gallery-modal__thumb {
  flex-shrink: 0;
  width: 72px;
  height: 88px;
  border: 2px solid transparent;
  background: var(--card);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal__thumb.is-active {
  border-color: var(--accent);
}

.gallery-modal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-modal__thumb--video {
  position: relative;
}

.gallery-modal__thumb-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #1a1a1a 0%, #111 100%);
}

.gallery-modal__thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  background: rgba(10, 10, 10, 0.45);
  pointer-events: none;
}

.gallery-modal__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.gallery-modal__footer-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.gallery-modal__desc-btn {
  background: none;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
  padding: 8px 16px;
  font-family: var(--font-b);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 100px;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal__desc-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.gallery-modal__desc-btn.is-hidden {
  display: none;
}

.gallery-modal__price {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 18px;
  font-weight: 600;
}

.gallery-modal__price-old {
  font-size: 14px;
  font-weight: 400;
  color: var(--soft);
  text-decoration: line-through;
}

.gallery-modal__price-sale {
  font-size: 18px;
  font-weight: 600;
}

.gallery-modal__counter {
  font-size: 12px;
  color: var(--soft);
  letter-spacing: 0.08em;
}

body.is-gallery-open {
  overflow: hidden;
}

.gallery-modal__order {
  padding: 0 4px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.gallery-modal__order.is-hidden {
  display: none;
}

.gallery-modal__order-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 10px;
}

.gallery-modal__order-btns {
  display: flex;
  gap: 10px;
}

.gallery-modal__order-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 1;
  height: 48px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 2px solid transparent;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-modal__order-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.gallery-modal__order-btn:active {
  transform: translateY(0);
  opacity: 1;
}

.gallery-modal__order-btn--tg {
  background: #2aabee;
  color: #fff;
}

.gallery-modal__order-btn--ig {
  background: transparent;
  border-color: #e1306c;
  color: #e1306c;
}

@media (max-width: 600px) {
  .gallery-modal__order-btns {
    flex-direction: column;
    gap: 8px;
  }

  .gallery-modal__order-btn {
    height: 44px;
    font-size: 12px;
  }
}

.gallery-desc-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  visibility: hidden;
}

.gallery-desc-modal.is-open {
  pointer-events: auto;
  visibility: visible;
}

.gallery-desc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-desc-modal.is-open .gallery-desc-modal__backdrop {
  opacity: 1;
}

.gallery-desc-modal__panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(72vh, 72dvh);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-desc-modal.is-open .gallery-desc-modal__panel {
  opacity: 1;
  transform: translateY(0);
}

.gallery-desc-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.gallery-desc-modal__title {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: var(--text);
}

.gallery-desc-modal__close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-desc-modal__close:hover {
  border-color: #444;
}

.gallery-desc-modal__body {
  padding: 16px 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.gallery-desc-modal__text {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-line;
  max-width: 65ch;
}

@media (max-width: 600px) {
  .gallery-desc-modal {
    align-items: flex-end;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .gallery-desc-modal__panel {
    width: 100%;
    max-height: min(78vh, 78dvh);
    border-left: none;
    border-right: none;
    border-bottom: none;
    transform: translateY(100%);
  }

  .gallery-desc-modal.is-open .gallery-desc-modal__panel {
    transform: translateY(0);
  }

  .gallery-desc-modal__header {
    padding: 16px 16px 12px;
  }

  .gallery-desc-modal__title {
    font-size: 18px;
  }

  .gallery-desc-modal__body {
    padding: 12px 16px 20px;
  }

  .gallery-modal__desc-btn {
    font-size: 11px;
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-modal__backdrop,
  .gallery-modal__panel,
  .gallery-desc-modal__backdrop,
  .gallery-desc-modal__panel {
    transition: none;
  }
}
