/* =========================================================
   «Магма» — стили сайта
   Настроение: ярко, но спокойно. Светлый «пепел» как основа,
   закатное небо над вулканами на первом экране, «лава» — только в акцентах,
   «обсидиан» — текст и тёмный блок контактов.
   Подход mobile-first: сначала телефон, ниже — @media для больших экранов.
   ========================================================= */

/* ---------- 0. Шрифт заголовков Forum ----------
   Лежит на самом сайте (папка fonts/), а не грузится с Google: так IP-адреса гостей
   не уходят за границу (152-ФЗ). Лицензия шрифта — SIL Open Font License, свободная.
   swap — текст виден сразу, шрифт подгружается следом. */
@font-face {
  font-family: "Forum";
  font-display: swap;
  src: url("../fonts/forum-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Forum";
  font-display: swap;
  src: url("../fonts/forum-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Forum";
  font-display: swap;
  src: url("../fonts/forum-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 1. Переменные: цвета и размеры меняются здесь ---------- */
:root {
  /* Пепел — фоны */
  --ash-0: #f5f3f0;      /* основной фон */
  --ash-1: #ebe7e2;      /* фон чередующихся разделов */
  --paper: #fdfcfa;      /* карточки и форма */
  --line: #ddd6ce;       /* рамки */

  /* Обсидиан и базальт — текст */
  --obsidian: #1d1916;
  --basalt: #5c544e;
  --pumice: #8b827b;

  /* Лава — акценты */
  --lava: #e0532b;       /* кнопки, выделение */
  --lava-deep: #b33d1c;  /* ссылки и акцентный текст на светлом фоне */
  --ember: #f4a259;      /* тёплый янтарь */
  --glow: #fde3c4;       /* мягкая подсветка */

  /* Закатное небо первого экрана */
  --sky: linear-gradient(180deg, #fde6c6 0%, #fbcd98 40%, #f5a173 72%, #ec7b55 100%);

  --ok: #2f7d4f;
  --err: #c0392b;

  /* Заголовки — Forum: классическая антиква, перекликается с надписью «МАГМА» на логотипе */
  --font-head: "Forum", "Times New Roman", Georgia, serif;
  --night: #161413;      /* тёмная шапка и подвал — в тон фону логотипа */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 64px;
  --container: 1160px;
  color-scheme: light;
}

/* ---------- 2. База ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);  /* шапка не закрывает заголовок раздела */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ash-0);
  color: var(--obsidian);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.menu-open { overflow: hidden; }   /* открыто мобильное меню — страница не прокручивается */

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 400; line-height: 1.12; letter-spacing: .01em; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--lava); outline-offset: 3px; border-radius: 6px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.container--narrow { max-width: 800px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0;
}
.muted { color: var(--pumice); }

/* Надзаголовок раздела */
.kicker {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lava-deep);
}
.kicker--light { color: var(--ember); }

/* ---------- 3. Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 15px/1.1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn--lg { min-height: 54px; padding: 16px 28px; font-size: 16px; }

.btn--lava { background: var(--lava); color: #fff; box-shadow: 0 8px 20px -10px rgba(224, 83, 43, .7); }
.btn--lava:hover { background: var(--lava-deep); }
.btn--dark { background: var(--obsidian); color: #fff; }
.btn--dark:hover { background: #3a322d; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--obsidian); }
.btn--ghost:hover { border-color: var(--lava); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 4. Шапка ---------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--night);
  color: #ece4dd;
  transition: box-shadow .3s;
}
/* Класс ставит скрипт при прокрутке — лёгкая тень */
.header.is-scrolled { box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .6); }
.header__inner { height: 100%; display: flex; align-items: center; gap: 14px; }

.logo { display: flex; align-items: center; gap: 12px; margin-right: auto; text-decoration: none; }
/* Логотип клиента: PNG с прозрачным фоном, рассчитан на тёмную шапку */
.logo__mark { width: auto; height: 44px; }
.logo__word { width: auto; height: 17px; }

.header__phone { display: none; font-weight: 600; text-decoration: none; white-space: nowrap; }
.header__phone:hover { color: var(--ember); }
.header__cta { display: none; }

.burger {
  position: relative;
  z-index: 60;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.burger span {
  position: absolute; left: 12px; right: 12px; height: 2px;
  background: #ece4dd; border-radius: 2px;
  transition: transform .3s, opacity .2s;
}
.burger span:nth-child(1) { top: 14px; }
.burger span:nth-child(2) { top: 21px; }
.burger span:nth-child(3) { top: 28px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Мобильное меню — на весь экран */
.nav {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  background: radial-gradient(circle at 50% 115%, rgba(224, 83, 43, .28), transparent 60%), var(--night);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.nav.is-open { opacity: 1; visibility: visible; }
.nav__link { font: 400 28px/1 var(--font-head); color: #ece4dd; text-decoration: none; }
.nav__link:hover { color: var(--ember); }

/* Объявление из кабинета */
.notice {
  position: relative;
  z-index: 2;
  margin-top: var(--header-h);
  background: #2b2420;
  color: #f6e7d8;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 15px;
  text-align: center;
}
.notice__inner { padding-block: 10px; }
.notice--warn { background: #fdecc8; color: #5a3500; }   /* предупреждение: бронь недоступна */
/* Объявление показано — шапка уже над ним, большой отступ у первого экрана не нужен.
   :not([hidden]) важен: скрытая плашка тоже стоит в коде и без него отступ пропадал */
.notice:not([hidden]) + main .hero { padding-top: 32px; }

/* ---------- 5. Первый экран: закат над вулканами ---------- */
.hero {
  position: relative;
  padding: calc(var(--header-h) + 40px) 0 230px;
  background: var(--sky);
  overflow: hidden;
  isolation: isolate;
}
.hero__sky { position: absolute; inset: 0; z-index: -1; }

/* Мягкое закатное солнце */
.hero__sun {
  position: absolute;
  right: 12%;
  bottom: 120px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3dc 0%, #ffd9a6 45%, rgba(255, 200, 140, 0) 70%);
}

.hero__mountains { position: absolute; left: 0; bottom: 0; width: 100%; height: 300px; }
.m-far  { fill: #d98f78; opacity: .55; }
.m-mid2 { fill: #9a5f55; }
.m-mid  { fill: #6b3f3a; }
.m-snow { fill: #f7e7dc; opacity: .9; }
.m-near { fill: #2a201d; }

/* Дымок над кратером: медленно поднимается и тает */
/*
  Позиция дымка = кратер вулкана в SVG (x=908, y=110 из 1440×420).
  SVG масштабируется по ширине или по высоте — берём большее (max), как и сам SVG.
*/
.hero__smoke {
  position: absolute;
  bottom: calc(max(21.53vw, 221px) - 6px);
  left: calc(50% + max(13.06vw, 134px) - 33px);
  width: 60px;
  height: 1px;
}
.hero__smoke i {
  position: absolute;
  bottom: 0;
  left: 10px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 246, 236, .55);
  filter: blur(6px);
  animation: smoke 9s ease-out infinite;
}
.hero__smoke i:nth-child(2) { animation-delay: 3s; }
.hero__smoke i:nth-child(3) { animation-delay: 6s; }
@keyframes smoke {
  0%   { transform: translate(0, 0) scale(.5); opacity: 0; }
  15%  { opacity: .8; }
  100% { transform: translate(60px, -140px) scale(2.4); opacity: 0; }
}

.hero__content { position: relative; }
.hero__title { font-size: clamp(36px, 9.6vw, 76px); max-width: 14ch; }
.hero__name { color: var(--lava-deep); white-space: nowrap; }
.hero__lead { max-width: 50ch; margin-top: 18px; font-size: 17px; color: #3f3631; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero__actions .btn { flex: 1 1 220px; }

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 30px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}
.hero__facts li { display: flex; flex-direction: column; gap: 2px; }
.hero__facts b { font: 700 22px/1.1 var(--font-body); }
.hero__facts li > span { font-size: 13px; line-height: 1.35; color: #4c423c; }

/* ---------- 6. Разделы ---------- */
.section { padding-block: 64px; }
.section--tight { padding-block: 40px; }
.section--ash { background: var(--ash-1); }
.section__head { max-width: 640px; margin-bottom: 32px; }
.section__title { font-size: clamp(30px, 6.6vw, 48px); }
.section__text { margin-top: 12px; color: var(--basalt); }

/* ---------- 7. Почему удобно ---------- */
.why {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.why__item { display: flex; gap: 14px; align-items: flex-start; }
.why__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 50%;
  background: var(--glow);
  fill: none;
  stroke: var(--lava-deep);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.why h3 { font-size: 16px; margin-bottom: 4px; }
.why p { font-size: 15px; color: var(--basalt); }
.why a { color: var(--lava-deep); }

/* ---------- 8. Дома ---------- */
.houses { display: grid; gap: 18px; }
.house {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
}
.house__photo {
  position: relative;
  aspect-ratio: 3 / 2;
  max-width: 100%;
  /* Заглушка, пока нет фото: закатное небо и силуэт дома */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200'%3E%3Cpath d='M0 170 60 150 120 160 190 140 300 155V200H0z' fill='%232a201d' opacity='.85'/%3E%3Cpath d='M105 160V118l45-30 45 30v42z' fill='%232a201d'/%3E%3Crect x='140' y='128' width='20' height='22' fill='%23fbcd98'/%3E%3C/svg%3E") center bottom / cover no-repeat,
    var(--sky);
}
.house__photo--small {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200'%3E%3Cpath d='M0 170 70 155 150 165 220 148 300 160V200H0z' fill='%232a201d' opacity='.85'/%3E%3Cpath d='M120 162v-30l30-22 30 22v30z' fill='%232a201d'/%3E%3Crect x='142' y='138' width='16' height='16' fill='%23fbcd98'/%3E%3C/svg%3E") center bottom / cover no-repeat,
    linear-gradient(180deg, #fde6c6, #f5a173);
}
.house__photo img { width: 100%; height: 100%; object-fit: cover; }
.house__count {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(29, 25, 22, .82);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.house__body { display: flex; flex-direction: column; gap: 14px; flex: 1; padding: 22px; }
.house__name { font-size: 22px; }
.house__price { color: var(--basalt); }
.house__price b { font: 700 30px/1 var(--font-body); color: var(--obsidian); }
.house__price span { font-size: 14px; }
.house__features {
  display: grid;
  gap: 10px;
  margin: 4px 0 6px;
  padding: 0;
  list-style: none;
  flex: 1;
}
.house__features li { display: flex; align-items: center; gap: 10px; color: var(--basalt); }
.house__features svg {
  width: 22px; height: 22px; flex-shrink: 0;
  fill: none; stroke: var(--lava); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.house__features b { color: var(--obsidian); }
.house__btn { align-self: flex-start; }

/* Баня */
.bath {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 16px;
  margin-top: 18px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--obsidian);
  color: #fff;
}
.bath__icon { width: 40px; height: 40px; fill: var(--ember); }
.bath h3 { font-size: 18px; }
.bath__text p { font-size: 15px; color: #cfc6bf; }
.bath__price { grid-column: 1 / -1; color: #cfc6bf; }
.bath__price b { font: 700 26px/1 var(--font-body); color: #fff; }

/* ---------- 9. Фото ---------- */
.gallery { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 160px; gap: 10px; }
.gallery__item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 75% 25%, rgba(255, 243, 220, .9), transparent 35%),
    linear-gradient(160deg, #f6c79c, #e98d6a 60%, #a8604f);
}
.gallery__item:nth-child(even) { background: linear-gradient(160deg, #e9e2da, #cdbfb3 60%, #9f8d80); }
.gallery__item--wide { grid-column: 1 / -1; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }
.gallery__item img.is-missing,
.house__photo img.is-missing { display: none; }   /* фото ещё не загружено на сервер — видна заглушка */
.gallery__item figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(253, 252, 250, .9);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- 8а. Карточки домов (по одному дому) ---------- */
.group + .group { margin-top: 48px; }
.group__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 18px; }
.group__title { font-size: clamp(26px, 5.4vw, 36px); }
.group__text { color: var(--basalt); }

.hcards { display: grid; gap: 18px; align-items: start; }   /* раскрытый список не растягивает соседние карточки */
.hcard {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  scroll-margin-top: calc(var(--header-h) + 12px);
  transition: box-shadow .4s, border-color .4s;
}
/* Подсветка дома, к которому пришли по ссылке #dom-… */
.hcard.is-focus { border-color: var(--lava); box-shadow: 0 0 0 3px rgba(224, 83, 43, .25); }

.hcard__cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--ash-1);
  cursor: zoom-in;
}
.hcard__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.hcard__cover:hover img { transform: scale(1.03); }
.hcard__count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(22, 20, 19, .8);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
/* Фото ещё не загружены — закатная заглушка с силуэтом дома */
.hcard__cover--empty {
  display: grid;
  place-items: center;
  cursor: default;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200'%3E%3Cpath d='M0 170 60 150 120 160 190 140 300 155V200H0z' fill='%232a201d' opacity='.85'/%3E%3Cpath d='M105 160V118l45-30 45 30v42z' fill='%232a201d'/%3E%3Crect x='140' y='128' width='20' height='22' fill='%23fbcd98'/%3E%3C/svg%3E") center bottom / cover no-repeat,
    var(--sky);
}
.hcard__cover--empty span { padding: 6px 14px; border-radius: 999px; background: rgba(253, 252, 250, .85); font-size: 14px; font-weight: 600; }

.hcard__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px 4px 0; }
.hcard__thumb { position: relative; aspect-ratio: 4 / 3; max-width: 100%; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--ash-1); cursor: zoom-in; }
.hcard__thumb img { width: 100%; height: 100%; object-fit: cover; }
.hcard__more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(22, 20, 19, .6); color: #fff; font-weight: 700; }

.hcard__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 20px 22px 22px; }
.hcard__name { margin: 0; font: 400 32px/1.05 var(--font-head); }
.hcard__meta { color: var(--basalt); font-size: 15px; }
.hcard__about { color: var(--basalt); }
.hcard__price { color: var(--basalt); }
.hcard__price b { font: 700 26px/1 var(--font-body); color: var(--obsidian); }
.hcard__book { align-self: flex-start; margin-top: auto; }

/* «Что есть в доме ⋯» */
.kit { border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); margin: 4px 0 8px; }
.kit summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.kit summary::-webkit-details-marker { display: none; }
.kit__dots {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glow);
  color: var(--lava-deep);
  font-size: 22px;
  line-height: 1;
  transition: transform .25s, background-color .2s;
}
.kit[open] .kit__dots { transform: rotate(90deg); background: #fbd2a6; }
.kit__lead { margin: 0 0 10px; font-size: 14px; color: var(--basalt); }
.kit__list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0 0 14px; padding: 0; list-style: none; }
.kit__list li { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; min-width: 0; }
.kit__list svg {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
  fill: none; stroke: var(--lava); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.anchor { position: relative; top: calc(-1 * var(--header-h)); display: block; }
#territory .bath { margin-top: 22px; }

/* ---------- 9а. Названия домов в карточках ---------- */
.house__names { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.house__names a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glow);
  color: var(--lava-deep);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.house__names a::after { content: "фото →"; font-weight: 500; font-size: 12px; color: var(--basalt); }
.house__names a:hover { background: #fbd2a6; }

/* ---------- 9б. Альбомы домов ---------- */
.tabs {
  position: relative;            /* от неё считается положение вкладок при прокрутке полоски */
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 4px;
  overflow-x: auto;              /* на телефоне вкладки листаются пальцем */
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs__btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--obsidian);
  font: 600 15px/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.tabs__btn:hover { border-color: var(--ember); }
.tabs__btn[aria-selected="true"] { background: var(--obsidian); border-color: var(--obsidian); color: #fff; }
.tabs__btn small { margin-left: 6px; font-weight: 500; opacity: .7; }

.album { display: grid; gap: 16px; }
.album__info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.album__name { font-size: clamp(22px, 5vw, 30px); }
.album__meta { margin-top: 4px; color: var(--basalt); }

/* Сетка: первое фото крупно, остальные — плиткой */
.album__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 120px;
  gap: 8px;
}
.album__tile {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--ash-1);
  cursor: zoom-in;
}
.album__tile:first-child { grid-column: 1 / -1; grid-row: span 2; }
.album__tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.album__tile:hover img { transform: scale(1.04); }
.album__more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(29, 25, 22, .62);
  color: #fff;
  font: 700 18px/1.2 var(--font-body);
}
/* Фото ещё не загружены */
.album__empty {
  grid-column: 1 / -1;
  grid-row: span 2;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: var(--radius-sm);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 200'%3E%3Cpath d='M0 170 60 150 120 160 190 140 300 155V200H0z' fill='%232a201d' opacity='.85'/%3E%3Cpath d='M105 160V118l45-30 45 30v42z' fill='%232a201d'/%3E%3Crect x='140' y='128' width='20' height='22' fill='%23fbcd98'/%3E%3C/svg%3E") center bottom / cover no-repeat,
    var(--sky);
  color: var(--obsidian);
  font-weight: 600;
  text-align: center;
}
.album__empty span { padding: 8px 14px; border-radius: 999px; background: rgba(253, 252, 250, .85); }

.house-pick__photos { display: inline-block; margin-top: 12px; color: var(--lava-deep); font-weight: 600; }

/* ---------- 9в. Просмотр фото на весь экран ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: calc(56px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) calc(56px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: rgba(16, 13, 11, .94);
  touch-action: pan-y;
}
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  object-fit: contain;
  user-select: none;
}
.lightbox__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  color: #e9e1da;
  font-size: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, .22); }
.lightbox__close { top: calc(8px + env(safe-area-inset-top, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); font-size: 20px; }
.lightbox__prev { left: max(8px, env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.lightbox__next { right: max(8px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
.lightbox__btn:disabled { opacity: .25; cursor: default; }
body.lb-open { overflow: hidden; }

/* ---------- 10. Бронь ---------- */
.booking { display: grid; gap: 18px; align-items: start; }
.booking__main { display: grid; gap: 18px; min-width: 0; }

.step {
  min-width: 0;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.step__title {
  float: left;          /* так legend не «садится» на рамку fieldset */
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin-bottom: 16px;
  font: 400 20px/1 var(--font-head);
}
.step__title + * { clear: both; }
.step__num {
  font-family: var(--font-body);
  font-weight: 700;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--glow);
  color: var(--lava-deep);
  font-size: 13px;
}

/* Выбор дома */
.house-pick { display: grid; gap: 8px; }
.house-pick__group { margin: 6px 0 2px; font-size: 13px; font-weight: 600; color: var(--pumice); }
.house-pick__group:first-child { margin-top: 0; }
.house-opt {
  display: flex;
  flex-direction: column;   /* на телефоне цена — под названием */
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ash-0);
  color: var(--obsidian);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.house-opt:hover { border-color: var(--ember); }
.house-opt[aria-checked="true"] { border-color: var(--lava); background: #fff4ea; box-shadow: inset 0 0 0 1px var(--lava); }
.house-opt__name { font-weight: 600; white-space: nowrap; }
.house-opt__meta { font-size: 14px; color: var(--basalt); white-space: nowrap; }

/* Календарь */
.cal { position: relative; }
.cal__nav {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.cal__arrow {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-size: 22px;
  line-height: 1;
  color: var(--obsidian);
  cursor: pointer;
}
.cal__arrow:disabled { opacity: .35; cursor: default; }
.cal__months { display: grid; gap: 24px; }
.cal__month-title { height: 38px; display: grid; place-items: center; font-weight: 700; text-transform: capitalize; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 6px; }
.cal__wd { padding: 4px 0; font-size: 12px; text-align: center; color: var(--pumice); }
.cal__day {
  position: relative;
  aspect-ratio: 1;
  max-width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--obsidian);
  font: 600 15px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.cal__day:hover:not(:disabled) { background: var(--glow); }
.cal__day:disabled { cursor: default; color: #c3bab2; }
.cal__day.is-today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--lava);
}
/* Занятая ночь: зачёркнутая цифра на штриховке */
.cal__day.is-busy {
  color: #a39890;
  text-decoration: line-through;
  background: repeating-linear-gradient(135deg, #efe9e3 0 4px, #e4ddd5 4px 8px);
}
.cal__day.is-busy:not(:disabled) { color: var(--basalt); }   /* занятый день можно выбрать как день выезда */
.cal__day.is-range { background: #fde7d3; border-radius: 0; color: var(--obsidian); text-decoration: none; }
.cal__day.is-start,
.cal__day.is-end { background: var(--lava); color: #fff; text-decoration: none; }
.cal__day.is-start { border-radius: 10px 0 0 10px; }
.cal__day.is-end { border-radius: 0 10px 10px 0; }
.cal__day.is-start.is-single { border-radius: 10px; }

.cal__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 13px; color: var(--basalt); }
.cal__legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); }
.lg--free { background: var(--paper); }
.lg--busy { background: repeating-linear-gradient(135deg, #efe9e3 0 3px, #ddd4cb 3px 6px); }
.lg--sel { background: var(--lava); border-color: var(--lava); }
.cal__hint { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ash-0); font-weight: 600; }
.cal__hint.is-warn { background: #fdecea; color: var(--err); }

/* Поля формы */
.row { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.step > .field { margin-top: 14px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--basalt); }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--obsidian);
  font: 16px/1.3 var(--font-body);   /* 16px — iPhone не увеличивает страницу при вводе */
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--lava); box-shadow: 0 0 0 3px rgba(224, 83, 43, .18); }
.field.is-error input { border-color: var(--err); box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }

/* Ловушка для ботов — за пределами экрана */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--basalt); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--lava); flex-shrink: 0; }
.check a { color: var(--lava-deep); }

/* Итог брони */
.summary {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -28px rgba(29, 25, 22, .45);
}
.summary__title { font-size: 18px; }
.summary__list { display: grid; gap: 10px; margin: 0; }
.summary__list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.summary__list dt { color: var(--pumice); flex-shrink: 0; }
.summary__list dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.summary__total b { font: 700 26px/1 var(--font-body); font-variant-numeric: tabular-nums; }
.summary__btn { width: 100%; }
.summary__note { font-size: 13px; color: var(--pumice); }
.summary__note a { color: var(--lava-deep); white-space: nowrap; }

/* Индикатор «отправляется» */
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status { min-height: 1.4em; font-size: 14px; font-weight: 600; text-align: center; }
.status.is-success { color: var(--ok); }
.status.is-error { color: var(--err); }

/* Экран «Бронь принята» */
.done {
  max-width: 560px;
  margin: 0 auto;
  padding: 36px 24px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  text-align: center;
}
.done__icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  fill: none; stroke: var(--ok); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.done__title { font-size: 24px; }
.done__text { margin-top: 12px; color: var(--basalt); white-space: pre-line; }
.done__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }

/* ---------- 11. Вопросы ---------- */
.faq { display: grid; gap: 10px; }
.faq__item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.faq__item[open] { border-color: var(--ember); }
.faq__item summary {
  position: relative;
  padding: 18px 52px 18px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font: 400 26px/1 var(--font-body);
  color: var(--lava);
  transition: transform .25s;
}
.faq__item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq__item p { padding: 0 20px 18px; color: var(--basalt); }
.faq__item a { color: var(--lava-deep); }

/* ---------- 12. Контакты (тёмный блок «обсидиан») ---------- */
.section--dark {
  background:
    radial-gradient(ellipse at 15% 110%, rgba(224, 83, 43, .28), transparent 55%),
    var(--obsidian);
  color: #f3eee9;
}
.contacts { display: grid; gap: 32px; }
.contacts__info { min-width: 0; }
.contacts__phone {
  display: inline-block;
  margin: 18px 0 10px;
  font: 700 clamp(24px, 6.4vw, 32px)/1.1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
}
.contacts__phone:hover { color: var(--ember); }
.contacts__addr { color: #cfc6bf; }

.socials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: border-color .2s, background-color .2s;
}
.social::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ember)); }
.social:hover { border-color: var(--c, var(--ember)); background: rgba(255, 255, 255, .05); }
.social--wa   { --c: #25d366; }
.social--tg   { --c: #2aabee; }
.social--ig   { --c: #e1306c; }
.social--2gis { --c: #8fd14f; }
.socials__note { margin-top: 10px; font-size: 12px; line-height: 1.4; color: #8f857e; }

.callback {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
}
.callback__title { font-size: 18px; }
.callback__row { display: grid; gap: 14px; }
.callback .field__label { color: #cfc6bf; }
.callback .field input { background: #fff; }
.callback .check { color: #cfc6bf; }
.callback .check a { color: var(--ember); }
.callback .status.is-success { color: #8fd9a8; }
.callback .status.is-error { color: #ff9b8a; }

.contacts__map { display: grid; gap: 12px; min-width: 0; }
.map {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .14);
  /* Заглушка «карта» из градиентов, пока карта не загружена */
  background:
    repeating-linear-gradient(32deg, transparent 0 46px, rgba(255, 255, 255, .05) 46px 48px),
    repeating-linear-gradient(-58deg, transparent 0 70px, rgba(255, 255, 255, .05) 70px 72px),
    radial-gradient(circle at 50% 50%, rgba(244, 162, 89, .3), transparent 42%),
    #2a2420;
}
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map__btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--obsidian);
  font: 600 15px/1 var(--font-body);
  cursor: pointer;
}
.map__btn svg { width: 20px; height: 20px; fill: none; stroke: var(--lava); stroke-width: 2; }
.route { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.route a { color: var(--ember); font-weight: 600; }

/* ---------- 13. Подвал ---------- */
.footer {
  padding-block: 26px calc(96px + env(safe-area-inset-bottom, 0px));  /* место под мобильную панель */
  background: var(--night);
  color: #a79d95;
  font-size: 14px;
}
.footer__inner { display: flex; flex-direction: column; gap: 8px; }
.footer__logo { width: 150px; height: auto; }
.footer__link { color: inherit; }
.footer__link:hover { color: var(--ember); }
.footer__legal { display: block; font-size: 12px; color: #8f857e; }   /* реквизиты владельца */
.footer__legal[hidden] { display: none; }

/* ---------- 14. Быстрая связь внизу экрана (телефоны) ---------- */
.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 6px;
  padding: 8px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: rgba(253, 252, 250, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.mobile-bar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--obsidian);
}
.mobile-bar__btn svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.mobile-bar__btn--lava { background: var(--lava); color: #fff; }

/* =========================================================
   АДАПТИВ
   ========================================================= */
@media (min-width: 600px) {
  .house-opt { flex-direction: row; align-items: center; }
  .row, .callback__row { grid-template-columns: 1fr 1fr; }
  .why { grid-template-columns: 1fr 1fr; gap: 26px 32px; }
  .hero__actions .btn { flex: 0 0 auto; }
  .gallery { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 210px; }
  .gallery__item--wide { grid-column: span 2; }
  .gallery__item--wide:last-child { grid-column: 1 / -1; }   /* последнее фото — на всю ширину */
  .bath { grid-template-columns: auto 1fr auto; }
  .bath__price { grid-column: auto; }
  .step { padding: 24px; }
}

@media (min-width: 720px) {
  .hcards--big { grid-template-columns: 1fr 1fr; }
  .hcards--small { grid-template-columns: 1fr 1fr; }
  .album__grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 150px; gap: 10px; }
  .album__tile:first-child { grid-column: span 2; }
  .album__empty { grid-column: 1 / -1; }
  .cal__months { grid-template-columns: 1fr 1fr; gap: 32px; }   /* два месяца рядом */
}

@media (min-width: 960px) {
  :root { --header-h: 76px; }

  /* Меню — строкой в шапке */
  .burger { display: none; }
  .nav {
    position: static;
    flex-direction: row;
    gap: 24px;
    margin-left: auto;
    background: none;
    opacity: 1;
    visibility: visible;
  }
  .nav__link { font: 500 15px/1 var(--font-body); white-space: nowrap; }
  .logo { margin-right: 0; }
  .logo__mark { height: 54px; }
  .logo__word { height: 19px; }
  .header__phone { display: block; margin-left: 10px; }
  .header__cta { display: inline-flex; min-height: 42px; padding: 10px 18px; }

  .hero { padding: calc(var(--header-h) + 70px) 0 250px; }
  .hero__mountains { height: 340px; }
  .hero__sun { width: 300px; height: 300px; bottom: 150px; }
  .hero__smoke {
    bottom: calc(max(21.53vw, 251px) - 6px);
    left: calc(50% + max(13.06vw, 152px) - 33px);
  }
  .hero__lead { font-size: 19px; }
  .hero__facts b { font-size: 26px; }

  .section { padding-block: 96px; }
  .section--tight { padding-block: 48px; }
  .why { grid-template-columns: repeat(4, 1fr); }
  .houses { grid-template-columns: 1fr 1fr; gap: 22px; }
  .hcards { gap: 22px; }
  .hcards--small { grid-template-columns: repeat(3, 1fr); }
  .hcards--small .hcard__name { font-size: 28px; }
  .house__body { padding: 26px 28px 28px; }
  .album__grid { grid-auto-rows: 190px; }

  /* Бронь: форма слева, итог «прилипает» справа */
  .booking { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
  .summary { position: sticky; top: calc(var(--header-h) + 16px); }

  .contacts { grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
  .map { min-height: 420px; }

  .mobile-bar { display: none; }
  .footer { padding-block: 26px; }
  .footer__inner { flex-direction: row; justify-content: space-between; align-items: center; }
}

@media (min-width: 960px) and (max-width: 1320px) {
  .header__phone { display: none; }   /* не помещается — номер остаётся в контактах */
  .nav { gap: 18px; }
}
@media (min-width: 960px) and (max-width: 1100px) {
  .nav__link[href="#faq"] { display: none; }   /* узкий экран: «Вопросы» — только в прокрутке */
}

/* Настройка «уменьшить движение» — без анимаций */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .hero__smoke { display: none; }
}
