/* ==========================================================
   gallery-stage-fixes.v2.css — GIFS Content Gallery Perfect Fixes
   ========================================================== */

/* ——————————————————————————————————————————————————————
   1. СТАРТОВЫЙ ЭКРАН: Благородная вывеска «Картинная галерея»
   ——————————————————————————————————————————————————————— */
html body #root .cg-root .cg-entry .cg-neon-sign,
html body #root .cg-root .cg-cover-neon {
  top: 25svh !important;
}

html body #root .cg-root .cg-gallery-title {
  position: absolute !important;
  left: 50% !important;
  top: 45svh !important;
  transform: translate(-50%, -50%) !important;
  width: min(80vw, 390px, 54svh) !important;
  aspect-ratio: 3.2 / 1 !important;
  container-type: inline-size;
  pointer-events: none !important;
  isolation: isolate;
  text-align: center;
  overflow: hidden;
}

html body #root .cg-root .cg-gallery-title > img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  filter: drop-shadow(0 5px 6px rgba(4, 16, 8, 0.55)) !important;
}

html body #root .cg-root .cg-gallery-title :is(h1, span) {
  position: absolute !important;
  inset: 20% 8% !important;
  display: grid;
  place-items: center;
  padding: 0;
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-size: clamp(16px, 4.8cqi, 25px) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  color: #2c1d0b !important;
  text-shadow: 0 1px 0 rgba(255, 248, 225, 0.8) !important;
}

/* Полностью скрываем любые случайные верхние кнопки-дубликаты */
html body #root .cg-root .cg-entry-cinema,
html body #root .cg-root .cg-hud-cinema,
html body #root .cg-root .cg-entry-pixel-hint {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Скрываем стартовую шторку после готовности, чтобы не было наложения текстов */
html body #root .cg-root[data-ready="true"] .cg-arrival-curtain,
html body #root .cg-arrival-curtain[data-state="open"] {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ——————————————————————————————————————————————————————
   2. ДОК ВНИЗУ И 8-БИТНАЯ СТРЕЛОЧКА К КНОПКЕ КИНОЗАЛА
   ——————————————————————————————————————————————————————— */
html body #root .cg-root[data-gallery-stage] .cg-bottom-dock {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

html body #root .cg-root[data-gallery-stage] .cg-bottom-dock > * {
  pointer-events: auto;
}

/* Кнопка «Пройти до кинозала» — красивый четкий шрифт, без искажений */
html body #root .cg-root[data-gallery-stage] .cg-dock-cinema {
  width: 198px !important;
  height: 48px !important;
  padding: 0 20px !important;
  cursor: pointer !important;
}

html body #root .cg-root[data-gallery-stage] .cg-dock-cinema > img {
  object-fit: fill !important;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.65)) !important;
}

.cg-dock-cinema-label {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-size: 14.5px !important;
  line-height: 1 !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  color: #2c1d0b !important;
  text-shadow: 0 1px 0 rgba(255, 248, 225, 0.8) !important;
  white-space: nowrap !important;
}

html body #root .cg-root[data-gallery-stage] .cg-dock-cinema svg {
  width: 15px !important;
  height: 12px !important;
  color: #2c1d0b !important;
  filter: drop-shadow(0 1px 0 rgba(255, 248, 225, 0.8)) !important;
}

/* Аккуратная 8-битная стрелочка на обоях над кнопкой «Пройти до кинозала» */
html body #root .cg-root[data-gallery-stage][data-at-entry="true"] .cg-dock-cinema[data-visible="true"]:not([data-clicked="true"])::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 22px;
  height: 26px;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 9' shape-rendering='crispEdges'%3E%3Crect x='2' y='0' width='3' height='5' fill='%23f4dca1'/%3E%3Crect x='0' y='5' width='7' height='1' fill='%23f4dca1'/%3E%3Crect x='1' y='6' width='5' height='1' fill='%23f4dca1'/%3E%3Crect x='2' y='7' width='3' height='1' fill='%23f4dca1'/%3E%3Crect x='3' y='8' width='1' height='1' fill='%23f4dca1'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 2px 5px rgba(5, 20, 8, 0.75));
  animation: cg-8bit-dock-hint 1.1s steps(2, end) infinite;
  z-index: 10;
}

@keyframes cg-8bit-dock-hint {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-7px);
  }
}

