/* Reset */
* {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

/* Fonts */
@font-face {
  font-family: 'PixeloidSans';
  src: url('../fonts/PixeloidSans.woff2') format('woff2'),
       url('../fonts/PixeloidSans.woff') format('woff');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'PixeloidSans';
  src: url('../fonts/PixeloidSans-Bold.woff2') format('woff2'),
       url('../fonts/PixeloidSans-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: 'PixeloidMono';
  src: url('../fonts/PixeloidMono.woff2') format('woff2'),
       url('../fonts/PixeloidMono.woff') format('woff');
  font-weight: 400;
  font-style: normal;
}

/* Base styles */
body {
  font-family: 'PixeloidSans';
  background-color: rgb(130, 81, 20);
  color: #F5DEB3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: rgb(168, 106, 29);
  margin: 10px 10px 0;
  border: 2px solid #5D3A1A;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  min-height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  width: 100%;
}
.h1 {
  font-family: 'PixeloidMono';
  font-size: clamp(18px, 4vw, 22px);
}

.ava {
  width: clamp(40px, 12vw, 48px);
  height: clamp(40px, 12vw, 48px);
}

.ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.main_container {
  flex: 1;
  display: flex;
  position: relative;
  border: 2px solid #5D3A1A;
  margin: 10px;
  min-height: 0; /* ⛔ важно для вложенных flex-children */
}

/* Navigation */
.nav_section {
  border-right: 2px solid #5D3A1A;
  padding: 15px;
  width: clamp(160px, 18vw, 200px);
  background-color: rgb(155, 97, 27);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.nav-button {
  background-color: #45a049;
  border: 2px solid #5D3A1A;
  color: #F5DEB3;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  font-size: clamp(12px, 2.5vw, 16px);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 180px;
  margin: 0 auto;
  border-radius: 0px;
}

/* Активная кнопка */
.nav-button.active {
  background-color: #2d662f;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-button:hover {
  background-color: #3a8a3d;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.nav-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Main content */
.main_section {
  flex: 1;
  display: flex;
  min-height: 0;
  background-color: #715432;
  padding: 115px 15px 15px;
  overflow: hidden;
  position: relative;
}

.main_section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.main_section.light-on::before {
  opacity: 0;
}

.content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0; /* ✅ добавлено */
  padding: 0px 15px 15px;
  opacity: 0;
  transform: translateX(-110%);
  transition: all 0.7s ease;
  display: none;
  overflow-y: auto; /* ✅ прокрутка при переполнении */
}


.content.active {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

.content.leaving {
  transform: translateX(110%);
  opacity: 0;
}

/* Gallery */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
}

.gallery img {
  border: 2px solid #5D3A1A;
  transition: transform 0.3s ease;
  max-width: 100%;
}

/* Лампочка */
.lamp-container {
  position: absolute;
  top: 0px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.lamp-bulb {
  width: 100px;
  height: 100px;
  background: url('../imgs/lamp-sprite.png') no-repeat;
  background-size: 200px 100px;
  background-position: 0 0;
}

.lamp-bulb.on {
  background-position: -100px 0;
  filter: drop-shadow(0 0 10px yellow);
}

/* Right panel */
.right_section {
  border-left: 2px solid #5D3A1A;
  width: clamp(160px, 18vw, 200px);
  background-color: rgb(155, 97, 27);
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Tumbler styles */
.tumbler-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tumbler {
  width: clamp(120px, 20vw, 180px);
  height: clamp(120px, 20vw, 180px);
  background-image: url('../imgs/tumbler.png');
  background-size: 720px 180px;
  background-position: -540px 0;
  cursor: pointer;
  transition: background-position 0.3s steps(3);
  margin: 5px 0;
}

.tumbler.on {
  background-position: 0 0;
}

.tumbler-plate {
  background-color: silver;
  color: #333;
  padding: 5px;
  font-family: 'PixeloidMono';
  font-size: 14px;
  border: 2px solid #5D3A1A;
  text-align: center;
  width: 100px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tumbler-plate.active {
  background-color: #c0c0c0;
  font-weight: bold;
}

.tumbler-plate.on-label.active {
  font-weight: bold;
}

.tumbler-plate.off-label.active {
  font-weight: bold;
}

.tumbler-plate.on-label {
  order: 1;
}

.tumbler {
  order: 2;
}

.tumbler-plate.off-label {
  order: 3;
}

/* Footer */
.footer {
  margin: 0 10px 10px;
  height: 60px;
  background-color: rgb(155, 97, 27);
  border: 2px solid #5D3A1A;
  display: flex;
  justify-content: center;
  align-items: center;
}
.footer p {
  text-align: center;
  width: 100%;
  
}
.footer a {
  text-decoration: none;
  color: #e4c38b;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: #f5decb;
}

.footer a:visited {
  color: #e4c38b;
}

.social-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  align-items: flex-start; /* если хочешь, чтобы всё было влево */
}

.social-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.social-label {
  font-family: 'PixeloidMono';
  font-size: 14px;
  color: #F5DEB3;
  text-align: left;
}

/* Иконки */
.icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  background-size: 40px 40px;
  display: inline-block;
}

/* Фоны подставь правильные PNG, если уже есть */
.vk {
  background-image: url('/imgs/vk.png');
}

.youtube {
  background-image: url('/imgs/yt.png');
}

.telegram {
  background-image: url('/imgs/tel.png');
}



/* Контент */
#contentContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  z-index: 2;
  line-height: 1.5;
  color: #F5DEB3;
  transition: filter 0.5s ease;
}

.main_section:not(.light-on) #contentContainer {
  filter: brightness(0.5);
}

/* Кастомный скролл-бар только для центральной секции */
#contentContainer {
  overflow-y: auto; /* включает вертикальную прокрутку только если нужно */
}

/* Стилизация полосы прокрутки для WebKit-браузеров (Chrome, Яндекс.Браузер, Safari и т.п.) */
#contentContainer::-webkit-scrollbar {
  width: 12px; /* ширина скроллбара */
}

