/* Каталог аренды УК «Этажи Пхукет».
   Тёплая светлая витрина и тёмная тема на тех же переменных.
   Фирменный красный работает акцентом, а не заливкой. Шрифт системный —
   без внешних CDN и без layout shift. */

:root {
  --red: #e2231a;
  --red-dark: #b81a12;
  --ink: #16130f;
  --ink-soft: #5c554d;
  --ink-faint: #8d857b;
  --bg: #faf8f5;
  --top-bg: rgba(250, 248, 245, .92);
  --card: #ffffff;
  --chip: #f2ede6;
  --line: #e7e1d8;
  --ok: #1f8a5a;
  --busy: #e2231a;
  --skel-1: #efeae3;
  --skel-2: #f7f3ee;
  --note-bg: #fdf6ea;
  --note-line: #f0e0c4;
  --alarm-bg: #fdeeed;
  --alarm-line: #f5cfcc;
  --alarm-ink: #8c211b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 19, 15, .04), 0 8px 24px rgba(22, 19, 15, .06);
  --shadow-lift: 0 2px 4px rgba(22, 19, 15, .06), 0 16px 40px rgba(22, 19, 15, .1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Тёмная тема: системная по умолчанию, ручной выбор — data-theme на <html>. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #ff4b41;
    --red-dark: #e2231a;
    --ink: #f3ede5;
    --ink-soft: #b6ada2;
    --ink-faint: #8b8378;
    --bg: #131110;
    --top-bg: rgba(19, 17, 16, .9);
    --card: #1d1a17;
    --chip: #272320;
    --line: #332e28;
    --ok: #4cc38a;
    --busy: #ff4b41;
    --skel-1: #242019;
    --skel-2: #2d2822;
    --note-bg: #2a2318;
    --note-line: #423623;
    --alarm-bg: #2e1a18;
    --alarm-line: #4a2521;
    --alarm-ink: #ffb3ad;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .32);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .48);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --red: #ff4b41;
  --red-dark: #e2231a;
  --ink: #f3ede5;
  --ink-soft: #b6ada2;
  --ink-faint: #8b8378;
  --bg: #131110;
  --top-bg: rgba(19, 17, 16, .9);
  --card: #1d1a17;
  --chip: #272320;
  --line: #332e28;
  --ok: #4cc38a;
  --busy: #ff4b41;
  --skel-1: #242019;
  --skel-2: #2d2822;
  --note-bg: #2a2318;
  --note-line: #423623;
  --alarm-bg: #2e1a18;
  --alarm-line: #4a2521;
  --alarm-ink: #ffb3ad;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .32);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .48);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}

a { color: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* --- шапка --- */

.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--top-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top__inner { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; text-decoration: none; }
/* Фирменный знак «Этажи» — тот же вектор, что в проекте платформы. */
.brand__mark { width: 30px; height: 24px; flex: none; color: var(--red); }
.brand__text i { font-style: normal; color: var(--ink-faint); font-weight: 600; }
.freshness {
  margin-left: auto; font-size: 13px; color: var(--ink-faint);
  display: flex; align-items: center; gap: 7px;
}
.freshness__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}
.theme-toggle {
  width: 44px; height: 44px; flex: none; font-size: 17px; line-height: 1;
  background: var(--chip); color: var(--ink); border: 1px solid var(--line);
  border-radius: 11px; cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { transform: translateY(-1px); }

/* --- заголовок страницы --- */

.hero { padding: 48px 0 28px; }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(30px, 5vw, 46px); line-height: 1.05;
  letter-spacing: -.035em; font-weight: 800;
}
.hero p { margin: 0; color: var(--ink-soft); max-width: 62ch; }

/* --- фильтры --- */

.filters {
  display: grid; gap: 14px; padding: 18px; margin-bottom: 26px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
.field input, .field select {
  font: inherit; font-size: 15px; color: var(--ink);
  padding: 10px 12px; min-height: 44px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent);
}
.field input[type="range"] { padding: 0; min-height: 32px; accent-color: var(--red); border: 0; background: none; }
.range-value { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: 10px; }
.segmented button {
  flex: 1; font: inherit; font-size: 14px; font-weight: 600; min-height: 36px;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink-soft);
  cursor: pointer; transition: background .18s var(--ease), color .18s var(--ease);
}
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.filters__foot {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px;
  padding-top: 4px; border-top: 1px solid var(--line); margin-top: 2px;
}
.count { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.link-btn {
  margin-left: auto; font: inherit; font-size: 14px; background: none; border: 0;
  color: var(--red); cursor: pointer; padding: 8px; border-radius: 8px;
}
.link-btn:hover { background: color-mix(in srgb, var(--red) 10%, transparent); }

/* --- сетка карточек --- */

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); padding-bottom: 60px; }

.card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: card-in .4s var(--ease) both;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card:focus-visible { outline: 3px solid color-mix(in srgb, var(--red) 45%, transparent); outline-offset: 2px; }

