/* ═══════════════════════════════════════════════════════════════════════════
   ЖК Бицепс Хаус — Demo Landing
   BicepsAI · Stage 7 Wave 5 · Designer W7
   Vanilla CSS, no framework. BEM: .demo-{block}__{element}--{modifier}
   Palette synced with cab-frontend.md — primary #2563eb
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Brand palette (matches project) */
  --demo-primary: #2563eb;
  --demo-primary-hover: #1d4ed8;
  --demo-primary-dark: #1e40af;
  --demo-primary-tint: #3b82f6;
  --demo-primary-bg: #eff6ff;

  --demo-text: #0f172a;
  --demo-text-secondary: #475569;
  --demo-text-muted: #94a3b8;
  --demo-border: #e2e8f0;
  --demo-border-strong: #cbd5e1;
  --demo-bg: #ffffff;
  --demo-bg-subtle: #f8fafc;
  --demo-bg-hover: #f1f5f9;

  /* Status palette (matches Wave 3 shahmatka spec §6) */
  --status-free-bg: #dcfce7;
  --status-free-border: #86efac;
  --status-free-text: #14532d;
  --status-free-hover: #bbf7d0;

  --status-booked-bg: #fef3c7;
  --status-booked-border: #fcd34d;
  --status-booked-text: #78350f;
  --status-booked-hover: #fde68a;

  --status-sold-bg: #f1f5f9;
  --status-sold-border: #e2e8f0;
  --status-sold-text: #94a3b8;

  /* Accent for marketing (gradient) */
  --demo-accent-1: #2563eb;
  --demo-accent-2: #7c3aed;

  /* Shadows */
  --demo-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --demo-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.10), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --demo-shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.10), 0 4px 10px -4px rgba(15, 23, 42, 0.05);
  --demo-shadow-xl: 0 25px 50px -12px rgba(15, 23, 42, 0.25);

  /* Radii */
  --demo-radius-sm: 6px;
  --demo-radius-md: 10px;
  --demo-radius-lg: 16px;
  --demo-radius-xl: 24px;
  --demo-radius-full: 9999px;

  /* Fluid typography */
  --demo-text-xs: 0.75rem;
  --demo-text-sm: 0.875rem;
  --demo-text-base: 1rem;
  --demo-text-lg: clamp(1.05rem, 1rem + 0.3vw, 1.15rem);
  --demo-text-xl: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
  --demo-text-2xl: clamp(1.35rem, 1.2rem + 0.8vw, 1.75rem);
  --demo-text-3xl: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  --demo-text-4xl: clamp(2.25rem, 1.5rem + 3vw, 3.75rem);

  --demo-container: 1200px;
}

/* ─────────── Reset & base ─────────── */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body.demo-body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--demo-text-base);
  line-height: 1.6;
  color: var(--demo-text);
  background: var(--demo-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: var(--demo-primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--demo-primary-hover); }

/* `hidden` must beat flex/grid display in this stylesheet */
[hidden] { display: none !important; }

/* Focus visible baseline */
:focus-visible {
  outline: 2px solid var(--demo-primary);
  outline-offset: 2px;
  border-radius: var(--demo-radius-sm);
}

/* Skip link (a11y) */
.demo-skip-link {
  position: absolute;
  top: -64px;
  left: 16px;
  padding: 8px 16px;
  background: var(--demo-primary);
  color: #fff;
  border-radius: var(--demo-radius-sm);
  z-index: 1000;
  transition: top 0.15s ease;
}
.demo-skip-link:focus-visible { top: 16px; color: #fff; }

/* ─────────── Section shell ─────────── */

.demo-section {
  padding: clamp(56px, 6vw, 96px) 0;
  position: relative;
}

.demo-section__inner {
  max-width: var(--demo-container);
  padding: 0 clamp(16px, 3vw, 32px);
  margin: 0 auto;
}

.demo-section__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.demo-section__title {
  font-size: var(--demo-text-3xl);
  font-weight: 800;
  color: var(--demo-text);
  margin-bottom: 12px;
}

.demo-section__kicker {
  font-size: var(--demo-text-lg);
  color: var(--demo-text-secondary);
  max-width: 640px;
}

/* ─────────── Buttons ─────────── */

.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: var(--demo-text-base);
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--demo-radius-md);
  background: transparent;
  color: var(--demo-text);
  text-decoration: none;
  line-height: 1;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
  white-space: nowrap;
}
.demo-btn:active { transform: translateY(1px); }

