/* Каркас. Значения токенов заменятся дизайн-системой (DESIGN.md). */
:root {
  --c-bg: #ffffff;
  --c-surface: #f5f4f1;
  --c-text: #1d1d1b;
  --c-muted: #6b6b66;
  --c-line: #e2e0da;
  --c-accent: #8a5a3b;
  --c-accent-ink: #ffffff;
  --st-free: #2e7d32;
  --st-reserved: #c77700;
  --st-sold: #9e9e9e;
  --st-off: #cfcfcf;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 10px;
  --gap: 16px;
  --container: 1200px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font: 16px/1.5 var(--font); }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--c-accent); }
h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; margin: 8px 0 20px; }
h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.2; margin: 32px 0 16px; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--c-muted); font-size: 14px; }
.sr-only, .lead-form__hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--c-bg); padding: 8px; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn--primary { background: var(--c-accent); color: var(--c-accent-ink); }
.btn--ghost { background: transparent; border-color: var(--c-line); color: var(--c-text); }
.btn--sm { min-height: 38px; padding: 6px 14px; font-size: 14px; }

/* шапка/подвал */
.site-header { border-bottom: 1px solid var(--c-line); background: var(--c-bg); position: sticky; top: 0; z-index: 20; }
.site-header__row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.logo { text-decoration: none; color: var(--c-text); font-weight: 700; }
.logo img { max-height: 44px; width: auto; }
.nav { flex: 1; }
.nav__list { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; }
.nav__list a { color: var(--c-text); text-decoration: none; }
.site-header__actions { display: flex; align-items: center; gap: 12px; }
.phone { color: var(--c-text); font-weight: 600; text-decoration: none; white-space: nowrap; }
.site-main { min-height: 60vh; padding-bottom: 48px; }
.site-footer { background: var(--c-surface); padding: 32px 0; font-size: 14px; }
.site-footer__grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.site-footer__title { font-weight: 700; }
.messengers a { margin-right: 12px; }
@media (max-width: 900px) {
  .nav { display: none; }
  .site-header__row { justify-content: space-between; }
}

/* крошки */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 16px 0 0; font-size: 14px; color: var(--c-muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; }
.crumbs a { color: var(--c-muted); }