#contentContainer::-webkit-scrollbar-track {
  background: rgb(155, 97, 27); /* фон дорожки (соответствует боковым панелям) */
  border-left: 2px solid #5D3A1A; /* бортик слева */
}

#contentContainer::-webkit-scrollbar-thumb {
  background-color: #45a049; /* цвет бегунка, как у кнопок */
  border: 2px solid #5D3A1A; /* бортик бегунка */
  border-radius: 0; /* пиксельный стиль */
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); /* тень, аналогичная кнопкам */
}

/* Стилизация полосы прокрутки для Firefox */
#contentContainer {
  scrollbar-width: thin;
  scrollbar-color: #45a049 rgb(155, 97, 27);
}
/* Burger menu */
.burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: clamp(28px, 8vw, 32px);
  height: clamp(20px, 6vw, 24px);
  cursor: pointer;
}

.burger-line {
  display: block;
  height: clamp(2px, 0.6vw, 3px);
  width: 100%;
  background-color: #F5DEB3;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  border-radius: 2px;
}

.burger.active .burger-line:nth-child(1) {
  transform: translateY(clamp(9px, 2.8vw, 11px)) rotate(45deg);
}

.burger.active .burger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.burger.active .burger-line:nth-child(3) {
  transform: translateY(clamp(-9px, -2.8vw, -11px)) rotate(-45deg);
}

/* Responsive */
@media (max-width: 768px) {
  .burger {
    display: flex;
  }

  .main_container {
    
    flex-direction: column;
    position: relative; /* ВАЖНО: позволяет .nav_section быть абсолютной */
  }

  .nav_section {
    position: absolute;
    top: 0; /* начинается встык с main_container */
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(155, 97, 27);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition:
      transform 1.2s cubic-bezier(0.77, 0, 0.175, 1),
      opacity 1.2s ease;
    z-index: 10;
  }

  .nav_section.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }


  .nav_section,
  .right_section {
    width: 100%;
    border: none;
    border-bottom: 2px solid #5D3A1A;
  }

  .nav-list {
    gap: 30px;
  }

  .nav-button {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.8s ease, opacity 0.8s ease;
  }

  .nav_section.active .nav-button {
    transform: translateY(0);
    opacity: 1;
  }
}


/* Контакты адаптация */
.social-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  align-items: flex-start;
}

.social-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-wrap: nowrap;
}

.social-label {
  font-family: 'PixeloidMono';
  font-size: 14px;
  color: #F5DEB3;
  text-align: left;
  flex: 1;
  overflow-wrap: break-word;
}

.icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  flex-shrink: 0;
  image-rendering: pixelated;
  background-size: 40px 40px;
  display: inline-block;
}

.vk {
  background-image: url('/imgs/vk.png');
}

.youtube {
  background-image: url('/imgs/yt.png');
}

.telegram {
  background-image: url('/imgs/tel.png');
}

@media (max-width: 768px) {
  .social-block {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .social-label {
    margin-top: 5px;
    text-align: left;
    width: 100%;
  }
}

.style-switch {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none; /* чтобы не перекрывал остальной контент */
}

.style-label {
  font-family: 'PixeloidMono';
  font-size: 16px;
  color: #F5DEB3;
  margin-bottom: 4px;
  pointer-events: auto;
}

.tile-button {
  width:128px;
  height: 128px;
  background-image: url('/imgs/tile.png');
  background-size: cover;
  background-repeat: no-repeat;
  filter: brightness(0.4); /* затемнено по умолчанию */
  transition: filter 0.3s ease, transform 0.3s ease;
  border: none;
  outline: none;
  cursor: pointer;
  display: block;
  margin: 0 auto;
}

.tile-button:hover {
  filter: brightness(1.2); /* подсветка при наведении */
  transform: scale(1.1);   /* увеличение */
}

.tile-wrapper {
  margin-top: 30px; /* отступ сверху от телеги */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: auto;
  gap: 10px; /* расстояние между надписью и кнопкой */
}

.tile-hint {
  font-family: 'PixeloidMono';
  font-size: 16px;
  color: #F5DEB3;
  text-align: center;
  text-shadow: 1px 1px 2px black;
}

.tile-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 40px;
  margin-top: 30px;
  padding-left: 15px;
}

.tile-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center; /* центрируем и текст, и тайл */
  gap: 10px;
}

.tile-hint {
  font-family: 'PixeloidMono';
  font-size: 13px; /* 🔽 уменьшено с 16px */
  color: #F5DEB3;
  text-shadow: 1px 1px 2px black;
  text-align: center;
  width: 128px;
  line-height: 1.1; /* чуть плотнее, если всё-таки будет перенос */
  word-break: break-word; /* на всякий случай */
}

.tile-button {
  width: 128px;
  height: 128px;
  background-image: url('/imgs/tile.png');
  background-size: cover;
  background-repeat: no-repeat;
  filter: brightness(0.4);
  transition: filter 0.3s ease, transform 0.3s ease;
  border: none;
  outline: none;
  cursor: pointer;
}

.tile-button:hover {
  filter: brightness(1.2);
  transform: scale(1.1);
}

.tile-button-second {
  background-image: url('/imgs/tile2.png');
}

body.tile-theme header,
body.tile-theme .footer {
  background-image: url('/imgs/tile.png');
  background-repeat: repeat;
  background-size: 128px 128px;
  background-color: transparent;
  position: relative;
  z-index: 0;
}

body.tile-theme header *,
body.tile-theme .footer * {
  position: relative;
  z-index: 1;
}

body.tile-theme-side .nav_section,
body.tile-theme-side .right_section {
  background-image: url('/imgs/tile2.png');
  background-repeat: repeat;
  background-size: 128px 128px;
  background-color: transparent;
  position: relative;
  z-index: 0;
}

body.tile-theme-side .nav_section *,
body.tile-theme-side .right_section * {
  position: relative;
  z-index: 1;
}

/* Повышаем яркость текста в хедере и футере при включении тайл-стены */
body.tile-theme header,
body.tile-theme .footer {
  color: #fffde0;
}

body.tile-theme header a,
body.tile-theme .footer a {
  color: #fffde0;
}

body.tile-theme header a:hover,
body.tile-theme .footer a:hover {
  color: #ffffff;
}

body.tile-theme header *,
body.tile-theme .footer * {
  text-shadow: 1px 1px 2px #000000;
}
/* Повышаем яркость текста и кнопок в боковых панелях при активации второго тайла */
body.tile-theme-side .nav_section,
body.tile-theme-side .right_section {
  color: #fffde0;
}

body.tile-theme-side .nav_section *,
body.tile-theme-side .right_section * {
  color: #fffde0;
  text-shadow: 1px 1px 2px #000000;
}

