/* ============================================================
   APPLE-STYLE UI  ·  светлая (по умолчанию) + тёмная темы
   ============================================================ */

/* ---- СВЕТЛАЯ ТЕМА (default) ---- */
:root{
  --bg:        #f5f5f7;
  --bg-2:      #ffffff;
  --surface:   rgba(255,255,255,.72);
  --surface-2: rgba(255,255,255,.55);
  --border:    rgba(0,0,0,.10);
  --ink:       #1d1d1f;
  --ink-dim:   #6e6e73;
  --accent:    #0071e3;        /* Apple blue */
  --accent-ink:#ffffff;

  /* статусы (как цвет ячейки в шахматке) */
  --free:      #34c759;
  --reserved:  #ff9f0a;
  --sold:      #8e8e93;

  /* SVG-слои (адаптируются к теме) */
  --svg-line:  rgba(0,0,0,.16);
  --svg-soft:  rgba(0,0,0,.04);
  --svg-panel: rgba(0,0,0,.03);
  --svg-text:  #6e6e73;

  --radius:    20px;
  --radius-sm: 13px;
  --shadow:    0 12px 40px rgba(0,0,0,.12);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.18);
  --ease:      cubic-bezier(.4,.0,.2,1);
  --font: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
}

/* ---- ТЁМНАЯ ТЕМА ---- */
[data-theme="dark"]{
  --bg:        #0a0a0c;
  --bg-2:      #1c1c1e;
  --surface:   rgba(28,28,30,.66);
  --surface-2: rgba(44,44,46,.5);
  --border:    rgba(255,255,255,.12);
  --ink:       #f5f5f7;
  --ink-dim:   #98989d;
  --accent:    #2997ff;
  --accent-ink:#ffffff;

  --svg-line:  rgba(255,255,255,.16);
  --svg-soft:  rgba(255,255,255,.05);
  --svg-panel: rgba(255,255,255,.03);
  --svg-text:  #98989d;

  --shadow:    0 12px 40px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.6);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:var(--font); color:var(--ink);
  background:var(--bg);
  overflow:hidden; user-select:none;
  -webkit-font-smoothing:antialiased;
  transition:background .5s var(--ease), color .5s var(--ease);
}

/* ============ ВЕРХНЯЯ ПАНЕЛЬ ============ */
.topbar{
  position:fixed; inset:0 0 auto 0; height:52px; z-index:30;
  display:flex; align-items:center; gap:22px; padding:0 22px;
  background:var(--surface); border-bottom:1px solid var(--border);
  backdrop-filter:saturate(180%) blur(20px); -webkit-backdrop-filter:saturate(180%) blur(20px);
}
.brand{display:flex; align-items:center; gap:9px; font-weight:600; letter-spacing:-.2px}
.brand__mark{color:var(--accent); font-size:17px}
.brand__name{font-size:15px}
.breadcrumbs{display:flex; align-items:center; gap:4px}
.crumb{
  background:none; border:0; color:var(--ink-dim); cursor:pointer;
  font-size:13px; padding:6px 10px; border-radius:9px; transition:.2s; font-family:inherit;
}
.crumb:hover{color:var(--ink); background:var(--surface-2)}
.crumb.is-active{color:var(--ink); font-weight:600}
.crumb + .crumb::before{content:'›'; color:var(--ink-dim); margin-right:6px; opacity:.6}
.legend{margin-left:auto; display:flex; gap:15px; font-size:12px; color:var(--ink-dim)}
.topbar.is-home .breadcrumbs,
.topbar.is-home .legend{ display:none; }
.legend__item{display:flex; align-items:center; gap:6px}
.legend__item i{width:9px; height:9px; border-radius:50%; display:inline-block}