/* главная */
.hero { background: var(--c-surface); padding: 48px 0; margin-bottom: 16px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* быстрый выбор по комнатности */
.rooms-quick { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 0; margin: 0 0 24px; }
.rooms-quick a { display: block; padding: 14px 16px; border: 1px solid var(--c-line); border-radius: var(--radius); color: var(--c-text); text-decoration: none; }
.rooms-quick a.is-active { border-color: var(--c-accent); }
.rooms-quick span { display: block; font-weight: 600; }
.rooms-quick small { color: var(--c-muted); }

/* фильтр */
.filter { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; padding: 16px; background: var(--c-surface); border-radius: var(--radius); margin-bottom: 24px; }
.filter__group { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; align-items: center; }
.filter__group legend { font-size: 13px; color: var(--c-muted); margin-bottom: 4px; }
.filter input[type=number], .filter select { width: 96px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--c-line); border-radius: 8px; font: inherit; background: #fff; }
.filter select { width: auto; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; cursor: pointer; }
.chip input:checked + span { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--c-accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }

/* карточки */
.flat-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.flat-card { border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.flat-card__link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.flat-card__plan { aspect-ratio: 1 / 1; padding: 16px; background: #fff; display: flex; align-items: center; justify-content: center; }
.flat-card__plan img { max-height: 100%; width: auto; object-fit: contain; }
.flat-card__body { padding: 12px 16px 16px; border-top: 1px solid var(--c-line); }
.flat-card__title { font-weight: 700; margin: 0; }
.flat-card__meta, .flat-card__m2 { color: var(--c-muted); font-size: 14px; margin: 2px 0; }
.flat-card__price { font-size: 20px; font-weight: 700; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.flat-card--sold, .flat-card--off { opacity: .6; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; color: #fff; margin-top: 8px; }
.badge--free { background: var(--st-free); }
.badge--reserved { background: var(--st-reserved); }
.badge--sold, .badge--off { background: var(--st-sold); }
.empty { padding: 32px; text-align: center; background: var(--c-surface); border-radius: var(--radius); }
.pagination { margin-top: 24px; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.page-numbers { padding: 8px 12px; border: 1px solid var(--c-line); border-radius: 8px; text-decoration: none; }
.page-numbers.current { background: var(--c-accent); color: var(--c-accent-ink); }

/* квартира */
.flat { display: grid; gap: 32px; grid-template-columns: 1.3fr 1fr; margin-top: 16px; }
@media (max-width: 900px) { .flat { grid-template-columns: 1fr; } }
.flat__plan { margin: 0 0 24px; border: 1px solid var(--c-line); border-radius: var(--radius); padding: 16px; background: #fff; }
.flat__plan img { margin: 0 auto; max-height: 640px; width: auto; }
.flat__title { margin-top: 0; }
.flat__price { font-size: 32px; font-weight: 700; margin: 16px 0 0; font-variant-numeric: tabular-nums; }
.flat__m2 { color: var(--c-muted); margin: 4px 0 16px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 16px 0; }
.specs div { border-bottom: 1px solid var(--c-line); padding: 6px 0; }
.specs dt { color: var(--c-muted); font-size: 13px; }
.specs dd { margin: 0; font-weight: 600; }
.calc { background: var(--c-surface); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; margin: 16px 0; }
.calc__title, .flat__cta-title { font-weight: 700; margin: 0; }
.calc label { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 14px; }
.calc input { width: 120px; min-height: 38px; padding: 4px 8px; border: 1px solid var(--c-line); border-radius: 8px; font: inherit; }
.calc__result { font-size: 20px; font-weight: 700; margin: 4px 0 0; }
.flat__cta { margin: 16px 0; }
.similar { margin-top: 48px; }

/* поэтажный план */
.floor-plan { margin: 0; border: 1px solid var(--c-line); border-radius: var(--radius); padding: 12px; background: #fff; }
.floor-plan figcaption { font-weight: 600; margin-bottom: 8px; }
.fp-flat { fill: transparent; stroke: transparent; stroke-width: 8; transition: fill .15s; cursor: pointer; }
.fp-flat--free { fill: rgba(46, 125, 50, .18); }
.fp-flat--reserved { fill: rgba(199, 119, 0, .18); }
.fp-flat--sold, .fp-flat--off { fill: rgba(120, 120, 120, .18); }
.fp-flat:hover { fill: rgba(138, 90, 59, .35); }
.fp-flat.is-current { fill: rgba(138, 90, 59, .55); stroke: var(--c-accent); }

/* формы */
.lead-form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field__label { font-size: 13px; color: var(--c-muted); }
.field input { min-height: 44px; padding: 8px 12px; border: 1px solid var(--c-line); border-radius: 8px; font: inherit; }
.lead-form__msg { margin: 0; font-size: 14px; }
.lead-form__msg.is-error { color: #b00020; }
.lead-form__msg.is-ok { color: var(--st-free); }

/* модалка */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal__box { background: #fff; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 420px; position: relative; }
.modal__title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.modal__close { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 28px; cursor: pointer; }

/* шахматка */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; padding: 0; margin: 0 0 16px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .cell { width: 18px; height: 18px; min-width: 0; min-height: 0; }
.chess-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.chess-tab { min-height: 40px; padding: 6px 16px; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.chess-tab.is-active { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent); }
.chess__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chess__table { border-collapse: separate; border-spacing: 4px; }
.chess__table th { font-weight: 600; color: var(--c-muted); padding-right: 8px; text-align: right; }
.cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; border-radius: 6px; color: #fff; text-decoration: none; font-size: 12px; line-height: 1.1; }
.cell__rooms { font-weight: 700; font-size: 14px; }
.cell--free { background: var(--st-free); }
.cell--reserved { background: var(--st-reserved); }
.cell--sold { background: var(--st-sold); }
.cell--off { background: var(--st-off); }

.content { max-width: 820px; }
.seo-text { margin-top: 40px; max-width: 820px; }