/* Активная навигационная кнопка — тоже ярче */
body.tile-theme-side .nav-button,
body.tile-theme-side .tumbler-plate {
  color: #fffde0;
  border-color: #d2b27a;
}

body.tile-theme-side .nav-button:hover {
  background-color: #3a8a3d;
}

/* Контейнер, который будет уезжать влево */
.sprite-container {
  position: fixed;
  right: 15px;
  bottom: 120px;
  width: 180px;
  height: 180px;
  z-index: 1000;
  pointer-events: none;
}

.sprite-animation.hidden {
  opacity: 0;
  pointer-events: none;
}
/* Спрайт — только первый кадр по умолчанию */
.sprite-animation {
  width: 256px;
  height: 256px;
  background-image: url('../imgs/1_sprite_map.png');
  background-repeat: no-repeat;
  background-position: 0 0;
  image-rendering: pixelated;

  animation-name: playSpriteLoop;
  animation-duration: 1s;
  animation-timing-function: steps(9);
  animation-fill-mode: forwards;
  animation-play-state: paused; /* ⏸ по умолчанию */
}


/* Кадровая анимация */
@keyframes playSpriteLoop {
  from { background-position: -2304px 0; } /* последний кадр */
  to   { background-position: 0 0; }       /* первый кадр */
}

/* Анимация перемещения влево (очень длинная) */
@keyframes moveRight {
  0%   { transform: translateX(0); }
  100% { transform: translateX(15px); }
}

/* При активации света */
.sprite-animation.playing {
  animation: playSpriteLoop 1s steps(9) forwards;
}

.sprite-container.moving {
  animation: moveRight 1s linear forwards;
}


@keyframes playSpriteReverse {
  from { background-position: 0 0; }
  to   { background-position: -2304px 0; }
}

@keyframes moveLeft {
  0%   { transform: translateX(15px); }
  100% { transform: translateX(0); }
}

.sprite-animation.reverse {
  animation: playSpriteReverse 1s steps(9) forwards;
}

.sprite-container.returning {
  animation: moveLeft 1s linear forwards;
}



/* Мобильная адаптация тумблера и правой секции */
@media (max-width: 768px) {
  .right_section {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    gap: 20px;
    padding: 10px;
    border-top: 2px solid #5D3A1A;
    border-left: none;
  }

  .tumbler-wrapper {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 0;
  }

  .tumbler {
    transform: rotate(-90deg);
    transform-origin: center;
    width: 120px;
    height: 120px;
    background-size: 480px 120px; /* подогнано под новый размер */
    background-position: -360px 0; /* off-состояние */
  }

  .tumbler.on {
    background-position: 0 0;
  }

  .tumbler-plate {
    width: auto;
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .tumbler-plate.on-label {
    order: 0;
  }

  .tumbler {
    order: 1;
  }

  .tumbler-plate.off-label {
    order: 2;
  }
}
@media (max-width: 768px) {
  body.tile-theme-side .nav_section,
  body.tile-theme-side .right_section {
    background-image: url('/imgs/tile2.png');
    background-repeat: repeat;
    background-size: 128px 128px;
    background-color: transparent;
  }

  body.tile-theme-side .nav_section *,
  body.tile-theme-side .right_section * {
    color: #fffde0;
    text-shadow: 1px 1px 2px #000000;
  }

  body.tile-theme-side .nav-button,
  body.tile-theme-side .tumbler-plate {
    color: #fffde0;
    border-color: #d2b27a;
  }

  body.tile-theme-side .nav-button:hover {
    background-color: #3a8a3d;
  }
}
@media (max-width: 768px) {
  .main_container {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    position: relative;
  }

  .nav_section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.7s ease, opacity 0.5s ease;
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .nav_section.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* при tile-theme-side не ломаем nav_section */
  body.tile-theme-side .nav_section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/imgs/tile2.png');
    background-size: 128px 128px;
    background-repeat: repeat;
    background-color: transparent;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }

  body.tile-theme-side .nav_section.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

/* 🔒 Блокировка landscape-режима для телефонов и планшетов */
@media screen and (orientation: landscape) and (max-width: 1024px) {
  body::before {
    content: "Пожалуйста, поверните устройство вертикально 🙃";
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fffde0;
    font-family: 'PixeloidMono';
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    text-align: center;
    padding: 20px;
    line-height: 1.5;
  }

  body > * {
    display: none !important;
  }
}

