:root {
  --bg: #060b16;
  --text: #f5f6fb;
  --muted: #c3c8d6;
  --accent: #d99a5f;
  --accent-soft: rgba(217, 154, 95, 0.26);
  --line: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Montserrat", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page-section {
  position: relative;
  min-height: 100vh;
  padding: 7rem clamp(1.2rem, 2vw, 2.4rem) 5.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
}

/* Make the ПРОЦЕС section more compact so the down-arrow stays visible */
#process.page-section {
  padding-top: 5rem;
  padding-bottom: 3.2rem;
}

#process .section-inner p {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  line-height: 1.52;
  margin-bottom: 0.8rem;
}

#process .process-list {
  margin-top: 0.8rem;
  gap: 0.55rem;
  max-width: 48rem;
}

#process .process-list li {
  margin-bottom: 0.6rem;
  font-size: 1.18rem;
  line-height: 1.48;
}

@media (max-width: 720px) {
  #process.page-section {
    padding-top: 4.2rem;
    padding-bottom: 3rem;
  }
  #process .section-inner p {
    font-size: 1.02rem;
  }
}

.hero-section {
  position: relative;
  min-height: 100vh;
  /* Use the real topbar height (set from JS) to avoid overlaps or large gaps
     between the fixed header and hero content on different viewports. */
  padding: calc(var(--topbar-height, 4.6rem) + 1rem) clamp(1.2rem, 2vw, 2.4rem) 5.5rem;
  background-image: url("best.jpg");
  background-size: cover;
  background-position: 64% center;
  isolation: isolate;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
  filter: none;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 11, 22, 0.83) 0%, rgba(6, 11, 22, 0.52) 38%, rgba(6, 11, 22, 0.26) 65%, rgba(6, 11, 22, 0.42) 100%);
  z-index: -1;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1rem clamp(1.2rem, 2vw, 2.4rem);
  background: linear-gradient(180deg, rgba(6, 11, 22, 0.88) 0%, rgba(6, 11, 22, 0.15) 100%);
  transition: padding 0.2s ease, min-height 0.2s ease, gap 0.2s ease;
}

.topbar.compact {
  padding: 0.45rem clamp(0.8rem, 2vw, 1.1rem);
  min-height: 3rem;
  gap: 0.5rem;
}

.topbar.compact .logo-mark {
  width: clamp(7.25rem, 14vw, 11rem);
}

.topbar.compact .nav {
  gap: clamp(0.5rem, 1vw, 0.9rem);
}

.brand {
  position: relative;
  z-index: 6;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.logo-mark {
  position: relative;
  z-index: 7;
  width: clamp(11rem, 24vw, 18rem);
  height: auto;
  display: block;
  mix-blend-mode: screen;
  filter: brightness(1.18) contrast(1.28) saturate(1.22)
    drop-shadow(0 0 0.45rem rgba(217, 154, 95, 0.45));
  transition: width 0.2s ease;
}

.brand-text {
  letter-spacing: 0.12em;
  font-size: clamp(1rem, 1.25vw, 1.35rem);
}

.brand-text strong {
  font-weight: 700;
}

.brand-text span {
  font-weight: 500;
  color: var(--accent);
  margin-left: 0.28rem;
}

.models-top {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 0.6rem;
}

.models-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.lightbox-caption {
  max-width: min(90vw, 900px);
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 1.8vw, 2rem);
}

.nav a {
  text-decoration: none;
  text-transform: uppercase;
  color: var(--text);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  font-weight: 500;
  opacity: 0.95;
  position: relative;
}

.nav a.active,
.nav a:hover {
  color: var(--accent);
}

.nav a.active::after,
.nav a:hover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.62rem;
  height: 2px;
  background: var(--accent);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 999px;
  cursor: pointer;
  padding: 0.55rem;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: #ffffff;
  margin: 0.34rem 0;
  transition: 0.25s ease;
}

.hero-content {
  position: relative;
  z-index: 5;
  max-width: 100%;
  width: 100%;
  padding: 0;
  transform: none; /* remove upward translation to avoid inconsistent overlap */
  margin-top: 0.25rem;
}