/* ---- ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ (Apple switch) ---- */
.theme-toggle{
  position:relative; width:58px; height:30px; flex:0 0 auto;
  border:1px solid var(--border); border-radius:999px; cursor:pointer;
  background:var(--surface-2); padding:0; transition:.3s var(--ease);
  display:flex; align-items:center; justify-content:space-between;
}
.theme-toggle__icon{font-size:13px; width:24px; text-align:center; line-height:1; pointer-events:none; transition:.3s; opacity:.6}
.theme-toggle__icon.is-sun{color:#ff9f0a}
.theme-toggle__icon.is-moon{color:#5e9eff}
.theme-toggle__knob{
  position:absolute; top:2px; left:2px; width:24px; height:24px; border-radius:50%;
  background:#fff; box-shadow:0 2px 6px rgba(0,0,0,.3);
  transition:transform .32s var(--ease), background .3s;
}
[data-theme="dark"] .theme-toggle__knob{ transform:translateX(28px); background:#2c2c2e; }

/* ============ СЦЕНА / ЭКРАНЫ ============ */
.stage{position:fixed; inset:0; z-index:10}
.screen{
  position:absolute; inset:0;
  opacity:0; visibility:hidden; transform:scale(1.03);
  transition:opacity .55s var(--ease), transform .65s var(--ease), visibility .55s;
  pointer-events:none;
}
.screen.is-active{opacity:1; visibility:visible; transform:scale(1); pointer-events:auto}
.screen.is-exit-zoom{opacity:0; transform:scale(1.4)}
.screen.is-enter-zoom{opacity:0; transform:scale(.66)}

/* ============ ЭКРАН 1: КОМПЛЕКС (реальный рендер) ============ */
.screen--complex{display:flex; align-items:center; justify-content:center}
.complex-canvas{position:absolute; inset:0; overflow:hidden}
.hero{position:absolute; inset:0}
.hero__img{
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  object-position:center 42%;
}
/* мягкий скрим снизу под заголовок (читаемость в обеих темах) */
.hero::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(180deg, rgba(0,0,0,.15) 0%, transparent 22%, transparent 55%, rgba(0,0,0,.55) 100%);
}
[data-theme="light"] .hero::after,
:root .hero::after{
  background:linear-gradient(180deg, rgba(0,0,0,.10) 0%, transparent 24%, transparent 52%, rgba(0,0,0,.5) 100%);
}
/* переключатель фасадов */
.facade-nav{
  position:absolute; bottom:36px; left:50%; transform:translateX(-50%);
  z-index:20; display:flex; align-items:center; gap:14px;
  background:var(--surface); border:1px solid var(--border); border-radius:999px;
  padding:8px 16px; backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px); box-shadow:var(--shadow);
}
.facade-btn{
  width:36px; height:36px; border-radius:50%; border:0; cursor:pointer;
  background:transparent; color:var(--ink); font-size:22px; line-height:1;
  display:flex; align-items:center; justify-content:center;
  transition:.18s var(--ease); padding:0;
}
.facade-btn:hover{ background:var(--accent); color:var(--accent-ink); }
.facade-dots{ display:flex; gap:8px; align-items:center; }
.facade-dot{
  width:8px; height:8px; border-radius:50%; cursor:pointer;
  background:var(--border); border:0; padding:0; transition:.2s;
}
.facade-dot.is-active{ background:var(--accent); transform:scale(1.3); }

/* ---- hero (реальный рендер) ---- */
.hero{ position:absolute; inset:0; }
.hero__img{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; object-position:center 42%;
  transition:opacity .4s ease;
}
.hero__video{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; object-position:center 42%;
  opacity:0; pointer-events:none;
}
.hero__canvas{
  position:absolute; inset:0; width:100%; height:100%;
  opacity:0; pointer-events:none; transition:opacity .15s ease;
  z-index:2;
}
.hero::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(180deg,rgba(0,0,0,.10) 0%,transparent 24%,transparent 52%,rgba(0,0,0,.5) 100%);
}

/* «луч» выбранного этажа поверх рендера */
.floor-beam{
  position:absolute; left:0; right:0; height:8%; pointer-events:none; opacity:0;
  border-top:1.5px solid var(--accent); border-bottom:1.5px solid var(--accent);
  box-shadow:0 0 30px rgba(0,113,227,.35), inset 0 0 40px rgba(0,113,227,.15);
  transition:top .35s var(--ease), opacity .25s;
}
.floor-beam.is-on{opacity:.9}

/* столбец этажей */
.floor-rail{
  display:none;
}
.floor-rail__title{
  text-align:center; font-size:11px; letter-spacing:.5px; text-transform:uppercase;
  color:var(--ink-dim); padding:13px 0 8px; font-weight:600;
}
.floor-rail__list{overflow-y:auto; padding:0 8px 10px; scrollbar-width:thin}
.floor-chip{
  display:flex; align-items:center; justify-content:space-between;
  padding:9px 11px; margin:3px 0; border-radius:11px; cursor:pointer;
  border:1px solid transparent; transition:.18s var(--ease);
}
.floor-chip:hover{background:var(--accent); color:var(--accent-ink); transform:scale(1.03)}
.floor-chip:hover .floor-chip__dot{box-shadow:none}
.floor-chip__num{font-weight:600; font-size:15px}
.floor-chip__dot{width:8px; height:8px; border-radius:50%; background:var(--free)}
.floor-chip__dot.is-none{background:var(--sold)}