/* Стрелочка исчезает СРАЗУ при клике, шаге или открытии кинозала */
html body #root .cg-root .cg-dock-cinema[data-clicked="true"]::before,
html body #root .cg-root[data-cinema-navigated="true"] .cg-dock-cinema::before,
html body #root .cg-root:not([data-at-entry="true"]) .cg-dock-cinema::before,
html body #root .cg-root[data-transition-stage="walk"] .cg-dock-cinema::before,
html body #root .cg-root[data-transition-stage="enter"] .cg-dock-cinema::before,
html body #root .cg-root[data-cinema="true"] .cg-dock-cinema::before,
html body #root .cg-dock-cinema:active::before {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

@media (max-width: 680px) {
  html body #root .cg-root[data-gallery-stage] .cg-dock-cinema::before {
    display: none !important;
  }
}

/* ——————————————————————————————————————————————————————
   3. КИНОЗАЛ: Видео, гарантированная видимость экрана и повтор
   ——————————————————————————————————————————————————————— */
/* Экран расположен строго внутри белой проекционной зоны декоративной рамки */
html body #root .cg-root .cg-auditorium .cg-cinema-screen {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  left: 33.05% !important;
  top: 28.2% !important;
  width: 33.9% !important;
  height: 30.9% !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: #090b08 !important;
  box-shadow: 0 0 28px 6px rgba(6, 8, 5, 0.75) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Мягкая растушевка по краям видео, чтобы не врезалось грубыми стыками */
html body #root .cg-root .cg-auditorium .cg-cinema-screen .cg-film-image video {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 16px !important;
  -webkit-mask-image: 
    linear-gradient(to right, transparent 0%, rgba(0,0,0,0.5) 1%, black 3%, black 97%, rgba(0,0,0,0.5) 99%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.5) 1.5%, black 4%, black 96%, rgba(0,0,0,0.5) 98.5%, transparent 100%) !important;
  -webkit-mask-composite: source-in !important;
  mask-image: 
    linear-gradient(to right, transparent 0%, rgba(0,0,0,0.5) 1%, black 3%, black 97%, rgba(0,0,0,0.5) 99%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.5) 1.5%, black 4%, black 96%, rgba(0,0,0,0.5) 98.5%, transparent 100%) !important;
  mask-composite: intersect !important;
  cursor: pointer !important;
}

/* Полноэкранный режим */
.cg-root[data-gallery-stage] .cg-cinema-screen:fullscreen {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.cg-root[data-gallery-stage] .cg-cinema-screen:fullscreen .cg-film-image video {
  -webkit-mask-image: none !important;
  mask-image: none !important;
  border-radius: 0 !important;
}

/* Убираем грубую темную виньетку */
.cg-film-vignette {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3 !important;
  pointer-events: none !important;
  border-radius: inherit !important;
  box-shadow: none !important;
}
.cg-film-vignette::before {
  display: none !important;
}

/* Элегантная кнопка повторного показа («Посмотреть ещё раз» / «Начать показ») */
.cg-screen-play {
  position: absolute !important;
  inset: 0 !important;
  z-index: 10 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  background: rgba(4, 9, 6, 0.72) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  cursor: pointer !important;
  border: none !important;
  outline: none !important;
  pointer-events: auto !important;
  transition: opacity 0.3s ease !important;
}

.cg-screen-play span {
  display: grid !important;
  place-items: center !important;
  width: 58px !important;
  height: 58px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #f7dfa5, #c89e5a) !important;
  color: #1a2219 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 16px rgba(244, 220, 161, 0.45) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.cg-screen-play svg {
  width: 26px !important;
  height: 26px !important;
  margin-left: 3px !important;
  fill: currentColor !important;
}

.cg-screen-play b {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px 24px !important;
  background: rgba(16, 24, 18, 0.92) !important;
  border: 1px solid rgba(221, 193, 132, 0.55) !important;
  border-radius: 20px !important;
  color: #f7e8c3 !important;
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-size: 15.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.05em !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6) !important;
  margin-top: 4px !important;
  pointer-events: auto !important;
  transition: border-color 0.2s, color 0.2s !important;
}

.cg-screen-play:hover span {
  transform: scale(1.08) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.85), 0 0 24px rgba(244, 220, 161, 0.7) !important;
}

.cg-screen-play:hover b {
  border-color: rgba(244, 220, 161, 0.85) !important;
  color: #ffffff !important;
}