/* Ensure hero heading uses more horizontal space but stops before full width
   so its right edge lines up with other section content (like the gallery) */
h1 {
  max-width: 56rem;
}

.section-inner {
  width: min(72rem, 100%);
}

.simple-section {
  background: linear-gradient(180deg, #0b1324 0%, #0a1121 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.simple-section:nth-of-type(even) {
  background: linear-gradient(180deg, #0a1020 0%, #09101e 100%);
}

.simple-section h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  letter-spacing: 0.18em;
  color: var(--accent);
}

.simple-section p {
  margin: 0;
  max-width: 44rem;
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Models split: two equal vertical columns for Жилищни and Ваканционни къщи */
.models-split {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  margin-top: 1.6rem;
}

/* Stack the top bar above columns for subviews */
.models-split.stack-mode {
  flex-direction: column;
  align-items: stretch;
}

/* When showing suboptions, keep the back/top bar above a row that contains
   the two sub-section columns. This row makes the sub-sections sit
   side-by-side on wide screens but stack on small screens. */
.models-row {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  margin-top: 0.6rem;
}

.models-row .models-column {
  flex: 1 1 50%;
}

@media (max-width: 720px) {
  .models-row { flex-direction: column; }
}

.models-column {
  flex: 1 1 50%;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 0.8rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.1rem;
}

.models-column h3 {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
}

.models-column img {
  width: 100%;
  height: 18rem;
  display: block;
  object-fit: cover;
  border-radius: 0.6rem;
}

@media (max-width: 720px) {
  .models-split { flex-direction: column; }
}

/* Models grid (items for a chosen subcategory) */
.models-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.2rem;
}

@media (max-width: 980px) {
  .models-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .models-grid {
    grid-template-columns: 1fr;
  }
}

/* Scrollable wrapper for the models grid so wheel events inside the grid
   scroll the grid instead of navigating the page. Adjust max-height to
   leave room for the topbar and section heading. */
.models-grid-wrapper {
  max-height: calc(100vh - 14rem);
  overflow-y: auto;
  padding-right: 0.4rem; /* room for scrollbar */
}

.model-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 0.6rem;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.model-card img {
  width: 100%;
  height: 16.5rem;
  object-fit: cover;
  display: block;
}

.model-card .model-meta {
  padding: 0.7rem 0.85rem;
  color: var(--muted);
}

.models-column[role="button"] { cursor: pointer; }

.models-back {
  display: inline-block;
  margin-bottom: 0.8rem;
  color: var(--accent);
  cursor: pointer;
}

/* When grid-mode is active stack the top bar and grid vertically */
.models-split.grid-mode {
  flex-direction: column;
  align-items: stretch;
}

/* Make heading appear lower for the models section so it doesn't clash with topbar */
#models.page-section {
  align-items: flex-start;
  padding-top: 6.5rem;
}

/* Make contact section paragraphs wider and centered to match gallery alignment */
#contact.page-section {
  padding: 5rem clamp(1.2rem, 2vw, 2.4rem) 4rem;
}

#contact .section-inner p {
  max-width: 56rem;
  margin: 0 0 0.9rem 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.3vw, 1.15rem);
  line-height: 1.55;
  letter-spacing: 0.04em;
}

@media (max-width: 720px) {
  #contact .section-inner p {
    font-size: 0.82rem;
    line-height: 1.38;
  }
}

/* Make the contact labels match the h2 accent color */
#contact .contact-label {
  color: var(--accent);
  font-weight: 600;
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.2rem, 2vw, 1.8rem);
  margin-top: 2.5rem;
}

.package-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  min-height: 24rem;
}

.package-card h3 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  color: var(--text);
  letter-spacing: 0.08em;
}

.package-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
  flex: 1;
}

.package-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding-left: 0.25rem;
  color: var(--muted);
  line-height: 1.65;
}

