/* Mediterra Homes — стили сайта
   Цвета взяты из логотипа: солнце, море, терракотовая крыша.
   Турецкий колорит: изникский узор (pattern) и арка. */

:root {
  --sand: #fbf7f0;
  --sand-2: #f4ece0;
  --paper: #ffffff;
  --ink: #1c2230;
  --muted: #5f6675;
  --line: #ebe2d4;
  --blue: #2a4b9b;
  --blue-dark: #1e3a7a;
  --wave: #3e6fc2;
  --sun: #f4b54a;
  --terra: #a45a3b;
  --iznik: #1f7f86;
  --wa: #1fa855;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgba(28, 34, 48, .06), 0 6px 24px rgba(28, 34, 48, .06);
  --shadow-up: 0 2px 4px rgba(28, 34, 48, .06), 0 14px 40px rgba(28, 34, 48, .12);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: .35s var(--ease);

  --serif: "Lora", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
button, select, input { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--r);
  font-weight: 700; font-size: 15px; text-align: center; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: transform var(--t), box-shadow var(--t), background-color var(--t), border-color var(--t), color var(--t);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-ghost { background: var(--paper); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sun { background: var(--sun); color: var(--ink); }
.btn-block { width: 100%; }

/* ---------- Шапка ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 240, .86);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t), box-shadow var(--t);
}
.header.scrolled { border-color: var(--line); }
.header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo { white-space: nowrap; display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--blue); }
.logo img { width: 38px; height: 38px; }
.logo small { display: block; font: 600 11px/1.2 var(--sans); color: var(--muted); letter-spacing: .04em; }
.nav { display: none; gap: 28px; font-weight: 600; font-size: 15px; }
.nav a { position: relative; color: var(--muted); transition: color var(--t); }
.nav a:hover { color: var(--ink); }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; border-radius: 2px; background: var(--sun); transform: scaleX(0); transition: transform var(--t); }
.nav a:hover::after { transform: scaleX(1); }
.header .btn { min-height: 42px; padding: 0 16px; font-size: 14px; }
@media (min-width: 900px) { .nav { display: flex; } }
@media (max-width: 420px) { .header .btn span { display: none; } .header .btn { padding: 0 12px; } }

/* ---------- Изникский узор ---------- */
.pattern {
  background-color: var(--sand-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%231f7f86' stroke-opacity='.13' stroke-width='1.4'%3E%3Cpath d='M36 6l8.5 21.5L66 36l-21.5 8.5L36 66l-8.5-21.5L6 36l21.5-8.5z'/%3E%3Ccircle cx='36' cy='36' r='7'/%3E%3Cpath d='M0 0l12 12M72 0L60 12M0 72l12-12M72 72L60 60'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Первый экран ---------- */
.hero { position: relative; overflow: hidden; }
.hero .wrap { display: grid; gap: 32px; padding-top: 40px; padding-bottom: 48px; align-items: center; }
.hero-text { text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--terra); margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sun); }
.hero h1 { font-size: clamp(34px, 7vw, 60px); color: var(--ink); }
.hero h1 em { font-style: italic; color: var(--blue); }
.hero-sub { margin: 18px auto 28px; max-width: 520px; font-size: 18px; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.hero-cta .btn { flex: 1 1 200px; max-width: 260px; }
.hero-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin-top: 28px; font-size: 14px; font-weight: 600; color: var(--muted); }
.hero-facts span::before { content: "✓"; color: var(--iznik); margin-right: 6px; font-weight: 800; }
.arch {
  position: relative; margin: 0 auto; width: min(100%, 440px); aspect-ratio: 4 / 5;
  border-radius: 999px 999px var(--r-lg) var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-up); border: 6px solid var(--paper);
}
.arch img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 1.2s var(--ease); }
.arch:hover img { transform: scale(1); }
@media (max-width: 899px) { .arch { aspect-ratio: 1 / 1; width: min(100%, 400px); } }
.arch-badge { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); white-space: nowrap; background: rgba(255,255,255,.94); border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
@media (min-width: 900px) {
  .hero .wrap { grid-template-columns: 1.15fr .85fr; padding-top: 64px; padding-bottom: 72px; }
  .hero-text { text-align: left; }
  .hero-sub { margin-left: 0; }
  .hero-cta, .hero-facts { justify-content: flex-start; }
}