.demo-btn--primary {
  background: var(--demo-primary);
  color: #fff;
  box-shadow: var(--demo-shadow-sm);
}
.demo-btn--primary:hover { background: var(--demo-primary-hover); color: #fff; box-shadow: var(--demo-shadow-md); }

.demo-btn--outline {
  background: var(--demo-bg);
  color: var(--demo-text);
  border-color: var(--demo-border-strong);
}
.demo-btn--outline:hover { background: var(--demo-bg-hover); color: var(--demo-primary); border-color: var(--demo-primary); }

.demo-btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}
.demo-btn--ghost:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

.demo-btn--white {
  background: #fff;
  color: var(--demo-primary-dark);
  box-shadow: var(--demo-shadow-md);
}
.demo-btn--white:hover { background: var(--demo-bg-subtle); color: var(--demo-primary-dark); }

.demo-btn--lg {
  padding: 16px 28px;
  font-size: var(--demo-text-lg);
  min-height: 56px;
}

.demo-btn--block { width: 100%; }

.demo-btn:disabled,
.demo-btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.demo-btn__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.demo-btn:hover .demo-btn__arrow { transform: translateX(4px); }

.demo-btn__icon { flex-shrink: 0; }

/* ═════════════════════ HERO ═════════════════════ */

.demo-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 40%, #2563eb 70%, #3b82f6 100%);
  color: #fff;
  min-height: 640px;
  padding-bottom: clamp(48px, 6vw, 80px);
}

.demo-hero__bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.demo-hero__shape {
  position: absolute; border-radius: 50%; filter: blur(72px); opacity: 0.5;
}
.demo-hero__shape--a {
  width: 520px; height: 520px;
  top: -120px; right: -80px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
}
.demo-hero__shape--b {
  width: 420px; height: 420px;
  bottom: -100px; left: -60px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
}
.demo-hero__shape--c {
  width: 300px; height: 300px;
  top: 30%; right: 20%;
  background: radial-gradient(circle, #60a5fa 0%, transparent 70%);
  opacity: 0.3;
}

/* Topbar */
.demo-topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--demo-container);
  margin: 0 auto;
  padding: clamp(16px, 2vw, 24px) clamp(16px, 3vw, 32px);
  z-index: 2;
}
.demo-topbar__brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-weight: 700; font-size: var(--demo-text-lg);
}
.demo-topbar__brand:hover { color: #fff; opacity: 0.9; }
.demo-topbar__brand-mark {
  width: 32px; height: 32px;
  background: #fff; color: var(--demo-primary-dark);
  border-radius: var(--demo-radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem;
}
.demo-topbar__links {
  display: flex; align-items: center; gap: clamp(12px, 2vw, 28px);
}
.demo-topbar__link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  font-size: var(--demo-text-sm);
}
.demo-topbar__link:hover { color: #fff; }
.demo-topbar__cta {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--demo-radius-md);
  color: #fff;
  font-weight: 600;
  font-size: var(--demo-text-sm);
  transition: background-color 0.15s ease;
}
.demo-topbar__cta:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }

.demo-hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--demo-container);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 72px) clamp(16px, 3vw, 32px) 0;
  text-align: center;
}

.demo-hero__eyebrow {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--demo-radius-full);
  font-size: var(--demo-text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 24px;
  backdrop-filter: blur(6px);
}

.demo-hero__title {
  font-size: var(--demo-text-4xl);
  font-weight: 800;
  margin-bottom: 16px;
  color: #fff;
}

.demo-hero__subtitle {
  font-size: var(--demo-text-xl);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 16px;
}

.demo-hero__lede {
  font-size: var(--demo-text-lg);
  color: rgba(255, 255, 255, 0.85);
  max-width: 640px;
  margin: 0 auto 40px;
}