.package-item::before {
  content: "";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.package-item.included {
  color: var(--text);
}

.package-item.included::before {
  content: "✓";
  background: rgba(104, 204, 117, 0.18);
  color: #68cc75;
}

/* Spacing and appearance for the ПРОЦЕС list */
.process-list {
  margin-top: 1rem;
  padding-left: 1.05rem;
  max-width: 44rem;
  color: var(--muted);
}

.process-list li {
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

/* Make the whole ПРОЦЕС section scrollable within the viewport */
#process .section-inner {
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding-right: 0.6rem; /* room for scrollbar */
}

/* Reset subsection so only the outer section scrolls */
#process .process-details {
  max-height: none;
  overflow: visible;
  margin-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.03);
  padding-top: 0.9rem;
  color: var(--muted);
}

/* Match typography and spacing of the existing ПРОЦЕС list */
#process .process-details h3,
#process .process-details h4,
#process .process-details h5 {
  color: var(--accent);
  margin: 0.45rem 0 0.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

#process .process-details ul {
  padding-left: 1.05rem;
  margin: 0.35rem 0 0.9rem;
  line-height: 1.65;
}

#process .process-details li {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 1.02rem;
}

@media (max-width: 720px) {
  #process .section-inner { max-height: calc(100vh - 6.5rem); }
}

.package-item.excluded::before {
  content: "✕";
  background: rgba(255, 97, 97, 0.16);
  color: #ff6161;
}

@media (max-width: 980px) {
  .packages-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .packages-grid {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  margin: 0 0 1.8rem;
  letter-spacing: 0.58em;
  font-size: 0.82rem;
  color: var(--text);
  position: relative;
}

.eyebrow::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 3.5rem;
  height: 2px;
  margin-left: 1rem;
  background: var(--accent);
}

h1 {
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.08;
  font-size: clamp(1.2rem, 3.6vw, 2.8rem);
}

h1 span {
  display: block;
}

h1 span:first-child {
  margin-top: 0;
}

h1 span:nth-child(2) {
  font-weight: 700;
}

h1 em {
  color: var(--accent);
  font-style: normal;
}

.subtitle {
  margin: 1.25rem 0 1.6rem;
  font-size: clamp(0.75rem, 1.0vw, 1.05rem);
  line-height: 1.18;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.subtitle::before {
  content: "";
  display: block;
  width: 4.3rem;
  height: 2px;
  margin-bottom: 1.35rem;
  background: var(--accent-soft);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  border: 2px solid var(--accent-soft);
  border-radius: 3rem;
  padding: 0.85rem 1.8rem;
  letter-spacing: 0.18em;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.cta:hover {
  background: rgba(217, 154, 95, 0.16);
  border-color: rgba(217, 154, 95, 0.55);
  transform: translateY(-1px);
}

.highlights {
  display: flex;
  gap: clamp(0.6rem, 2vw, 2.8rem);
  width: min(43rem, 100%);
  margin-top: 2.3rem;
}

.highlights article {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.72rem;
  border-left: 1px solid var(--line);
  padding-left: 1rem;
}

.highlights article:first-child {
  border-left: 0;
  padding-left: 0;
}

.icon {
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 0.88rem;
}

.highlights p {
  margin: 0;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
}

.section-next {
  position: absolute;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  width: 3rem;
  height: 3rem;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.section-next:hover {
  opacity: 1;
  transform: translateX(-50%) translateY(2px);
}

.section-next-up {
  transform: translateX(-50%) rotate(180deg);
}

.section-next-up:hover {
  transform: translateX(-50%) translateY(-2px) rotate(180deg);
}

.section-next img {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 1024px) {
  .topbar {
    align-items: flex-start;
  }

  .menu-toggle {
    display: block;
    z-index: 3;
  }

  .menu-toggle.is-open span:nth-child(1) {
    transform: translateY(0.68rem) rotate(45deg);
  }

  .menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-0.68rem) rotate(-45deg);
  }

  .nav {
    position: absolute;
    right: clamp(1rem, 2vw, 2rem);
    top: 6.2rem;
    flex-direction: column;
    align-items: flex-start;
    background: rgba(6, 11, 22, 0.94);
    border: 1px solid rgba(217, 154, 95, 0.35);
    border-radius: 0.7rem;
    padding: 1rem 1.2rem;
    min-width: 11rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.4rem);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .nav.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav a.active::after,
  .nav a:hover::after {
    display: none;
  }
}

@media (max-width: 720px) {
  .page-section,
  .hero-section {
    padding: 7.4rem 1rem 5rem;
  }

  .hero-section {
    background-position: 60% center;
  }

  .hero-content {
    max-width: 100%;
    padding: 0;
    transform: none;
  }

  .eyebrow {
    letter-spacing: 0.35em;
    font-size: 0.75rem;
  }

  .subtitle {
    letter-spacing: 0.08em;
    font-size: 0.82rem;
  }

  .cta {
    width: 100%;
    justify-content: center;
    font-size: 0.82rem;
    letter-spacing: 0.15em;
  }

  .highlights {
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.5rem;
  }

  .highlights article {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 0.7rem;
  }

  .highlights article:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .simple-section h2 {
    letter-spacing: 0.1em;
  }

  .section-next {
    width: 2.6rem;
    height: 2.6rem;
  }
}

/* Gallery grid and lightbox styles */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.gallery-scroller {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.4rem; /* allow room for scrollbar */
  overscroll-behavior: contain;
}

/* Optional custom scrollbar for WebKit */
.gallery-scroller {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: transparent transparent; /* hide by default */
}

/* WebKit scrollbar (Chrome, Edge, Safari) */
.gallery-scroller::-webkit-scrollbar {
  width: 6px;
}
.gallery-scroller::-webkit-scrollbar-track {
  background: transparent;
}
.gallery-scroller::-webkit-scrollbar-thumb {
  background: transparent; /* hidden by default */
  border-radius: 6px;
}

/* Show scrollbar when scrolling or hovering */
.gallery-scroller.scroller-scrolling::-webkit-scrollbar-thumb,
.gallery-scroller:hover::-webkit-scrollbar-thumb {
  background: rgba(217,154,95,0.32);
}

.gallery-scroller.scroller-scrolling,
.gallery-scroller:hover {
  scrollbar-color: rgba(217,154,95,0.32) transparent; /* Firefox */
}

.gallery-item {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  overflow: hidden;
  border-radius: 0.6rem;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4/3;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
  opacity: 0.98;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 11, 22, 0.75);
  z-index: 60;
}