/* ---------- Секции ---------- */
.section { padding: 56px 0; }
@media (min-width: 768px) { .section { padding: 80px 0; } }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.section-head h2 { font-size: clamp(28px, 4.4vw, 40px); }
.section-head p { margin: 12px 0 0; color: var(--muted); font-size: 17px; }
.divider { height: 14px; }

/* ---------- Фильтры ---------- */
.filters { position: sticky; top: 68px; z-index: 40; padding: 12px 0; margin-bottom: 20px; background: rgba(251, 247, 240, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.seg { display: flex; gap: 6px; padding: 5px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font-weight: 700; font-size: 14px; text-align: center; cursor: pointer; color: var(--muted); transition: background-color var(--t), color var(--t); }
.seg button.on { background: var(--ink); color: #fff; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.select { position: relative; }
.select select { width: 100%; min-height: 44px; padding: 0 36px 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); appearance: none; -webkit-appearance: none; font-weight: 600; font-size: 14px; cursor: pointer; transition: border-color var(--t); }
.select select:hover { border-color: var(--ink); }
.select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.found { margin: 0 0 16px; font-weight: 700; color: var(--muted); font-size: 14px; }
@media (min-width: 768px) {
  .filters .wrap-in { display: flex; gap: 10px; align-items: center; }
  .seg { flex: 0 0 auto; }
  .filter-row { margin: 0; flex: 1; grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Карточки ---------- */
.grid { display: grid; gap: 24px 20px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; display: block; transition: transform var(--t); }
.card.hide { display: none; }
.card-media { position: relative; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3; background: var(--sand-2); }
.slides { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; transition: transform .6s var(--ease); }
.card:hover .slides img { transform: scale(1.03); }
.badge { position: absolute; top: 12px; left: 12px; z-index: 2; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.95); font-size: 12px; font-weight: 800; box-shadow: var(--shadow); }
.badge.sale { background: var(--sun); }
.badge.daily { background: var(--iznik); color: #fff; }
.count { position: absolute; right: 12px; bottom: 12px; z-index: 2; padding: 4px 10px; border-radius: 999px; background: rgba(28,34,48,.62); color: #fff; font-size: 12px; font-weight: 700; }
.arrow { position: absolute; top: 50%; z-index: 3; width: 34px; height: 34px; margin-top: -17px; border: 0; border-radius: 50%; background: rgba(255,255,255,.95); box-shadow: var(--shadow); cursor: pointer; opacity: 0; transition: opacity var(--t), transform var(--t); display: flex; align-items: center; justify-content: center; }
.arrow svg { width: 16px; height: 16px; }
.arrow.prev { left: 10px; } .arrow.next { right: 10px; }
.card:hover .arrow { opacity: 1; }
.arrow:hover { transform: scale(1.08); }
@media (hover: none) { .arrow { display: none; } }
.card-body { padding: 14px 4px 0; }
.card-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); font-weight: 600; }
.card h3 { font-family: var(--sans); font-size: 16px; font-weight: 700; margin: 4px 0 6px; line-height: 1.35; }
.price { font-weight: 800; font-size: 17px; }
.price small { font-weight: 600; color: var(--muted); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.empty { display: none; text-align: center; padding: 40px 16px; border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--muted); }
.empty.show { display: block; }

/* ---------- Районы ---------- */
.districts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .districts { grid-template-columns: repeat(3, 1fr); } }
.district { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; padding: 16px; border-radius: var(--r-lg); overflow: hidden; color: #fff; cursor: pointer; text-align: left; border: 0; background: var(--ink); transition: transform var(--t), box-shadow var(--t); }
.district img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: transform .8s var(--ease), opacity var(--t); }
.district::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(20,24,36,.78)); }
.district:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.district:hover img { transform: scale(1.06); opacity: .9; }
.district b, .district span { position: relative; z-index: 1; }
.district b { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.district span { font-size: 13px; font-weight: 600; opacity: .9; }

/* ---------- Доверие ---------- */
.trust { display: grid; gap: 14px; }
@media (min-width: 768px) { .trust { grid-template-columns: repeat(4, 1fr); } }
.trust div { padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); text-align: center; transition: transform var(--t), box-shadow var(--t); }
.trust div:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.trust b { display: block; font-family: var(--serif); font-size: 26px; color: var(--blue); margin-bottom: 6px; }
.trust span { color: var(--muted); font-size: 14px; font-weight: 600; }

