/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* overflow-x MUST be on both html AND body — body alone doesn't stop the root viewport from scrolling */
html {
  overflow-x: hidden;
}

body {
  font-family: 'Quicksand', sans-serif;
  background-color: #f2ede6;
  color: #2b2b2b;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(242, 237, 230, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  transition: height 0.3s ease, background 0.3s ease;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header.scrolled {
  height: 70px;
  background: rgba(242, 237, 230, 0.97);
}

.logo {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.logo img {
  padding-top: 30px;
  height: 200px;
  width: auto;
  /* Prevent logo from being wider than the screen (the root cause of horizontal scroll) */
  max-width: calc(100vw - 80px);
  display: block;
  transition: height 0.3s ease, padding-top 0.3s ease;
}

.header.scrolled .logo img {
  padding-top: 10px;
  height: 120px;
  max-width: calc(100vw - 80px);
}

/* ============================================================
   HAMBURGER
   ============================================================ */
.hamburger {
  position: fixed;
  right: 20px;
  top: 20px;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 99999;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.3s ease;
  isolation: isolate;
  background: none;
  border: none;
  padding: 0;
}

.hamburger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #2b2b2b;
  transform-origin: center;
  transition:
    width     0.35s cubic-bezier(0.76, 0, 0.24, 1),
    transform 0.45s cubic-bezier(0.76, 0, 0.24, 1),
    opacity   0.3s ease,
    background 0.3s ease;
}

.hamburger span:nth-child(1) { width: 24px; }
.hamburger span:nth-child(2) { width: 16px; }
.hamburger span:nth-child(3) { width: 24px; }

.hamburger.active span              { background: #fff !important; }
.hamburger.active span:nth-child(1) { width: 22px; transform: translateY(7px)  rotate(45deg); }
.hamburger.active span:nth-child(2) { width: 0;    opacity: 0; }
.hamburger.active span:nth-child(3) { width: 22px; transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   OVERLAY MENU
   ============================================================ */
.menu-overlay {
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  top: 0; right: 0;
  width: min(260px, 80vw);
  height: 100%;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  padding-top: 100px;
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  z-index: 2150;
}

.menu-overlay.active {
  transform: translateX(0);
  opacity: 1;
}

.menu-link {
  color: rgba(238,238,238,0.7);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 18px 30px;
  min-height: 56px;
  display: flex;
  align-items: center;
  transition: background 0.2s ease, color 0.2s ease, letter-spacing 0.2s ease;
}

.menu-link:hover        { background: #2a2a2a; color: #fff; letter-spacing: 0.18em; }
.menu-link.active       { color: #fff; }

#menuDim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2140;
}
#menuDim.active { display: block; }

/* ============================================================
   GALLERY
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 20px 5%;
  margin-top: 90px;
  position: relative;
  z-index: 1;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  cursor: default;
  aspect-ratio: 4/3;
  background: #111;
}

.gallery-item img.day,
.gallery-item img.night {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  transition: opacity 0.8s ease, transform 0.5s ease;
}

.gallery-item img.night {
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
}

.gallery-item:hover img.day   { opacity: 0; transform: scale(1.05); }
.gallery-item:hover img.night { opacity: 1; transform: scale(1.05); }

/* Tap hint (mobile) */
.tap-hint {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.85);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
  white-space: nowrap;
  z-index: 4;
  animation: fadeIn 0.5s 1s ease both, fadeOut 0.5s 4s ease forwards;
  pointer-events: none;
}
@keyframes fadeIn  { from{opacity:0} to{opacity:1} }
@keyframes fadeOut { to{opacity:0} }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5000;
  cursor: zoom-out;
  padding: 20px;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 4px;
  object-fit: contain;
}

/* ============================================================
   STANOVI BUTTON
   ============================================================ */
#pageWrapper {
  -webkit-tap-highlight-color: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 20px 16px;
}