.demo-hero__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 24px);
  max-width: 720px;
  margin: 0 auto 40px;
}
.demo-hero__stat {
  padding: 20px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--demo-radius-lg);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.demo-hero__stat-value {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.demo-hero__stat-label {
  font-size: var(--demo-text-xs);
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.demo-hero__actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.demo-hero__disclaimer {
  font-size: var(--demo-text-sm);
  color: rgba(255, 255, 255, 0.7);
  max-width: 560px;
  margin: 0 auto;
}
.demo-hero__disclaimer-link {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.demo-hero__disclaimer-link:hover { color: #fff; opacity: 0.85; }

/* ═════════════════════ ABOUT ═════════════════════ */

.demo-about {
  background: var(--demo-bg);
}

.demo-about__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.demo-card {
  padding: clamp(24px, 3vw, 32px);
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.demo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--demo-shadow-md);
  border-color: var(--demo-border-strong);
}
@media (prefers-reduced-motion: reduce) {
  .demo-card:hover { transform: none; }
}

.demo-card__icon {
  width: 56px; height: 56px;
  border-radius: var(--demo-radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.demo-card__icon--blue { background: #dbeafe; color: #1d4ed8; }
.demo-card__icon--green { background: #dcfce7; color: #166534; }
.demo-card__icon--purple { background: #ede9fe; color: #6d28d9; }

.demo-card__title {
  font-size: var(--demo-text-xl);
  font-weight: 700;
  color: var(--demo-text);
  margin-bottom: 12px;
}

.demo-card__text {
  font-size: var(--demo-text-base);
  color: var(--demo-text-secondary);
  line-height: 1.65;
}

.demo-card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--demo-primary);
  font-weight: 600;
  font-size: var(--demo-text-base);
  cursor: pointer;
  transition: color 0.15s ease;
}
.demo-card__link:hover { color: var(--demo-primary-hover); }
.demo-card__link:hover span { transform: translateX(4px); }
.demo-card__link span { transition: transform 0.2s ease; display: inline-block; }

/* ═════════════════════ ШАХМАТКА ═════════════════════ */

.demo-shahmatka-section {
  background: var(--demo-bg-subtle);
}

/* Toolbar */
.demo-shahmatka__toolbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 20px;
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-lg);
  box-shadow: var(--demo-shadow-sm);
  margin-bottom: 16px;
}

.demo-shahmatka__filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 140px;
  min-width: 0;
}
.demo-shahmatka__filter--checkbox {
  flex: 0 0 auto;
  justify-content: flex-end;
  padding-bottom: 10px;
}

.demo-shahmatka__filter-label {
  font-size: var(--demo-text-xs);
  font-weight: 600;
  color: var(--demo-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.demo-shahmatka__filter-input {
  padding: 10px 12px;
  font-size: var(--demo-text-sm);
  font-family: inherit;
  color: var(--demo-text);
  background: var(--demo-bg);
  border: 1px solid var(--demo-border-strong);
  border-radius: var(--demo-radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 42px;
  width: 100%;
}
.demo-shahmatka__filter-input:hover { border-color: var(--demo-primary-tint); }
.demo-shahmatka__filter-input:focus {
  outline: none;
  border-color: var(--demo-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.demo-shahmatka__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--demo-border-strong);
  border-radius: var(--demo-radius-md);
  background: var(--demo-bg);
  font-size: var(--demo-text-sm);
  font-weight: 500;
  color: var(--demo-text);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  min-height: 42px;
  white-space: nowrap;
}
.demo-shahmatka__checkbox:hover { background: var(--demo-bg-hover); border-color: var(--demo-primary-tint); }
.demo-shahmatka__checkbox input {
  accent-color: var(--demo-primary);
  width: 16px; height: 16px;
  margin: 0;
}
.demo-shahmatka__checkbox:has(input:checked) {
  background: var(--demo-primary-bg);
  border-color: var(--demo-primary);
  color: var(--demo-primary-dark);
}

.demo-shahmatka__reset {
  flex: 0 0 auto;
  margin-bottom: 0;
}

/* Legend */
.demo-shahmatka__legend {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-md);
  margin-bottom: 24px;
  font-size: var(--demo-text-sm);
  color: var(--demo-text-secondary);
}
.demo-shahmatka__legend-title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--demo-text-xs);
  color: var(--demo-text-muted);
}
.demo-shahmatka__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.demo-shahmatka__legend-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid;
  flex-shrink: 0;
}
.demo-shahmatka__legend-swatch--free {
  background: var(--status-free-bg); border-color: var(--status-free-border);
}
.demo-shahmatka__legend-swatch--booked {
  background: var(--status-booked-bg); border-color: var(--status-booked-border);
}
.demo-shahmatka__legend-swatch--sold {
  background: var(--status-sold-bg); border-color: var(--status-sold-border);
}
.demo-shahmatka__legend-count {
  background: var(--demo-bg-hover);
  padding: 2px 8px;
  border-radius: var(--demo-radius-full);
  font-size: var(--demo-text-xs);
  font-weight: 600;
  color: var(--demo-text);
  min-width: 20px;
  text-align: center;
}

/* Viewport (grid container with states) */
.demo-shahmatka__viewport {
  position: relative;
  min-height: 400px;
  padding: 24px;
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-lg);
  box-shadow: var(--demo-shadow-sm);
  overflow-x: auto;
}

.demo-shahmatka__loading,
.demo-shahmatka__empty,
.demo-shahmatka__error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
  text-align: center;
  min-height: 320px;
  color: var(--demo-text-secondary);
}

