body {
  font-family: 'Segoe UI', 'Arial', sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  background: #f6f5f2;
  color: #222;
}
header {
  position: relative;
  background: url('placeholder-hero.jpg') center/cover no-repeat;
  color: #fff;
  padding-top: 4rem;
  padding-bottom: 4rem;
  border-radius: 0 !important;
  overflow: hidden;
  padding-left: 2rem;   /* added */
  padding-right: 2rem;  /* added */
}
header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(30, 30, 30, 0.55);
  z-index: 0;
}
header > * {
  position: relative;
  z-index: 1;
}
h1 {
  font-size: 2.5em;
  margin-bottom: 0.3em;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  text-align: center;
  line-height: 1.18;
  white-space: pre-line;
}
h2 {
  color: #d97742;
  font-size: 1.5em;
  margin-top: 0;
  margin-bottom: 0.7em;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: none;
}
nav a {
  color: #fff;
  text-decoration: none;
  margin: 0 0.7em;
  font-weight: 500;
  transition: color 0.2s;
}
nav a:hover {
  color: #ffd180;
}
section.property {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px 0 rgba(60, 60, 60, 0.07);
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
  padding: 0rem; /* keep zero padding to avoid horizontal scroll issues */
}
.property img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 12px 0 rgba(80, 80, 80, 0.09);
}
ul {
  padding-left: 1.4rem;
}
.map {
  margin-top: 1.2rem;
  height: 260px;
  background: linear-gradient(135deg, #fbeee6 60%, #ffe5c0 100%);
  text-align: center;
  line-height: 260px;
  border-radius: 10px;
  color: #b97b3e;
  font-weight: 500;
  font-size: 1.1em;
  box-shadow: 0 2px 8px 0 rgba(180, 120, 60, 0.06);
}
.contact-button {
  display: inline-block;
  margin-top: 1.2rem;
  background: linear-gradient(90deg, #d97742 60%, #ffb95c 100%);
  color: white;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px 0 rgba(217, 119, 66, 0.13);
  transition: background 0.2s, transform 0.2s;
}
.contact-button:hover {
  background: linear-gradient(90deg, #b96e2e 60%, #ffd180 100%);
  transform: translateY(-2px) scale(1.03);
}
.hidden-phone {
  display: none;
  margin-top: 0.7rem;
  font-size: 1.25em;
  color: #d97742;
  font-weight: 600;
}
footer {
  text-align: center;
  font-size: 0.97em;
  color: #a98b6d;
  padding: 1.5rem 2rem; /* vertical and horizontal padding */
  background: #fbeee6;
  border-radius: 0 !important;
  margin-top: 3rem;
}

html, body {
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}
body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  box-sizing: border-box;
}
header {
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: hidden;
  position: relative;
  left: 0;
  right: 0;
  margin-left: 0;
  margin-right: 0;
}
/* Add this style for the modal preview */
.img-preview-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.img-preview-modal.active {
  display: flex;
}
.img-preview-modal img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px #000a;
  background: #fff;
}

.property {
  width: 100%;
  overflow: visible;
  margin-bottom: 2.5rem; /* увеличенный отступ между объявлениями */
}
.property:last-of-type {
  margin-bottom: 1.2rem;
}
.property-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.property-flex {
  display: flex;
  flex-direction: row;
  gap: 2.5em;
  align-items: stretch;
  justify-content: stretch;
}

/* Always stack map below description, price below map */
.property-price-col {
  display: block;
  width: 100%;
  max-width: 100vw;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  padding: 0;
}

/* Price column: always below map, right-aligned content, centered container */
.property-price-col {
  max-width: 340px;
  margin-top: 2em;
  margin-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Remove any flex properties that could cause horizontal alignment */
.property-price-col {
  flex: none !important;
  min-width: 0 !important;
  max-width: 100vw !important;
  order: unset !important;
}

/* Responsive: always stack map and price below */
@media (max-width: 1100px), (max-width: 700px) {
  .property-flex {
    flex-direction: column;
    gap: 1.5em;
  }

  .property-price-col {
    width: 100%;
    max-width: 100vw;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
    display: block;
  }
  .property-price-col {
    max-width: 340px;
    margin-top: 2em;
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}


@media (max-width: 600px) {
  #house .property-price-col .notel {
    color: #22324a !important;
  }
}
.property-description h2 {
  font-size: 2em;
  font-weight: 700;
  line-height: 1.22;
  margin-top: 0.2em;
  margin-bottom: 0.7em;
  text-align: center;
  color: #22324a;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px #fff8, 0 1px 0 #fff2;
  white-space: pre-line;
}

/* No CSS changes needed for phone reveal button.
   The issue is in the HTML/JS, not CSS. */
.notel {
  /* Отключаем автораспознавание номеров телефонов на iOS и Android */
  -webkit-touch-callout: none;
  -webkit-user-select: text;
  user-select: text;
  pointer-events: auto;
  -webkit-text-size-adjust: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-format-detection: "telephone=no";
  format-detection: "telephone=no";
  /* Не сбрасываем all: unset, чтобы не ломать вложенные элементы */
}

/* Стиль для текста описания объекта с паддингом */
.property-description-text {
  font-size: 1.18em;
  line-height: 1.7;
  color: #22324a;
  padding-left: 1rem;
  padding-right: 1rem;
  box-sizing: border-box;
  word-break: break-word;
}

/* Gallery styles */

.gallery-grid,
.gallery-collection {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); 
   /* grid-auto-rows: 60vw; */
  gap: 8px;
  margin-bottom: 1.2rem;
  width: 100vw; 
  box-sizing: border-box;
  padding-left: 0.5em;
  padding-right: 4em;
  margin-left: 0;
  margin-right: 0;
  justify-content: stretch;
  align-content: start;
  justify-items: stretch;
  align-items: stretch;
}

.gallery-grid .gallery-thumb,
  .gallery-collection .gallery-thumb {
    min-height: 5vw;
    aspect-ratio: 1 / 1;
  }

.gallery-collection::after,
.gallery-collection::before {
  content: none;
  display: none;
} 

@media (max-width: 700px) {
  .gallery-grid,
  .gallery-collection {
    grid-template-columns: repeat(4, minmax(0, 1fr)); 
    gap: 5px;
    padding-left: 0.5rem;
    padding-right: 4rem;
  }
  .gallery-grid .gallery-main,
  .gallery-collection .gallery-main {
    grid-row: 1 / span 2;
    grid-column: 1 / span 2;
    aspect-ratio: 1 / 1;
  }

  .gallery-grid .gallery-thumb,
  .gallery-collection .gallery-thumb {
    min-height: 5vw;
    max-height: 30vw;
    aspect-ratio: 1 / 1;
  }
}

.gallery-grid > div[style*="visibility:hidden"],
.gallery-collection > div[style*="visibility:hidden"] {
  width: 100%;
  height: 100%;
}



@media (max-width: 768px) {
  header {
    padding-top: 2rem;
    padding-bottom: 2rem;
    min-height: 25vh;
    max-height: 35vh;
  }

  header h1 {
    font-size: 1.4rem;
    line-height: 1.25;
    max-width: 90%;
    margin: 0 auto;
    text-align: center;
  }
}

.header-background {
    background: url('../assets/optimized/header-background.webp') center/cover no-repeat;
    color: #fff;
    position: relative;
    padding-top: 4rem;
    padding-bottom: 4rem;
    border-radius: 0;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    left: 0;
    right: 0;
    margin-left: 0;
    margin-right: 0;
}

.header-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
}

