/* css/layout.css */

/* =========================================================
   GLOBAL - Запрет горизонтального скролла
   Карточки не выходят за границы viewport
   ========================================================= */
html, body {
  overflow-x: clip;
  max-width: 100vw;
}

/* =========================================================
   SLIDESHOWS
   ========================================================= */
.slideshow { position: relative; width: 100%; height: 100%; overflow: hidden; background: #fff; }
.slideshow img.slide, .slideshow video.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  z-index: 1;
}
.slideshow .slide.active { opacity: 1; z-index: 2; }

/* Видео карточка - обрезаем 5% снизу */
.card-video-vertical .slideshow video.slide {
  width: 100%;
  height: 105%;
  top: 0;
  left: 0;
}

/* =========================================================
   ТЕКСТОВЫЕ СЛОИ
   ========================================================= */
#constant-layer {
  position: fixed;
  top: 40vh;
  right: 5vw;
  text-align: right;
  z-index: 50;
  width: auto;
  pointer-events: none;
  opacity: 0;
  transform-origin: 100% 50%;
  will-change: transform;
}

#constant-layer.under-gallery { z-index: 1; }

.constant-text .line {
  font-family: 'Oswald', sans-serif;
  font-size: 2.6vw;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.01em;
  color: #000;
  text-transform: uppercase;
  white-space: nowrap;
}

#name-layer {
  position: fixed;
  bottom: 18vh;
  right: 3vw;
  text-align: right;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transform-origin: right bottom;
  will-change: transform;
}

#name-layer.under-gallery { z-index: 1; }

.name-title {
  font-family: 'Oswald', sans-serif;
  font-size: 3vw;
  font-weight: 600;
  color: #FF3B30;
  text-transform: uppercase;
  line-height: 1;
}

/* =========================================================
   UI КНОПКИ
   ========================================================= */
.ui-layer {
  position: fixed;
  bottom: 5vh;
  right: 3vw;
  text-align: right;
  z-index: 100;
  opacity: 0;
  color: #000;
  transform-origin: bottom right;
  pointer-events: none;
}

.ui-links {
  font-family: 'Oswald', sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  pointer-events: auto;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.link-item {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid currentColor;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.link-item:hover {
  opacity: 0.85;
}

.link-item.active {
  opacity: 1;
}

.divider { opacity: 0.35; }

/* =========================================================
   SCROLL CONTAINER
   ========================================================= */
.scroll-container { 
  position: relative; 
  z-index: 1;
  width: 100%; 
}

.scroll-container.gallery-active { z-index: 50; }

/* =========================================================
   HERO
   ========================================================= */
.hero { 
  height: 100vh; 
  width: 100%; 
  position: relative; 
  pointer-events: none; 
}

.hero-photo-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10vw;
  height: auto;
  max-height: 70vh;
  z-index: 15;
  filter: grayscale(100%) contrast(1.1);
  will-change: transform, width, left, top;
}

.hero-photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
}

