@font-face {
  font-family: 'StackSans';
  src: url('./fonts/StackSansText-Regular.ttf');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

html {
  scrollbar-gutter: stable;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1rem;

  font-family: 'StackSans', sans-serif;
}

.bottom-box {
  width: min(100%, 65rem);
  padding: 1rem;
  border: 1px solid #ccc;
  background-color: #f5f5f5;
  color: #222;
  text-align: center;
  margin: auto auto 0;

  font-family: 'StackSans', sans-serif;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #fff;
  flex-wrap: wrap;
  font-size: clamp(1rem, 2.5vw, 1.125rem);
}

.left {
  display: flex;
  gap: 20px;
}

.right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* Style the language switcher container */
.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
}

/* Style the labels to look like clickable buttons */
.language-switcher label.lang {
  cursor: pointer;
  text-decoration: none;
  color: #222;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
}

.language-switcher label.lang:hover {
  background-color: #ddd;
}

.language-switcher .separator {
  color: #888;
  font-size: 0.8rem;
}

/* Visually highlight whichever label belongs to the checked radio */
#lang-en:checked ~ .menu label[for="lang-en"],
#lang-pl:checked ~ .menu label[for="lang-pl"],
#lang-ua:checked ~ .menu label[for="lang-ua"] {
  background-color: #222;
  color: #fff;
}

/* Style the Contact link */
.right .contact-link {
  text-decoration: none;
  color: #222;
  font-weight: 500;
}

.right .contact-link:hover {
  color: #4600ce;
  text-decoration: none;
}

/* Hide the actual radio inputs */
input[type="radio"] {
  display: none;
}

/* --- LANGUAGE CONTENT SWITCHING LOGIC --- */
/* 1. Hide ALL language blocks globally by default */
.lang-en,
.lang-pl,
.lang-ua {
  display: none;
}

/* 2. Show ONLY the active language anywhere on the page */
#lang-en:checked ~ * .lang-en,
#lang-en:checked ~ .lang-en {
  display: block;
}

#lang-pl:checked ~ * .lang-pl,
#lang-pl:checked ~ .lang-pl {
  display: block;
}

#lang-ua:checked ~ * .lang-ua,
#lang-ua:checked ~ .lang-ua {
  display: block;
}

/* --- END LANGUAGE SWITCHING --- */

.menu a {
  color: #222;
  text-decoration: none;
}

.menu a:hover {
  color: #4600ce;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  width: min(100%, 80rem);
  margin: 0 auto;
  padding: 0.5rem;
  flex: 1;
}

.card {
  min-height: 350px;
  max-width: 100%;
  padding: 0.5rem;
  background: #f5f5f5;
  border: 1px solid #ccc;
  color: #222;
  font-family: 'StackSans', sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


.card-media {
  background-color: #e0e0e0;
  aspect-ratio: var(--aspect-ratio, 16 / 9);
  min-height: var(--media-min-height, 150px);
  flex-shrink: 0;
}

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

.card-content {
  padding: 0.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.description {
  margin: 0;
  text-align: left;
}

/* ==========================================
   CAROUSEL PAGE STYLES
   ========================================== */

/* Контейнер каруселі на всю ширину */
.carousel-container {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 1rem 0;
  overflow: hidden;
}

/* Трек зі скролом */
.carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  /* Висота каруселі: обчислюється від висоти екрана мінус меню та відступи */
  height: clamp(400px, 75vh, 850px);
  padding: 0 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Приховуємо стандартну смугу прокрутки (Scrollbar) для охайного вигляду */
.carousel-track::-webkit-scrollbar {
  height: 6px;
}
.carousel-track::-webkit-scrollbar-track {
  background: #f5f5f5;
}
.carousel-track::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* Окремий стовпчик каруселі */
.carousel-column {
  height: 100%;
  flex-shrink: 0;
  display: flex;
  scroll-snap-align: start;
}

/* 1. Стовпчик з одним фото на всю висоту (автоматично розраховує ширину) */
.carousel-column.col-full {
  flex-direction: column;
}

.carousel-column.col-full .carousel-item {
  height: 100%;
  /* Ширина дорівнює висоті * співвідношення сторін (aspect-ratio) */
  aspect-ratio: var(--aspect-ratio, 4 / 5);
}

/* 2. Стовпчик з 2 фотографіями одна над одною */
.carousel-column.col-stacked {
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.carousel-column.col-stacked .carousel-item {
  /* Кожне фото займає 50% висоти мінус половина відступу (gap) */
  height: calc(50% - 0.5rem);
  aspect-ratio: var(--aspect-ratio, 164 / 100);
}

/* Картка фотографії в каруселі */
.carousel-item {
  background-color: #e0e0e0;
  position: relative;
  overflow: hidden;
}

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

/* Mobile Layout (1 Column for screens up to 768px wide) */
@media (max-width: 768px) {
  .menu {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .right {
    width: 100%;
    justify-content: space-between;
  }
  .gallery {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .card {
    width: 100%;
  }

  .carousel-track {
    height: 60vh;
    gap: 0.5rem;
  }
  .carousel-column.col-stacked {
    gap: 0.5rem;
  }
  .carousel-column.col-stacked .carousel-item {
    height: calc(50% - 0.25rem);
  }
}

.back-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  
  background: rgba(34, 34, 34, 0.85);
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-family: 'StackSans', sans-serif;
  font-size: 0.9rem;
  
  /* Підтримка наявних зон безпеки на iPhone (для визрізу/челки/Dynamic Island) */
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  
  backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}