@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cover {
  position: relative; aspect-ratio: 4 / 3; display: grid; align-content: center;
  padding: 22px; color: #fff; overflow: hidden; background: var(--chip);
}
.cover:not(.cover--photo)::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 85% 8%, rgba(255,255,255,.28), transparent 60%);
}
.cover--photo { padding: 0; }
.cover--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover__no { font-size: clamp(34px, 6vw, 52px); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.cover__complex { margin-top: 6px; font-size: 14px; font-weight: 600; opacity: .92; }
.badge {
  position: absolute; top: 14px; right: 14px; z-index: 1;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 6px 10px; border-radius: 999px; background: var(--card); color: var(--ink);
  box-shadow: var(--shadow);
}
.badge--free { color: var(--ok); }
.badge--busy { color: var(--busy); }
.badge--unknown { color: var(--ink-soft); }

.card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.card__meta { font-size: 14px; color: var(--ink-soft); }
.card__price { margin-top: auto; padding-top: 10px; display: flex; align-items: baseline; gap: 6px; }
.card__price b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card__price span { font-size: 13px; color: var(--ink-faint); }

/* --- скелетоны и пустое состояние --- */

.skeleton { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.skeleton__cover { aspect-ratio: 4 / 3; }
.skeleton__line { height: 12px; margin: 14px 18px; border-radius: 6px; }
.skeleton__cover, .skeleton__line {
  background: linear-gradient(90deg, var(--skel-1) 25%, var(--skel-2) 50%, var(--skel-1) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty {
  grid-column: 1 / -1; padding: 56px 24px; text-align: center;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h3 { margin: 0 0 8px; font-size: 19px; }
.empty p { margin: 0 0 18px; color: var(--ink-soft); }

/* --- кнопки --- */

.btn {
  font: inherit; font-weight: 700; font-size: 15px; min-height: 46px;
  padding: 12px 20px; border-radius: 11px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--red) 30%, transparent); }
.btn--primary:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn--ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* --- карточка объекта --- */

.unit-layout { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); padding-bottom: 60px; }
/* Без min-width:0 колонка грида растягивается под содержимое, и лента галереи
   из сорока миниатюр распирала страницу до 5690px вместо горизонтальной прокрутки. */
.unit-layout > * { min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel + .panel { margin-top: 20px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -.02em; }

.unit-hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.unit-hero .cover { aspect-ratio: 21 / 9; }

/* Галерея: первая фотография крупно, остальные лентой с прокруткой. */
.gallery { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; scroll-snap-type: x mandatory; }
.gallery img {
  height: 92px; width: 132px; object-fit: cover; border-radius: 10px; flex: none;
  cursor: pointer; scroll-snap-align: start; border: 2px solid transparent;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.gallery img:hover { transform: translateY(-2px); }
.gallery img[aria-current="true"] { border-color: var(--red); }

.specs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.specs li {
  font-size: 14px; font-weight: 600; padding: 7px 12px;
  background: var(--chip); border-radius: 999px; color: var(--ink-soft);
}

.prose { color: var(--ink-soft); white-space: pre-line; }

/* Тезисы: то, что клиент считывает за две секунды до чтения описания. */
.highlights {
  display: grid; gap: 10px; margin: 0 0 20px; padding: 0; list-style: none;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
}
.highlights li {
  position: relative; padding: 12px 14px 12px 38px; font-size: 14px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow);
}
.highlights li::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 10px; height: 10px;
  margin-top: -5px; border-radius: 3px; background: var(--red);
}

/* Лента сезонности: 12 столбиков, высота = месячная ставка. */
.season { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 148px; margin-bottom: 8px; }
.season__bar {
  background: linear-gradient(180deg, color-mix(in srgb, var(--red) 55%, var(--card)), var(--red));
  border-radius: 5px 5px 3px 3px; min-height: 6px; transition: filter .18s var(--ease);
}
.season__bar:hover { filter: brightness(1.1); }
.season__labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; font-size: 11px; color: var(--ink-faint); text-align: center; }
.season__value { font-variant-numeric: tabular-nums; }

/* Календарь занятости */
.cal { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.cal__month h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: capitalize; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal__day {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 11px;
  border-radius: 5px; background: var(--chip); color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.cal__day--busy { background: color-mix(in srgb, var(--red) 22%, var(--card)); color: var(--red); font-weight: 700; }
.cal__day--out { background: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

/* Расчёт */
.quote__total { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.quote__scroll { overflow-x: auto; }
.quote__table { width: 100%; min-width: 320px; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.quote__table th, .quote__table td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quote__table td:last-child, .quote__table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.note {
  font-size: 13px; line-height: 1.45; color: var(--ink-soft);
  background: var(--note-bg); border: 1px solid var(--note-line); border-radius: 10px; padding: 10px 12px; margin-top: 12px;
}
.note--alarm { background: var(--alarm-bg); border-color: var(--alarm-line); color: var(--alarm-ink); }

/* Форма */
.form { display: grid; gap: 12px; }
.form input, .form textarea {
  font: inherit; font-size: 15px; padding: 12px; min-height: 46px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); width: 100%;
}
.form textarea { min-height: 92px; resize: vertical; }
.form input:focus, .form textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent);
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__status { font-size: 14px; }
.form__status--ok { color: var(--ok); }
.form__status--err { color: var(--red); }

.sticky { position: sticky; top: 84px; }

.back { display: inline-flex; align-items: center; gap: 6px; margin: 24px 0 18px; font-size: 14px; color: var(--ink-soft); text-decoration: none; }
.back:hover { color: var(--ink); }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-faint); font-size: 13px; }

@media (max-width: 900px) {
  .unit-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}

@media (max-width: 560px) {
  .freshness span:not(.freshness__dot) { display: none; }
  .hero { padding: 32px 0 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