/* Скрываем случайную лишнюю надпись на паркете «Создать свою историю» */
.cg-cinema-contact {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* ——————————————————————————————————————————————————————
   4. ТАБЛИЧКИ ЭКСПОНАТОВ («Иллюстрация», «Классика», «Фотореализм» и т.д.)
   Компактные, не уменьшают картину, с крупным четким шрифтом
   ——————————————————————————————————————————————————————— */
html body #root .cg-root[data-gallery-stage] .cg-painting figcaption {
  position: relative !important;
  width: 175px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  isolation: isolate !important;
  margin: 8px auto 0 !important;
}

html body #root .cg-root[data-gallery-stage] .cg-painting figcaption > img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: fill !important;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.65)) !important;
}

html body #root .cg-root[data-gallery-stage] .cg-painting figcaption h2 {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  margin: 0 !important;
  padding: 0 4px !important;
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-size: 15px !important;
  line-height: 1.15 !important;
  font-weight: 500 !important;
  letter-spacing: 0.03em !important;
  color: #2c1d0b !important;
  text-shadow: 0 1px 0 rgba(255, 248, 225, 0.8) !important;
  white-space: nowrap !important;
  z-index: 1 !important;
}

/* «Бумажная аппликация» аккуратно в две строки */
html body #root .cg-root[data-gallery-stage] .cg-exhibit-paper figcaption h2 {
  font-size: 13px !important;
  white-space: normal !important;
  line-height: 1.1 !important;
}

/* ——————————————————————————————————————————————————————
   5. ДРУГИЕ РАЗДЕЛЫ: Аккуратная плашка с красивым шрифтом
   ——————————————————————————————————————————————————————— */
html body #root .cg-root .cg-directory-trigger {
  overflow: hidden !important;
  width: 184px !important;
  height: 44px !important;
  padding: 0 24px 0 20px !important;
  gap: 6px !important;
  cursor: pointer !important;
}

html body #root .cg-root .cg-directory-trigger > img {
  object-fit: fill !important;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.65)) !important;
}

html body #root .cg-root .cg-directory-trigger > span {
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-size: 13.5px !important;
  line-height: 1 !important;
  font-weight: 600 !important;
  letter-spacing: 0.03em !important;
  color: #2c1d0b !important;
  white-space: nowrap !important;
  text-shadow: 0 1px 0 rgba(255, 248, 225, 0.8) !important;
  flex: 1 1 0;
  min-width: 0;
}

html body #root .cg-root .cg-directory-trigger > svg {
  width: 14px !important;
  height: 11px !important;
  color: #2c1d0b !important;
  filter: drop-shadow(0 1px 0 rgba(255, 248, 225, 0.8)) !important;
  flex-shrink: 0 !important;
}

/* ——————————————————————————————————————————————————————
   6. ВЫВЕСКА «КИНОЗАЛ» НАД ДВЕРЬЮ: Четкая и благородная типографика
   ——————————————————————————————————————————————————————— */
.cg-root[data-gallery-wayfinding] .cg-door-title > .cg-cinema-lettering {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5% !important;
  inset: 38% 7% 17% !important;
}

.cg-cinema-lettering b {
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  font-size: clamp(16px, 2.6vw, 22px) !important;
  color: #f7e3aa !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 12px rgba(244, 220, 161, 0.35) !important;
}

.cg-cinema-lettering i {
  font-style: normal !important;
  font-size: 0.75em !important;
  color: #d8ba6f !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

.cg-root[data-gallery-stage] .cg-door-title > img {
  object-fit: contain !important;
}

/* ——————————————————————————————————————————————————————
   7. ВЫБОР ЯЗЫКА: Скрытый, органичный, без рамок и обводки при клике
   ——————————————————————————————————————————————————————— */
.gifs-language {
  opacity: 0.75 !important;
  transition: opacity 0.2s ease !important;
  position: absolute !important;
  right: 22px !important;
  top: 14px !important;
  z-index: 50 !important;
}

.gifs-language:hover {
  opacity: 1 !important;
}

.gifs-language label {
  display: none !important;
}

.gifs-language select {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  color: #e5cf9b !important;
  font-family: "GIFS Prata", "GIFS Serif", Georgia, serif !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  padding: 2px 14px 2px 4px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%23e5cf9b' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right center !important;
}

.gifs-language select:focus,
.gifs-language select:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.gifs-language select option {
  background: #111e16 !important;
  color: #f7e8c3 !important;
  font-family: sans-serif !important;
}

@media (prefers-reduced-motion: reduce) {
  html body #root .cg-root[data-gallery-stage] .cg-dock-cinema::before {
    animation: none !important;
    transform: translateX(-50%) translateY(0) !important;
  }
}