/* заголовок ЖК */
.complex-intro{
  position:absolute; left:44px; bottom:44px; max-width:440px; z-index:15; color:#fff;
  text-shadow:0 2px 24px rgba(0,0,0,.5);
}
.complex-intro h1{font-size:46px; margin:0 0 6px; font-weight:700; letter-spacing:-1px}
.complex-intro p{margin:0; font-size:17px; opacity:.9}
.complex-intro .hint{margin-top:16px; font-size:13px; opacity:.85; display:inline-flex; align-items:center; gap:7px}
.complex-intro .hint::before{content:'→'; font-size:15px}

/* ============ ЭКРАН 2: ПЛАН ЭТАЖА ============ */
.floor-head{
  position:absolute; top:70px; left:0; right:0; z-index:15;
  display:flex; align-items:center; gap:16px; padding:0 34px;
}
.floor-head h2{margin:0; font-size:28px; font-weight:700; letter-spacing:-.5px}
.floor-head__stat{color:var(--ink-dim); font-size:14px}
.back-btn{
  background:var(--surface); border:1px solid var(--border); color:var(--ink);
  padding:9px 16px; border-radius:980px; cursor:pointer; font-size:13px; font-weight:500;
  transition:.18s; backdrop-filter:blur(14px); font-family:inherit;
}
.back-btn:hover{background:var(--accent); color:var(--accent-ink); border-color:transparent}
.floor-canvas{position:absolute; inset:118px 40px 40px; display:flex; align-items:center; justify-content:center}
.floor-canvas svg{width:100%; height:100%; max-width:1000px}