.demo-shahmatka__loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--demo-border);
  border-top-color: var(--demo-primary);
  border-radius: 50%;
  animation: demo-spin 0.8s linear infinite;
  margin-bottom: 8px;
}
@keyframes demo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .demo-shahmatka__loading-spinner { animation: none; }
}

.demo-shahmatka__empty-title,
.demo-shahmatka__error-title {
  font-size: var(--demo-text-xl);
  font-weight: 700;
  color: var(--demo-text);
}
.demo-shahmatka__empty-desc,
.demo-shahmatka__error-desc {
  max-width: 420px;
}

/* Grid — organized by section → floor → flats */
.demo-shahmatka__grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.demo-shahmatka__section {
  background: transparent;
}

.demo-shahmatka__section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--demo-border);
}
.demo-shahmatka__section-name {
  font-size: var(--demo-text-lg);
  font-weight: 700;
  color: var(--demo-text);
}
.demo-shahmatka__section-count {
  font-size: var(--demo-text-sm);
  color: var(--demo-text-muted);
}

.demo-shahmatka__floor {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.demo-shahmatka__floor-label {
  font-size: var(--demo-text-sm);
  font-weight: 700;
  color: var(--demo-text-muted);
  text-align: right;
  padding-right: 8px;
  border-right: 2px solid var(--demo-border);
}

.demo-shahmatka__floor-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.demo-shahmatka__flat {
  min-width: 72px;
  min-height: 60px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--status-free-bg);
  border: 1px solid var(--status-free-border);
  color: var(--status-free-text);
  border-radius: var(--demo-radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--demo-text-xs);
  line-height: 1.2;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  text-align: center;
}
.demo-shahmatka__flat:hover {
  transform: translateY(-1px);
  box-shadow: var(--demo-shadow-md);
  background: var(--status-free-hover);
}
.demo-shahmatka__flat:focus-visible {
  outline: 2px solid var(--demo-primary);
  outline-offset: 2px;
  z-index: 1;
}

.demo-shahmatka__flat--free {
  background: var(--status-free-bg);
  border-color: var(--status-free-border);
  color: var(--status-free-text);
}
.demo-shahmatka__flat--free:hover { background: var(--status-free-hover); }

.demo-shahmatka__flat--booked {
  background: var(--status-booked-bg);
  border-color: var(--status-booked-border);
  color: var(--status-booked-text);
}
.demo-shahmatka__flat--booked:hover { background: var(--status-booked-hover); }

.demo-shahmatka__flat--sold {
  background: var(--status-sold-bg);
  border-color: var(--status-sold-border);
  color: var(--status-sold-text);
  opacity: 0.75;
  cursor: default;
}
.demo-shahmatka__flat--sold:hover { transform: none; box-shadow: none; }

.demo-shahmatka__flat--selected {
  outline: 2px solid var(--demo-primary);
  outline-offset: 2px;
  z-index: 1;
}

.demo-shahmatka__flat--hidden {
  display: none;
}

.demo-shahmatka__flat-number {
  font-size: var(--demo-text-sm);
  font-weight: 700;
}
.demo-shahmatka__flat-meta {
  font-size: 10px;
  opacity: 0.8;
}
.demo-shahmatka__flat-price {
  font-size: 10px;
  font-weight: 600;
}
.demo-shahmatka__flat-mortgage-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  background: var(--demo-primary);
  border-radius: 50%;
}
.demo-shahmatka__flat { position: relative; }

/* Side panel (flat details) */
.demo-shahmatka__panel {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.demo-shahmatka__panel[hidden] { display: none; }

.demo-shahmatka__panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  animation: demo-fade-in 0.2s ease;
}
@keyframes demo-fade-in { from { opacity: 0; } to { opacity: 1; } }