.header-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 1.2rem 2rem 0.5rem 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    background: linear-gradient(90deg, rgba(30, 60, 90, 0.18) 0%, rgba(30, 30, 30, 0.08) 100%);
    z-index: 10;
}

.header-title-container {
    position: relative;
    z-index: 1;
}

.header-title {
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.65), 0 1px 0 #fff2;
}

.property-description-padding {
    padding-left: 1.5em;
    padding-right: 1.5em;
}

.property-title {
    text-align: center;
    padding: 0 2.5rem;
    white-space: pre-line;
    line-height: 1.05;
    margin-bottom: 0.2em;
}

.property-subtitle {
    display: block;
    margin-top: -0.2em;
    font-size: 0.5em;
    color: rgba(34, 50, 74, 0.5);
    font-weight: 400;
}

.property-price-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.1em;
    margin-top: 1.1rem;
    margin-right: 0.5em;
}

.property-price-old {
    font-size: 1.1em;
    color: #22324a;
    text-decoration: line-through;
    margin-right: 0.2em;
}

.property-price-new {
    font-size: 1.25em;
    font-weight: 600;
    color: #22324a;
    background: #f4f7fa;
    border-radius: 8px;
    padding: 0.5em 1.1em 0.5em 0.9em;
    display: inline-block;
    box-shadow: 0 2px 8px #e9eef3;
    letter-spacing: 0.01em;
}

.mortgage-container {
    display: flex;
    justify-content: flex-end;
    margin-right: 0.5em;
    margin-top: 0.2em;
    padding-bottom: 1.5em;
}

.mortgage-info {
    font-size: 1em;
    color: #22324a;
    background: #f4f7fa;
    border-radius: 8px;
    padding: 0.35em 1em;
    display: inline-block;
}

.mortgage-link {
    margin-left: 1em;
    color: #22324a;
    font-weight: 600;
    text-decoration: underline;
}

.contact-section {
    padding-left: 2rem;
    padding-right: 2rem;
}

.contact-title {
    color: #22324a;
}

.contact-region {
    margin-bottom: 1.2rem;
    color: #22324a;
    font-size: 1.08em;
}

.contact-button-show {
    background: #22324a;
    color: #fff;
    border: none;
}

.phone-container {
    margin-bottom: 1.2rem;
    color: #22324a;
}

.phone-number-container {
    margin-bottom: 0.5em;
    color: #22324a;
}

.phone-number-link {
    color: #22324a;
    text-decoration: underline;
    font-weight: 600;
    font-size: 1.15em;
}

.phone-owner {
    color: #888;
    font-size: 1em;
    margin-top: 0.4em;
}

.email-button {
    background: #22324a;
    color: #fff;
    border: none;
}

.email-container {
    display: none;
    margin-top: 1.2rem;
    color: #22324a;
}

.email-link {
    color: #22324a;
}

.footer {
    background: #22324a;
    color: #fff;
    text-align: center;
    padding: 1.2em 0;
    border-radius: 0;
    margin-top: 2.5em;
}

.modal-close-button {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 10;
    font-size: 2.2em;
    line-height: 1;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0 0.2em 0.1em 0;
}

.yandex-metrika-noscript {
    position: absolute;
    left: -9999px;
}

.apartment-price-old {
    font-size: 1em;
    color: #888;
    text-decoration: line-through;
    margin-right: 0.2em;
}

.apartment-price-new {
    font-size: 1.15em;
    font-weight: 600;
    color: #22324a;
    background: #f4f7fa;
    border-radius: 8px;
    padding: 0.5em 1.1em 0.5em 0.9em;
    display: inline-block;
    box-shadow: 0 2px 8px #e9eef3;
    letter-spacing: 0.01em;
}