.apt-cell{cursor:pointer; transition:.2s var(--ease)}
.apt-cell:hover{filter:brightness(1.08) saturate(1.1)}
.apt-cell.is-sold{cursor:not-allowed}
.apt-shape{stroke:rgba(0,0,0,.18); stroke-width:1.5; transition:.2s}
.apt-cell:hover .apt-shape{stroke:var(--accent); stroke-width:3}
.apt-label{fill:#fff; font-size:13px; font-weight:700; pointer-events:none}
.apt-sub{fill:rgba(255,255,255,.85); font-size:10px; pointer-events:none}

.floor-tooltip{
  position:fixed; z-index:40; pointer-events:none;
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:9px 13px; font-size:13px; box-shadow:var(--shadow); color:var(--ink);
  backdrop-filter:saturate(180%) blur(20px);
  transform:translate(-50%,-120%); white-space:nowrap;
}
.floor-tooltip b{color:var(--accent)}

/* ============ ЭКРАН 3: КВАРТИРА ============ */
.apt-grid{position:absolute; inset:64px 0 0 0; display:grid; grid-template-columns:1.4fr 1fr; background:var(--bg)}
.apt-plan{position:relative; display:flex; align-items:center; justify-content:center; padding:48px}
.apt-plan .back-btn{position:absolute; top:24px; left:34px; z-index:5}
.apt-plan__canvas{width:100%; max-width:600px}
.apt-plan__canvas svg{width:100%; height:auto}
.apt-plan-img{width:100%; height:auto; display:block; border-radius:12px; object-fit:contain}

.apt-info{
  background:var(--bg-2); border-left:1px solid var(--border);
  padding:56px 50px; display:flex; flex-direction:column; overflow-y:auto;
}
.apt-info h2{font-size:32px; margin:0 0 4px; font-weight:700; letter-spacing:-.5px}
.apt-info .apt-status{
  display:inline-flex; align-items:center; gap:7px; align-self:flex-start;
  padding:6px 13px; border-radius:999px; font-size:13px; font-weight:600; margin:8px 0 28px;
}
.apt-status i{width:8px; height:8px; border-radius:50%}
.apt-specs{display:grid; grid-template-columns:1fr 1fr; gap:18px 24px; margin-bottom:28px}
.spec{border-bottom:1px solid var(--border); padding-bottom:12px}
.spec__k{font-size:12px; color:var(--ink-dim); text-transform:uppercase; letter-spacing:.4px}
.spec__v{font-size:22px; font-weight:600; margin-top:4px}
.apt-price{font-size:34px; font-weight:700; letter-spacing:-1px; margin:4px 0 26px}
.apt-price small{display:block; font-size:13px; color:var(--ink-dim); font-weight:400; margin-top:5px; letter-spacing:0}
.btn-tour{
  display:flex; align-items:center; justify-content:center; gap:9px;
  background:var(--accent); color:var(--accent-ink); border:0; border-radius:14px; padding:17px;
  cursor:pointer; font-size:16px; font-weight:600; transition:.2s var(--ease); font-family:inherit;
}
.btn-tour:hover{filter:brightness(1.08); transform:translateY(-1px)}
.btn-tour:active{transform:scale(.99)}
.btn-tour:disabled{background:var(--sold); cursor:not-allowed; opacity:.7; transform:none; filter:none}
.btn-cta-sec{
  margin-top:11px; background:var(--surface-2); border:1px solid var(--border); color:var(--ink);
  padding:15px; border-radius:14px; cursor:pointer; font-size:14px; font-weight:500;
  transition:.2s; font-family:inherit;
}
.btn-cta-sec:hover{background:var(--surface); border-color:var(--accent); color:var(--accent)}

/* ============ ЭКРАН 4: ТУР ============ */
.screen--tour{background:#000}
.pano{position:absolute; inset:0}
.tour-close{
  position:absolute; top:70px; right:26px; z-index:50;
  background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.25); color:#fff;
  padding:11px 18px; border-radius:980px; cursor:pointer; font-size:14px; font-weight:500;
  backdrop-filter:blur(12px); font-family:inherit;
}
.tour-close:hover{background:rgba(255,255,255,.28)}
.tour-rooms{
  position:absolute; bottom:28px; left:50%; transform:translateX(-50%); z-index:50;
  display:flex; gap:6px; background:rgba(255,255,255,.14); padding:6px; border-radius:16px;
  backdrop-filter:blur(16px); border:1px solid rgba(255,255,255,.2);
}
.room-btn{
  background:transparent; border:0; color:#fff; padding:9px 18px; border-radius:11px;
  cursor:pointer; font-size:13px; font-weight:500; transition:.18s; font-family:inherit;
}
.room-btn:hover{background:rgba(255,255,255,.15)}
.room-btn.is-active{background:#fff; color:#1d1d1f; font-weight:600}

/* ============ ЗОНЫ ПОДЪЕЗДОВ ============ */
.hero__sections{
  position:absolute; inset:0; width:100%; height:100%;
  z-index:5; overflow:visible; pointer-events:none;
}
.hero__sections.is-visible{ pointer-events:all }

.hero__section-img{
  opacity:0;
  transition:opacity .25s ease;
  z-index:2;
}

.section-zone{
  fill:transparent;
  stroke:none;
  cursor:pointer;
}

.section-tooltip{
  position:fixed; z-index:200; pointer-events:none;
  background:rgba(255,255,255,.90);
  backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  border:1px solid rgba(0,0,0,.08); border-radius:13px;
  padding:10px 16px; opacity:0; transition:opacity .16s ease;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
}
[data-theme="dark"] .section-tooltip{
  background:rgba(28,28,30,.88); border-color:rgba(255,255,255,.12);
}
.section-tooltip__title{
  margin:0; font-size:14px; font-weight:600; color:var(--ink);
}
.section-tooltip__sub{
  margin:2px 0 0; font-size:12px; color:var(--ink-dim);
}

/* ============ КОНТАКТНЫЙ DOCK ============ */
.contact-dock{
  position:fixed; right:24px; bottom:24px; z-index:900;
  display:flex; align-items:flex-end; gap:10px;
  padding:12px 16px;
  background:rgba(20,20,24,.72);
  backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  border:1px solid rgba(255,255,255,.10);
  border-radius:22px;
  box-shadow:0 8px 32px rgba(0,0,0,.35);
}
.dock-icon{
  position:relative; display:grid; place-items:center;
  width:48px; height:48px; border-radius:14px;
  color:#fff; text-decoration:none; flex-shrink:0;
  transition:width .12s ease, height .12s ease, border-radius .12s ease;
  will-change:width,height;
}
.dock-icon--tg   { background:#2aabee; }
.dock-icon--wa   { background:#25d366; }
.dock-icon--mail { background:#555; }

.dock-icon:hover { filter:brightness(1.12); }

.dock-label{
  position:absolute; bottom:calc(100% + 8px); left:50%;
  transform:translateX(-50%);
  white-space:nowrap;
  background:rgba(20,20,24,.9);
  color:#fff; font-size:11px; font-weight:500; letter-spacing:.2px;
  padding:4px 10px; border-radius:8px;
  opacity:0; pointer-events:none;
  transition:opacity .15s ease;
  box-shadow:0 4px 12px rgba(0,0,0,.3);
}
.dock-icon:hover .dock-label{ opacity:1; }

/* ============ ОВЕРЛЕЙ «ПОЛЁТА» ============ */
.fly-overlay{
  position:fixed; inset:0; z-index:60; pointer-events:none; opacity:0;
  background:radial-gradient(circle at center, transparent 0%, var(--bg) 78%);
}
.fly-overlay.is-on{animation:flyflash .65s var(--ease)}
@keyframes flyflash{0%{opacity:0} 45%{opacity:.85} 100%{opacity:0}}

/* ============ ЗАСТАВКА ============ */
.intro-overlay{
  position:fixed; inset:0; z-index:950;
  background:#000;
  transition:opacity .5s ease;
}
.intro-overlay.is-hiding{ opacity:0; pointer-events:none; }

.intro-video{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover; object-position:center;
}

/* Текст поверх видео — fixed, центрируется трансформом */
.intro-text{
  position:fixed;
  left:50%; top:50%;
  transform:translate(-50%,-50%);
  color:#fff;
  text-shadow:0 2px 32px rgba(0,0,0,.6);
  max-width:820px;
  z-index:951;
  pointer-events:none;
  /* opacity управляется Motion */
}
.intro-text__pre{
  margin:0 0 8px;
  font-size:22px; font-weight:400; letter-spacing:4px;
  text-transform:uppercase; opacity:.75;
}
.intro-text__title{
  margin:0 0 20px;
  font-size:148px; font-weight:700; letter-spacing:-4px; line-height:.95;
}
.intro-text__line{
  width:72px; height:2px;
  background:rgba(255,255,255,.5);
  margin-bottom:20px;
  transform-origin:left center;
}
.intro-text__sub{
  margin:0;
  font-size:42px; font-weight:400; opacity:.88;
}

.intro-skip{
  position:fixed; right:40px; bottom:40px; z-index:952;
  background:rgba(255,255,255,.12);
  backdrop-filter:blur(14px) saturate(180%);
  -webkit-backdrop-filter:blur(14px) saturate(180%);
  border:1px solid rgba(255,255,255,.22);
  border-radius:28px;
  color:#fff; font-size:14px; letter-spacing:.2px;
  padding:10px 24px; cursor:pointer;
  transition:background .2s, opacity .4s;
  opacity:0;
}
.intro-skip.is-visible{ opacity:1; }
.intro-skip:hover{ background:rgba(255,255,255,.24); }

/* Скрываем постоянный заголовок пока идёт заставка */
body.intro-playing .complex-intro{ opacity:0; }

/* ============ ВИДЕО-ОВЕРЛЕЙ ПОДЪЕЗДА ============ */
.section-video-overlay{
  position:fixed; inset:0; z-index:940;
  background:#000;
  opacity:0;
  transition:opacity .35s ease;
  pointer-events:all;
}
.section-video-overlay.is-visible{ opacity:1; }
.section-video{
  width:100%; height:100%;
  object-fit:cover; object-position:center;
  display:block;
}

/* ============ ИНТЕРАКТИВНЫЙ ПЛАН ЭТАЖА ============ */
.floor-plan-wrap{
  position:absolute; inset:0;
}
.floor-plan-base,
.floor-plan-hover{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:contain; object-position:center;
  display:block;
}
.floor-plan-hover{
  opacity:0;
  transition:opacity .15s ease;
  pointer-events:none;
}

/* ============ АДАПТИВ ============ */
@media (max-width:760px){
  .legend{display:none}
  .complex-intro{left:20px; bottom:110px; max-width:74vw}
  .complex-intro h1{font-size:32px}
  .floor-rail{right:14px; width:70px}
  .apt-grid{grid-template-columns:1fr; grid-template-rows:1fr auto}
  .apt-info{border-left:0; border-top:1px solid var(--border); padding:28px 24px}
}