.demo-shahmatka__panel-content {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(460px, 100%);
  background: var(--demo-bg);
  box-shadow: var(--demo-shadow-xl);
  padding: 32px;
  overflow-y: auto;
  animation: demo-slide-in 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
@keyframes demo-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {
  .demo-shahmatka__panel-content,
  .demo-shahmatka__panel-backdrop { animation: none; }
}

.demo-shahmatka__panel-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-sm);
  color: var(--demo-text-secondary);
  font-size: 24px;
  line-height: 1;
  transition: background-color 0.15s ease;
}
.demo-shahmatka__panel-close:hover { background: var(--demo-bg-hover); color: var(--demo-text); }

.demo-shahmatka__panel-title {
  font-size: var(--demo-text-2xl);
  font-weight: 800;
  color: var(--demo-text);
  padding-right: 48px;
}

.demo-shahmatka__panel-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--demo-radius-full);
  font-size: var(--demo-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: fit-content;
  background: var(--status-free-bg);
  color: var(--status-free-text);
  border: 1px solid var(--status-free-border);
}
.demo-shahmatka__panel-status[data-status="booked"] {
  background: var(--status-booked-bg);
  color: var(--status-booked-text);
  border-color: var(--status-booked-border);
}
.demo-shahmatka__panel-status[data-status="sold"] {
  background: var(--status-sold-bg);
  color: var(--status-sold-text);
  border-color: var(--status-sold-border);
}

.demo-shahmatka__panel-layout {
  aspect-ratio: 4 / 3;
  background: var(--demo-bg-subtle);
  border: 2px dashed var(--demo-border-strong);
  border-radius: var(--demo-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo-shahmatka__panel-layout-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--demo-text-muted);
  font-size: var(--demo-text-sm);
}
.demo-shahmatka__panel-layout img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: var(--demo-radius-md);
}

.demo-shahmatka__panel-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0;
  padding: 20px;
  background: var(--demo-bg-subtle);
  border-radius: var(--demo-radius-md);
}
.demo-shahmatka__panel-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.demo-shahmatka__panel-fact dt {
  font-size: var(--demo-text-xs);
  font-weight: 600;
  color: var(--demo-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.demo-shahmatka__panel-fact dd {
  margin: 0;
  font-size: var(--demo-text-base);
  font-weight: 600;
  color: var(--demo-text);
}
.demo-shahmatka__panel-fact--mortgage { grid-column: 1 / -1; }
.demo-shahmatka__panel-fact--mortgage dd {
  color: var(--demo-primary-dark);
  font-weight: 700;
}

.demo-shahmatka__panel-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

/* ═════════════════════ REVIEWS ═════════════════════ */

.demo-reviews {
  background: var(--demo-bg);
}

.demo-reviews__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.demo-review {
  margin: 0;
  padding: clamp(20px, 2vw, 28px);
  background: var(--demo-bg-subtle);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.demo-review__text {
  margin: 0;
  font-size: var(--demo-text-base);
  font-style: italic;
  line-height: 1.65;
  color: var(--demo-text);
  padding-left: 16px;
  border-left: 3px solid var(--demo-primary);
  quotes: "«" "»";
}

.demo-review__author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-review__avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--demo-primary), var(--demo-accent-2));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.demo-review__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.demo-review__name {
  font-weight: 600;
  color: var(--demo-text);
}
.demo-review__role {
  font-size: var(--demo-text-xs);
  color: var(--demo-text-muted);
}

.demo-marketplace {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--demo-primary-bg) 0%, #ede9fe 100%);
  border: 1px solid #c7d2fe;
  border-radius: var(--demo-radius-lg);
  flex-wrap: wrap;
}