/* Intro text wrapper */
.intro-text-wrapper {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.intro-block {
  position: absolute;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.intro-block-1, .intro-block-3 { top: 3vh; }
.intro-block-2, .intro-block-4 { bottom: 3vh; }

.intro-line {
  font-family: 'Oswald', sans-serif;
  font-size: 5vw;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.intro-line.red { color: #FF3B30; }
.intro-line.white { color: #FFFFFF; }

/* Первая сцена intro: чёрный фон - оба текста КРАСНЫЕ */
.intro-block-1 .intro-line,
.intro-block-2 .intro-line {
  color: #FF3B30 !important;
}

/* Вторая сцена intro: красный фон - оба текста БЕЛЫЕ */
.intro-block-3 .intro-line,
.intro-block-4 .intro-line {
  color: #FFFFFF !important;
}

.hero-title-container {
  position: absolute;
  top: 5vh;
  right: 3vw;
  text-align: right;
  width: 60vw;
  z-index: 7;
}

.hero-title {
  font-family: 'Oswald', sans-serif;
  font-size: 4.5vw;
  color: #000;
  text-transform: uppercase;
  line-height: 0.9;
  margin: 0;
  word-break: keep-all;
  overflow-wrap: normal;
}

/* Слова с кружочками не разрываются */
.hero-title .word-anim {
  white-space: nowrap;
  display: inline-block;
}

/* =========================================================
   БУКВА "О" КАК ФОТО
   ========================================================= */
.letter-o {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  overflow: hidden;
  vertical-align: baseline;
  position: relative;
  top: 0.1em;
}

.letter-o img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* =========================================================
   ДЕКОРАТИВНЫЙ СЛОЙ ELER
   ========================================================= */
.eler-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 45vw;
  height: auto;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.eler-layer img {
  width: 100%;
  height: auto;
  display: block;
}

/* =========================================================
   GALLERY
   ========================================================= */
.gallery { 
  position: relative; 
  z-index: 20; 
  padding: 0; 
}

.gallery-stage {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  background: transparent;
  overflow: clip;
  perspective: 1000px;
}

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform, opacity;
  background: #fff;
  box-shadow: 0 15px 40px rgba(0,0,0,0.12);
  /* Предотвращаем выход за границы */
  contain: layout style;
}

/* Ограничиваем максимальную ширину карточек */
.card-small { width: min(16vw, 45vw); aspect-ratio: 3/4; }
.card-large { width: min(34vw, 90vw); aspect-ratio: 16/9; }
.card-vertical { width: min(18vw, 50vw); aspect-ratio: 9/16; }
.card-horizontal { width: min(26vw, 70vw); aspect-ratio: 4/3; }
.card-video-vertical { width: min(18vw, 50vw); aspect-ratio: 9/16; } /* Instagram Reels формат */

.footer { height: 25vh; background: #fff; }
.footer-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; }
.footer-copy { font-size: 12px; color: rgba(0,0,0,0.5); letter-spacing: 0.02em; }
.footer-credit { font-size: 10px; color: rgba(0,0,0,0.35); }
.footer-credit a { color: rgba(0,0,0,0.35); text-decoration: none; transition: opacity 0.2s ease; }
.footer-credit a:hover { opacity: 0.7; }

.mobile-footer { display: none; }
.eler-mobile-bg { display: none; }

/* =========================================================
   ЯЗЫКОВАЯ ПАНЕЛЬ
   ========================================================= */
.lang-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #000;
  z-index: 150;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.lang-panel.open { pointer-events: auto; }

.lang-panel-inner {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lang-panel-inner::-webkit-scrollbar {
  display: none;
}

.lang-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.lang-item:hover {
  opacity: 0.7;
}

.lang-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
  transition: transform 0.3s ease;
}

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

.lang-name {
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: #FFF;
  text-transform: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Desktop - центрирование если помещается, hover +100% */
/* ТОЛЬКО для устройств с мышью/трекпадом */
@media (min-width: 1200px) and (hover: hover) and (pointer: fine) {
  .lang-panel-inner {
    justify-content: center;
    gap: 24px;
    padding: 24px 32px;
    overflow-x: visible;
  }
  
  .lang-item:hover .lang-avatar {
    transform: scale(2);
  }
  
  .lang-avatar {
    width: 44px;
    height: 44px;
  }
  
  .lang-name {
    font-size: 10px;
  }
}

/* Tablet (НЕ touch) - скролл */
@media (min-width: 768px) and (max-width: 1199px) and (hover: hover) and (pointer: fine) {
  .lang-panel-inner {
    gap: 20px;
    padding: 20px 24px;
  }
  
  .lang-avatar {
    width: 40px;
    height: 40px;
  }
  
  .lang-item:hover .lang-avatar {
    transform: scale(1.5);
  }
}

/* =========================================================
   RTL SUPPORT (Arabic, Hebrew)
   Зеркальное отображение intro и hero
   ========================================================= */
body.rtl {
  direction: rtl;
}

body.rtl .constant-text {
  text-align: left;
}

body.rtl #constant-layer {
  right: auto;
  left: 5vw;
  text-align: left;
}

body.rtl #name-layer {
  right: auto;
  left: 3vw;
  text-align: left;
}

body.rtl .ui-layer {
  right: auto;
  left: 3vw;
  text-align: left;
}

body.rtl .ui-links {
  flex-direction: row-reverse;
}

body.rtl .hero-title-container {
  right: auto;
  left: 3vw;
  text-align: left;
}

/* RTL: intro блоки - зеркально */
body.rtl .intro-block {
  direction: rtl;
}

body.rtl .intro-line {
  direction: rtl;
}
@media (max-width: 768px) {
  .hero-photo-wrapper { width: 30vw; }
  .hero-title { font-size: 8vw; }
  .name-title { font-size: 5vw; }
  .constant-text .line { font-size: 4.5vw; }
  #name-layer { bottom: 20vh; right: 3vw; }
  .ui-links { font-size: 1rem; gap: 12px; }
  .link-item { border-bottom-width: 1.5px; }
  .card-small { width: 55vw; }
  .card-large { width: 75vw; }
  .card-vertical { width: 60vw; }
  .card-horizontal { width: 70vw; }
  .intro-block-1, .intro-block-3 { top: 5vh; }
  .intro-block-2, .intro-block-4 { bottom: 5vh; }
}