/* ---------- Блок CTA ---------- */
.cta-box { display: grid; gap: 24px; padding: 32px 22px; border-radius: 28px; background: var(--blue); color: #fff; text-align: center; position: relative; overflow: hidden; }
.cta-box::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.12' stroke-width='1.4'%3E%3Cpath d='M36 6l8.5 21.5L66 36l-21.5 8.5L36 66l-8.5-21.5L6 36l21.5-8.5z'/%3E%3Ccircle cx='36' cy='36' r='7'/%3E%3C/g%3E%3C/svg%3E"); }
.cta-box > * { position: relative; }
.cta-box h2 { font-size: clamp(26px, 4vw, 36px); }
.cta-box p { margin: 10px 0 0; opacity: .85; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cta-actions .btn { flex: 1 1 220px; max-width: 280px; }
@media (min-width: 900px) { .cta-box { grid-template-columns: 1.3fr 1fr; align-items: center; text-align: left; padding: 48px; } .cta-actions { justify-content: flex-end; } }

/* ---------- Подвал ---------- */
.footer { padding: 40px 0 100px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer .wrap { display: grid; gap: 20px; }
.footer a { font-weight: 600; color: var(--ink); transition: color var(--t); }
.footer a:hover { color: var(--blue); }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 22px; }
@media (min-width: 768px) { .footer { padding-bottom: 40px; } .footer .wrap { grid-template-columns: 1fr auto; align-items: center; } }

/* ---------- Плавающая кнопка WhatsApp (телефон) ---------- */
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: 58px; height: 58px; border-radius: 50%; background: var(--wa); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(31,168,85,.4); transition: transform var(--t); }
.fab:hover { transform: scale(1.06); }
.fab svg { width: 30px; height: 30px; }
@media (min-width: 900px) { .fab { display: none; } }

/* ---------- Страница объекта ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 18px 0 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.crumbs a { color: var(--blue); }
.obj-head h1 { font-size: clamp(26px, 4.5vw, 40px); }
.obj-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0 20px; color: var(--muted); font-weight: 600; font-size: 15px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--r-lg); margin: 0 -16px; padding: 0 16px; }
.gallery::-webkit-scrollbar { display: none; }
.gallery button { flex: 0 0 88%; padding: 0; border: 0; background: var(--sand-2); border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3; cursor: zoom-in; scroll-snap-align: center; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter var(--t); }
.gallery button:hover img { transform: scale(1.03); filter: brightness(.95); }
.gallery-wrap .more { display: none; }
@media (min-width: 768px) {
  .gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; height: 460px; margin: 0; padding: 0; overflow: hidden; }
  .gallery button { aspect-ratio: auto; border-radius: 0; }
  .gallery button:first-child { grid-row: span 2; }
  .gallery button:nth-child(n+6) { display: none; }
  .gallery-wrap { position: relative; }
  .gallery-wrap .more { display: inline-flex; position: absolute; right: 16px; bottom: 16px; min-height: 40px; font-size: 14px; }
}
.obj-grid { display: grid; gap: 32px; margin-top: 28px; }
@media (min-width: 960px) { .obj-grid { grid-template-columns: 1fr 380px; align-items: start; } }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 28px; }
@media (min-width: 600px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts div { padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); text-align: center; }
.facts b { display: block; font-size: 17px; }
.facts span { font-size: 13px; color: var(--muted); font-weight: 600; }
.desc { font-size: 16.5px; line-height: 1.75; }
.desc h2, .block h2 { font-size: 24px; margin: 0 0 14px; }
.block { margin-top: 36px; }
.map { width: 100%; height: 320px; border: 0; border-radius: var(--r-lg); background: var(--sand-2); }
.side { position: sticky; top: 88px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.side .price { font-size: 28px; display: block; margin-bottom: 4px; }
.side .id { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.side .btn { margin-top: 10px; }
.side .note { margin: 14px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Просмотр фото ---------- */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(12,14,20,.94); display: none; }
.lb.open { display: block; animation: fade .25s var(--ease); }
.lb-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-track figure { flex: 0 0 100%; margin: 0; display: flex; align-items: center; justify-content: center; padding: 56px 12px; scroll-snap-align: center; }
.lb-track img { max-height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lb-btn { position: absolute; z-index: 2; width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color var(--t); }
.lb-btn:hover { background: rgba(255,255,255,.26); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 16px; top: 50%; margin-top: -23px; }
.lb-next { right: 16px; top: 50%; margin-top: -23px; }
.lb-num { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 700; font-size: 14px; }
@media (hover: none) { .lb-prev, .lb-next { display: none; } }

/* ---------- Плавное появление ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