.demo-marketplace__badge {
  padding: 4px 12px;
  background: var(--demo-primary);
  color: #fff;
  border-radius: var(--demo-radius-full);
  font-size: var(--demo-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.demo-marketplace__text {
  font-size: var(--demo-text-base);
  color: var(--demo-text);
  line-height: 1.5;
}

/* ═════════════════════ CTA ═════════════════════ */

.demo-cta {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #7c3aed 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.demo-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

.demo-cta__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.demo-cta__title {
  font-size: var(--demo-text-3xl);
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.demo-cta__text {
  font-size: var(--demo-text-lg);
  color: rgba(255, 255, 255, 0.9);
}

/* ═════════════════════ FOOTER ═════════════════════ */

.demo-footer {
  background: #0f172a;
  color: rgba(255, 255, 255, 0.75);
  padding: 56px 0 24px;
  font-size: var(--demo-text-sm);
}

.demo-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

.demo-footer__col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.demo-footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: var(--demo-text-lg);
}
.demo-footer__brand:hover { color: #fff; opacity: 0.85; }

.demo-footer__tag {
  color: rgba(255, 255, 255, 0.6);
  max-width: 320px;
}

.demo-footer__title {
  font-size: var(--demo-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}

.demo-footer__link {
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.15s ease;
}
.demo-footer__link:hover { color: #fff; }
.demo-footer__link--inline { display: inline; }

.demo-footer__bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.demo-footer__copyright {
  color: rgba(255, 255, 255, 0.6);
}

.demo-footer__disclaimer {
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--demo-text-xs);
  line-height: 1.5;
  max-width: 640px;
}

/* ═════════════════════ CHAT WIDGET ═════════════════════ */

.demo-chat-widget__fab {
  position: fixed;
  bottom: clamp(16px, 3vw, 28px);
  right: clamp(16px, 3vw, 28px);
  width: 64px; height: 64px;
  border: none;
  background: linear-gradient(135deg, var(--demo-primary) 0%, var(--demo-accent-2) 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--demo-shadow-lg);
  cursor: pointer;
  z-index: 60;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.demo-chat-widget__fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--demo-shadow-xl);
}
.demo-chat-widget__fab:active { transform: translateY(0) scale(1); }

.demo-chat-widget__fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--demo-primary);
  opacity: 0;
  animation: demo-pulse 2s ease-in-out infinite;
}
@keyframes demo-pulse {
  0% { opacity: 0.5; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.35); }
  100% { opacity: 0; transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .demo-chat-widget__fab-pulse { animation: none; }
}

/* Chat modal */
.demo-chat-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: clamp(0px, 2vw, 24px);
}
.demo-chat-modal[hidden] { display: none; }

.demo-chat-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  animation: demo-fade-in 0.2s ease;
}

.demo-chat-modal__panel {
  position: relative;
  width: min(420px, 100%);
  max-height: min(640px, 100%);
  background: var(--demo-bg);
  border-radius: var(--demo-radius-lg);
  box-shadow: var(--demo-shadow-xl);
  display: flex;
  flex-direction: column;
  animation: demo-slide-up 0.25s ease;
  overflow: hidden;
}
@keyframes demo-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-chat-modal__panel, .demo-chat-modal__backdrop { animation: none; }
}