.lightbox[aria-hidden="false"] {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: min(90vw, 1200px);
  width: 100%;
  /* remove top padding so caption sits flush with the image */
  padding: 0 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-viewport {
  width: 100%;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(0,0,0,0.45);
  color: var(--text);
  border: 0;
  padding: 0.6rem 0.85rem;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 1.25rem;
}

.lightbox-close {
  top: 0.6rem;
  right: 0.6rem;
}

.lightbox-prev {
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Caption below the image: semi-opaque blurred background and brighter text */
.lightbox-caption {
  /* no gap between image and info area */
  margin-top: 0;
  color: var(--text);
  background: rgba(6,11,22,0.75); /* slightly darker for contrast */
  backdrop-filter: blur(12px); /* stronger blur */
  -webkit-backdrop-filter: blur(12px);
  padding: 0.9rem 1rem;
  border-radius: 0.6rem;
  max-width: min(90vw, 1100px);
  width: 100%;
  box-shadow: 0 6px 22px rgba(0,0,0,0.45);
  white-space: normal;
  font-size: 0.98rem;
  line-height: 1.45;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

/* Ensure the viewport and caption are centered and the image doesn't shift */
.lightbox-viewport, .lightbox-caption { align-self: center; }

.lightbox-info-item {
  padding: 0.5rem 0.6rem;
  background: rgba(255,255,255,0.02);
  border-radius: 0.45rem;
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 980px) {
  .lightbox-caption { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .lightbox-caption { grid-template-columns: 1fr; }
  .lightbox-prev,
  .lightbox-next {
    display: block;
    top: 50%;
    width: 2.65rem;
    height: 2.65rem;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    font-size: 1.65rem;
    line-height: 1;
  }

  .lightbox-prev {
    left: 0.35rem;
  }

  .lightbox-next {
    right: 0.35rem;
  }
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }

  .lightbox-prev,
  .lightbox-next {
    display: block;
  }
}