.btn-apartments {
  display: inline-block;
  margin: 60px auto;
  font-family: 'Playfair Display', serif;
  font-weight: 500;
  font-size: clamp(1rem, 3vw, 1.4rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  padding: clamp(14px, 3vw, 22px) clamp(36px, 8vw, 70px);
  background: rgb(0, 107, 93);
  color: #ffffff;
  transition: background 0.4s ease, color 0.4s ease, transform 0.3s ease;
  border: 2px solid rgb(0, 107, 93);
}

.btn-apartments:hover {
  background: transparent;
  color: #1c1c1c;
  transform: translateY(-2px);
}

/* ============================================================
   FLOOR SELECTOR MODAL
   ============================================================ */
.modal {
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 4000;
  padding: 20px;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #f5f1eb;
  padding: clamp(40px, 6vw, 80px) clamp(24px, 5vw, 70px);
  width: min(500px, 100%);
  box-shadow: 0 60px 140px rgba(0, 0, 0, 0.25);
  transform: translateY(40px);
  transition: transform 0.5s ease;
  position: relative;
  border-radius: 4px;
}

.modal.active .modal-content { transform: translateY(0); }

.close-modal {
  position: absolute;
  top: 16px; right: 24px;
  font-size: 28px;
  cursor: pointer;
  color: #2b2b2b;
  line-height: 1;
  padding: 8px;
  transition: opacity 0.2s;
}
.close-modal:hover { opacity: 0.6; }

/* ============================================================
   FLOOR LIST
   ============================================================ */
.floor-list {
  list-style: none;
  margin-top: 20px;
  padding: 0;
  font-family: 'Quicksand', sans-serif;
}

.floor-list li {
  padding: 18px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: padding-left 0.3s ease, color 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
}

.floor-list li:last-child { border-bottom: none; }
.floor-list li:hover  { padding-left: 15px; color: #006b5d; }
.floor-list li:active { opacity: 0.7; }
.floor-num { font-size: 0.75rem; color: #999; font-weight: 600; }

/* ============================================================
   CONTACT INFO
   ============================================================ */
.contact-info {
  text-align: center;
  padding: 60px 10%;
  color: #666;
  background: rgba(0, 0, 0, 0.04);
  line-height: 2;
}

.contact-info a {
  color: #006b5d;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}
.contact-info a:hover { opacity: 0.75; }

/* ============================================================
   APARTMENTS PAGE
   ============================================================ */
.apartments-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 5% 60px;
  font-family: 'Quicksand', sans-serif;
  color: #2b2b2b;
  line-height: 1.6;
}

.apartments-page .floor {
  position: relative;
  margin-bottom: 60px;
  padding: 40px;
  background: #fffaf5;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.08);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
  /* min-width: 0 prevents the flex/grid child from overflowing its container */
  min-width: 0;
  overflow: hidden; /* clip any horizontal gallery overflow from leaking to page */
}

.apartments-page .floor:hover {
  transform: translateY(-4px);
  box-shadow: 0 35px 80px rgba(0, 0, 0, 0.12);
}

.apartments-page .floor h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 20px;
  color: #006b5d;
  letter-spacing: 1px;
}

.apartments-page .floor p {
  font-size: 0.95rem;
  margin-bottom: 16px;
  color: #3a3a3a;
}

/* Floor gallery — horizontal scroll */
.floor-gallery.mobile-scroll {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,107,93,0.3) transparent;
}
.floor-gallery.mobile-scroll::-webkit-scrollbar { height: 4px; }
.floor-gallery.mobile-scroll::-webkit-scrollbar-thumb { background: rgba(0,107,93,0.3); border-radius: 4px; }

.floor-gallery.mobile-scroll img {
  flex: 0 0 auto;
  width: clamp(220px, 35vw, 320px);
  height: 220px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.floor-gallery.mobile-scroll img:hover {
  transform: scale(1.03);
  filter: brightness(1.05);
}

:target { scroll-margin-top: 110px; }

/* ============================================================
   FOCUS / ACCESSIBILITY
   ============================================================ */
a:focus-visible, button:focus-visible {
  outline: 2px solid #006b5d;
  outline-offset: 3px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {

  .gallery {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .gallery-item { aspect-ratio: 16/10; }

  /* Modal slides up from bottom on mobile */
  .modal { align-items: flex-end; padding: 0; }
  .modal-content {
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 40px 24px 32px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .modal.active .modal-content { transform: translateY(0); }

  .apartments-page { padding: 100px 4% 40px; }
  .apartments-page .floor { padding: 24px 20px; margin-bottom: 32px; }
  .floor-gallery.mobile-scroll img { height: 180px; }
}

@media (max-width: 480px) {
  .header { height: 70px; }
  .logo img { height: 140px; padding-top: 20px; max-width: calc(100vw - 70px); }
  .header.scrolled .logo img { height: 90px; padding-top: 8px; max-width: calc(100vw - 70px); }
  .gallery { padding: 12px 4%; margin-top: 70px; }
  .contact-info { padding: 40px 6%; }
}