.demo-chat-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--demo-primary) 0%, var(--demo-primary-dark) 100%);
  color: #fff;
}
.demo-chat-modal__header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.demo-chat-modal__avatar {
  width: 40px; height: 40px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo-chat-modal__title {
  font-size: var(--demo-text-base);
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.demo-chat-modal__subtitle {
  font-size: var(--demo-text-xs);
  color: rgba(255, 255, 255, 0.85);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.demo-chat-modal__status-dot {
  width: 8px; height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

.demo-chat-modal__close {
  width: 32px; height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: var(--demo-radius-sm);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}
.demo-chat-modal__close:hover { background: rgba(255, 255, 255, 0.25); }

.demo-chat-modal__body {
  flex: 1 1 auto;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--demo-bg-subtle);
}

.demo-chat-modal__message {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: var(--demo-radius-md);
  font-size: var(--demo-text-sm);
  line-height: 1.5;
  animation: demo-message-in 0.2s ease;
}
@keyframes demo-message-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .demo-chat-modal__message { animation: none; }
}

.demo-chat-modal__message p { margin: 0; }
.demo-chat-modal__message p + p { margin-top: 6px; }

.demo-chat-modal__message--bot {
  align-self: flex-start;
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  color: var(--demo-text);
}

.demo-chat-modal__message--user {
  align-self: flex-end;
  background: var(--demo-primary);
  color: #fff;
  border: 1px solid var(--demo-primary);
}
.demo-chat-modal__message--user a { color: #fff; text-decoration: underline; }

.demo-chat-modal__suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.demo-chat-modal__suggestion {
  padding: 8px 12px;
  background: var(--demo-bg-subtle);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-sm);
  color: var(--demo-primary);
  font-weight: 500;
  font-size: var(--demo-text-sm);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  width: 100%;
}
.demo-chat-modal__suggestion:hover {
  background: var(--demo-primary-bg);
  border-color: var(--demo-primary);
}

.demo-chat-modal__form {
  padding: 16px 20px;
  border-top: 1px solid var(--demo-border);
  background: var(--demo-bg);
}
.demo-chat-modal__label {
  position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.demo-chat-modal__input {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--demo-text-sm);
  color: var(--demo-text);
  background: var(--demo-bg);
  border: 1px solid var(--demo-border-strong);
  border-radius: var(--demo-radius-md);
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.demo-chat-modal__input:focus {
  outline: none;
  border-color: var(--demo-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.demo-chat-modal__hint {
  margin-top: 4px;
  font-size: var(--demo-text-xs);
  color: var(--demo-text-muted);
}

.demo-chat-modal__actions {
  margin-top: 10px;
}

/* ═════════════════════ 152-ФЗ CONSENT ═════════════════════ */

.demo-chat-consent {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--demo-bg-subtle, #f8fafc);
  border: 1px solid var(--demo-border, #e2e8f0);
  border-radius: var(--demo-radius-md, 8px);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.demo-chat-consent--error {
  border-color: #dc2626;
  background: #fef2f2;
}

.demo-chat-consent__label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--demo-text-xs, 12px);
  line-height: 1.5;
  color: var(--demo-text-secondary, #64748b);
  cursor: pointer;
}

.demo-chat-consent__checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  cursor: pointer;
  accent-color: var(--demo-primary, #2563eb);
}

.demo-chat-consent__checkbox:focus-visible {
  outline: 2px solid var(--demo-primary, #2563eb);
  outline-offset: 2px;
}

.demo-chat-consent__text {
  flex: 1;
}

.demo-chat-consent__link {
  color: var(--demo-primary, #2563eb);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.demo-chat-consent__link:hover {
  color: var(--demo-primary-hover, #1d4ed8);
}

.demo-chat-consent__link:focus-visible {
  outline: 2px solid var(--demo-primary, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}

.demo-chat-consent__error {
  margin: 8px 0 0;
  padding: 0;
  font-size: var(--demo-text-xs, 12px);
  color: #dc2626;
  font-weight: 500;
}

.demo-chat-consent__error[hidden] {
  display: none;
}

/* ═════════════════════ RESPONSIVE ═════════════════════ */

@media (max-width: 1024px) {
  .demo-about__grid,
  .demo-reviews__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .demo-about__grid > *:last-child {
    grid-column: span 2;
  }
  .demo-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
  .demo-footer__col:first-child {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .demo-topbar {
    flex-wrap: wrap;
  }
  .demo-topbar__links {
    gap: 16px;
    font-size: var(--demo-text-sm);
  }
  .demo-topbar__link:not(.demo-topbar__cta) {
    display: none;
  }

  .demo-hero__stats {
    grid-template-columns: 1fr;
    max-width: 360px;
  }
  .demo-hero__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .demo-hero__actions .demo-btn { width: 100%; }

  .demo-about__grid,
  .demo-reviews__grid {
    grid-template-columns: 1fr;
  }
  .demo-about__grid > *:last-child {
    grid-column: span 1;
  }

  .demo-shahmatka__toolbar {
    gap: 12px;
    padding: 16px;
  }
  .demo-shahmatka__filter { flex: 1 1 100%; }
  .demo-shahmatka__filter--checkbox { flex: 1 1 100%; justify-content: flex-start; padding-bottom: 0; }
  .demo-shahmatka__reset { width: 100%; }

  .demo-shahmatka__viewport {
    padding: 16px;
  }
  .demo-shahmatka__floor {
    grid-template-columns: 48px 1fr;
    gap: 8px;
  }
  .demo-shahmatka__flat {
    min-width: 64px;
    min-height: 56px;
  }

  .demo-shahmatka__panel-content {
    padding: 24px;
  }
  .demo-shahmatka__panel-facts {
    grid-template-columns: 1fr;
  }

  .demo-cta__inner {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .demo-footer__grid {
    grid-template-columns: 1fr;
  }
  .demo-footer__col:first-child {
    grid-column: span 1;
  }
  .demo-footer__bottom {
    flex-direction: column;
  }

  .demo-chat-modal {
    padding: 0;
  }
  .demo-chat-modal__panel {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .demo-chat-widget__fab {
    width: 56px; height: 56px;
  }
}

/* Print */
@media print {
  .demo-chat-widget__fab,
  .demo-chat-modal,
  .demo-shahmatka__panel,
  .demo-topbar__cta { display: none !important; }
}
