/* ============================================================
   ЧАСОСЛОВ · Park View — ПРОТОТИП, Фаза 1 (3 сцени)
   Една променлива управлява всичко: --t ∈ [0..1] (скролът).
   Всички светлинни състояния са ЧИСТИ CSS ПРОИЗВОДНИ на --t —
   нищо не се анимира само по себе си.
   Сцени:  06:47 Изгрев  →  21:12 Син час  →  Нощ · Съзвездие
   ============================================================ */

:root {
  --t: 0;
  /* производни на сцените (clamp върху отсечки от деня) */
  --dawn:  clamp(0, calc(var(--t) / 0.34), 1);
  --blue:  clamp(0, calc((var(--t) - 0.34) / 0.30), 1);
  --night: clamp(0, calc((var(--t) - 0.64) / 0.22), 1);
  /* палитра — само брандът; коралът е ЕДИНСТВЕНО слънчева светлина */
  --ink: #040F1C;
  --navy: #061A2D;
  --navy-2: #081E34;
  --ivory: #F4EFE3;
  --ivory-hi: #FBF7EC;
  --champagne: #D9C7A0;
  --champagne-hi: #E9DCBE;
  --coral: #CF7A4A;
  --terra: #C2622E;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { background: var(--ink); color: var(--ivory); font-family: var(--sans); overflow-x: clip; }
img { display: block; max-width: 100%; }
a { color: inherit; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 90; background: var(--terra); color: #fff; padding: 12px 16px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- постоянен слой ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px clamp(16px, 3vw, 40px);
  background: linear-gradient(180deg, rgba(4, 15, 28, .72), rgba(4, 15, 28, 0));
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar__brand { display: inline-flex; align-items: center; min-height: 44px; gap: 12px; text-decoration: none; }
.bar__name { font-size: .72rem; font-weight: 700; letter-spacing: .26em; color: var(--ivory-hi); }
.bar__proto { font-size: .6rem; font-weight: 600; letter-spacing: .2em; color: var(--champagne); border: 1px solid rgba(217, 199, 160, .4); padding: 4px 8px; }
.bar__right { display: inline-flex; align-items: center; gap: 18px; }
.bar__clock { font-variant-numeric: tabular-nums; font-size: .82rem; letter-spacing: .18em; color: var(--champagne-hi); min-width: 4.4ch; text-align: right; }
.bar__free {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ivory-hi); text-decoration: none; border: 1px solid rgba(217, 199, 160, .35); border-radius: 999px;
  background: rgba(6, 26, 45, .5); cursor: pointer; font-family: var(--sans);
}
.bar__free:hover, .bar__free:focus-visible { border-color: var(--champagne-hi); }
:is(a, button):focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

/* ---------- timeline + сцена ---------- */
.timeline { height: 640vh; position: relative; }
/* dvh: сцената следва РЕАЛНО видимия екран на iOS (URL барът се скрива при
   скрол и svh оставяше ~90px гола ивица под сцената). Fallback: vh. */
.stage { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: clip; background: var(--ink); }

/* хоризонт-линията: пътят на слънцето. Изгрява (--dawn), слиза (--blue), гасне (--night) */
.horizon {
  position: absolute; left: 0; right: 0; height: 2px; z-index: 6; pointer-events: none;
  top: calc(80% - var(--dawn) * 28% + var(--blue) * 24%);
  background: linear-gradient(90deg, transparent, var(--coral) 18%, var(--champagne-hi) 50%, var(--coral) 82%, transparent);
  /* слънцето залязва: линията потъва и гасне със синия час, изчезва в нощта */
  opacity: calc((0.35 + var(--dawn) * 0.65) * (1 - var(--blue) * 0.72) * (1 - var(--night)));
  box-shadow: 0 0 calc(14px + var(--dawn) * 26px - var(--blue) * 18px) rgba(207, 122, 74, .8);
}

/* химн-надпис на главата (долу вляво) */
.chapter {
  position: absolute; left: clamp(16px, 3.4vw, 44px); bottom: clamp(18px, 4vh, 40px); z-index: 7;
  font-size: .68rem; font-weight: 700; letter-spacing: .3em; text-transform: uppercase;
  color: var(--champagne); pointer-events: none;
}

/* ============ СЦЕНА 1 · 06:47 ИЗГРЕВ ============ */
.sc-dawn {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  opacity: calc(1 - clamp(0, calc((var(--t) - 0.34) / 0.08), 1));
}
.sc-dawn__sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 65% at 50% 86%, rgba(207, 122, 74, .38), transparent 55%),
    linear-gradient(180deg, #05121F 0%, #0A2036 55%, #27374B 78%, #6E5844 92%, #A05C36 100%);
  opacity: var(--dawn);
}
.sc-dawn__img-wrap { position: absolute; inset: 0; display: grid; place-items: end center; }
/* мек преход небе → камък по горния ръб на кадъра */
.sc-dawn__img-wrap::before {
  content: ""; position: absolute; left: 0; right: 0; top: 20%; height: 14%; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, #05121F 0%, rgba(5, 18, 31, 0) 100%);
}
.sc-dawn__img-wrap img {
  width: 100%; height: 78%; object-fit: cover; object-position: 50% 30%;
  /* светлината пропълзява по камъка: маска, карана от --dawn */
  -webkit-mask-image: linear-gradient(100deg, #000 calc(var(--dawn) * 135% - 40%), transparent calc(var(--dawn) * 135%));
  mask-image: linear-gradient(100deg, #000 calc(var(--dawn) * 135% - 40%), transparent calc(var(--dawn) * 135%));
  filter: brightness(calc(0.55 + var(--dawn) * 0.5)) saturate(calc(0.8 + var(--dawn) * 0.25));
}
/* топла утринна следа върху камъка — пикова в средата на изгрева */
.sc-dawn__warm {
  position: absolute; inset: 22% 0 0 0; mix-blend-mode: soft-light; pointer-events: none;
  background: radial-gradient(110% 80% at 18% 78%, rgba(207, 122, 74, .9), transparent 62%);
  opacity: calc(var(--dawn) * (1 - var(--dawn)) * 2.6);
}
.sc-dawn__copy { position: absolute; left: clamp(18px, 5vw, 72px); top: 24%; z-index: 2; }
.sc-dawn__kicker {
  display: block; font-size: .66rem; font-weight: 700; letter-spacing: .34em; text-transform: uppercase;
  color: var(--champagne); margin-bottom: 20px;
  clip-path: inset(0 calc((1 - clamp(0, calc((var(--dawn) - 0.22) / 0.3), 1)) * 100%) 0 0);
}
.sc-dawn__title {
  --k: clamp(0, calc((var(--dawn) - 0.3) / 0.45), 1);
  font-family: var(--serif); font-weight: 500; font-size: clamp(2.5rem, 6.4vw, 5.2rem); line-height: 1.04;
  max-width: 11ch;
  color: var(--ivory-hi);
  /* светлината минава през буквите: мек mask sweep (работи и на много редове) */
  -webkit-mask-image: linear-gradient(100deg, #000 calc(var(--k) * 150% - 45%), transparent calc(var(--k) * 150%));
  mask-image: linear-gradient(100deg, #000 calc(var(--k) * 150% - 45%), transparent calc(var(--k) * 150%));
  text-shadow: 0 1px 30px rgba(4, 15, 28, .55);
}
.sc-dawn__title em { font-style: italic; color: var(--coral); }

/* ============ СЦЕНА 2+3 · ГРАДЪТ (една и съща архитектура, различна светлина) ============ */
.sc-city {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
  opacity: clamp(0, calc((var(--t) - 0.30) / 0.09), 1);
}
.sc-city__sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #050E1A 0%, #0A2036 46%, #10304E 72%, #1B3A55 100%);
  opacity: 1;
}
/* нощно небе: тънък звезден шум само от CSS */
.sc-city__stars {
  position: absolute; inset: 0; opacity: calc(var(--night) * .8);
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(233, 220, 190, .8), transparent 100%),
    radial-gradient(1px 1px at 34% 9%, rgba(233, 220, 190, .55), transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 22%, rgba(233, 220, 190, .7), transparent 100%),
    radial-gradient(1px 1px at 76% 12%, rgba(233, 220, 190, .5), transparent 100%),
    radial-gradient(1px 1px at 89% 26%, rgba(233, 220, 190, .65), transparent 100%),
    radial-gradient(1.2px 1.2px at 22% 31%, rgba(233, 220, 190, .45), transparent 100%),
    radial-gradient(1px 1px at 47% 15%, rgba(233, 220, 190, .6), transparent 100%);
  background-repeat: no-repeat;
}
.city {
  position: relative; width: min(96%, calc(92svh * 1.6667)); aspect-ratio: 1920 / 1152;
  filter: brightness(calc(1 - var(--blue) * 0.42 - var(--night) * 0.22)) saturate(calc(1 - var(--blue) * 0.3));
}
.city svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* фасадните пътища от продукционната карта — тук са само геометрия, не контроли.
   В синия час стъклата ловят последното небе: студен отблясък, гаснещ с нощта
   (дограмата Е монтирана — реалните кадри го доказват). */
.city svg .facade__floor {
  pointer-events: none; stroke: none; transition: fill .4s ease, stroke .4s ease;
  fill: rgb(150 190 235 / calc(var(--blue) * (1 - var(--night)) * 0.06));
}
/* ВАРИАНТ А: „етажната лента" — при hover/tap/focus на прозорец целият РЕАЛЕН
   етажен полигон светва: етажът е верен, точката е символ */
.city svg .facade__floor.is-hi {
  fill: rgba(217, 199, 160, .13);
  stroke: rgba(233, 220, 190, .8);
  stroke-width: 2.5;
}
@media (prefers-reduced-motion: reduce) { .city svg .facade__floor { transition: none; } }
/* вечерен въздух + нощен слой върху фасадата */
.city::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 26, 45, .85) 0%, rgba(6, 26, 45, .55) 40%, rgba(4, 15, 28, .92) 100%);
  opacity: calc(var(--blue) * 0.52 + var(--night) * 0.3);
}
/* ХИБРИД 1+3: сградата е ИЗЦЯЛО тъмна (в строеж — истината).
   Светлините са кварталът в дълбочината: дребно, меко, безформено боке
   в страничните ленти на кадъра — никога върху фасадата.
   Каскадата в синия час е тук, не по сградата. */
.glows { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.glow {
  position: absolute; aspect-ratio: 1; border-radius: 50%; width: 0.6%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(233, 220, 190, .75), rgba(233, 220, 190, .22) 55%, transparent 100%);
  filter: blur(3px);
  opacity: calc(
    clamp(0, calc((var(--blue) * (var(--N) + 7) - var(--i)) / 6), 1)
    * var(--dim, .4) * (1 - var(--night) * 0.15)
  );
}

/* ============ СЦЕНА 3 · СЪЗВЕЗДИЕТО ============ */
.cwins { position: absolute; inset: 0; z-index: 4; opacity: var(--night); }
.stage:not(.is-night) .cwins { pointer-events: none; }
.cwin { position: absolute; transform: translate(-50%, -50%); }
.cwin__btn {
  min-width: 44px; min-height: 44px; width: 48px; height: 62px;
  /* едва доловимо champagne очертание — прозорец, който чака */
  border: 1px solid rgba(217, 199, 160, .28); border-radius: 3px; cursor: pointer;
  background: rgba(8, 30, 52, .16);
  transition: background .45s ease, box-shadow .45s ease, border-color .45s ease;
}
.cwin__btn:hover, .cwin__btn:focus-visible, .cwin.is-lit .cwin__btn {
  background: radial-gradient(70% 62% at 50% 40%, var(--champagne-hi), rgba(207, 122, 74, .9) 66%, rgba(160, 92, 54, .55) 100%);
  border-color: var(--champagne-hi);
  box-shadow: 0 0 26px rgba(207, 122, 74, .75), 0 0 70px rgba(207, 122, 74, .3);
}
.cwin.is-lit .cwin__btn { box-shadow: 0 0 34px rgba(207, 122, 74, .9), 0 0 90px rgba(207, 122, 74, .38); }
/* картичка на обекта — само реални стойности от данните */
.cwin__card {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  width: max-content; min-width: 240px; max-width: 300px;
  background: rgba(4, 15, 28, .94); border: 1px solid rgba(217, 199, 160, .35);
  padding: 16px 18px 14px; text-align: left; z-index: 5;
  display: none;
}
.cwin.is-open .cwin__card { display: block; }
.cwin:hover .cwin__card, .cwin:focus-within .cwin__card { display: block; }
.cwin__name { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; color: var(--ivory-hi); margin-bottom: 6px; }
.cwin__row { display: flex; justify-content: space-between; gap: 16px; font-size: .8rem; padding: 4px 0; border-top: 1px solid rgba(217, 199, 160, .16); }
.cwin__row span { color: rgba(244, 239, 227, .62); }
.cwin__row b { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ivory); }
.cwin__note { margin-top: 8px; font-size: .68rem; line-height: 1.5; color: rgba(244, 239, 227, .55); }
.cwin__cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; margin-top: 12px; padding: 0 18px; width: 100%;
  background: var(--terra); color: var(--ivory-hi); text-decoration: none;
  font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
}
.cwin__cta:hover { background: var(--coral); }
.cwin__close {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 44px;
  background: none; border: 0; color: rgba(244, 239, 227, .6); font-size: 1.2rem; cursor: pointer;
}
.cwin__close:hover { color: var(--ivory-hi); }
/* подпис на съзвездието + изходът към продажбите */
.night-note {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: clamp(56px, 9vh, 84px); z-index: 4;
  text-align: center; width: min(92%, 46ch); pointer-events: none;
  opacity: clamp(0, calc((var(--night) - 0.45) / 0.4), 1);
}
.night-note h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.5rem, 3.2vw, 2.4rem); color: var(--ivory-hi); }
.night-note h2 em { font-style: italic; color: var(--champagne-hi); }
.night-note p { margin-top: 8px; font-size: .82rem; color: rgba(244, 239, 227, .68); }
.night-note .exit {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; margin-top: 18px; padding: 0 30px;
  background: var(--terra); color: var(--ivory-hi); text-decoration: none;
  font-size: .7rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  border-radius: 999px;
}
.night-note .exit:hover { background: var(--coral); }

/* „денят се затваря": авторски изход към pv.html#imoti */
.leave-veil {
  position: fixed; inset: 0; z-index: 80; pointer-events: none; background: var(--ink);
  opacity: 0; transition: opacity .42s ease;
}
.leave-veil::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--coral) 30%, var(--champagne-hi) 50%, var(--coral) 70%, transparent);
  box-shadow: 0 0 34px rgba(207, 122, 74, .8);
  opacity: 0; transition: opacity .3s ease .1s;
}
body.is-leaving .leave-veil { opacity: 1; pointer-events: auto; }
body.is-leaving .leave-veil::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .leave-veil, .leave-veil::before { transition: none; }
}

/* cross-document View Transition: НЕ е активиран. Истинският морф изисква
   `@view-transition { navigation: auto; }` И ТУК, И в pv.html (production
   решение). Сам, редът само кара браузъра да логва 'Transition was skipped'.
   Дотогава изходът е авторският воал .leave-veil по-горе. */
.facade-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(244, 239, 227, .7); font-size: .9rem; padding: 24px; text-align: center; }

/* ---------- финален семантичен списък (и no-JS изход) ---------- */
.list { background: var(--navy); padding: clamp(56px, 9vh, 110px) clamp(18px, 4vw, 64px); }
.list h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.7rem, 3.6vw, 2.6rem); color: var(--ivory-hi); margin-bottom: 8px; }
.list > p { color: rgba(244, 239, 227, .65); font-size: .9rem; margin-bottom: 26px; }
.list ul { list-style: none; display: grid; gap: 12px; max-width: 760px; }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; border: 1px solid rgba(217, 199, 160, .22); padding: 14px 18px; }
.list li b { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.list li span { font-size: .82rem; color: rgba(244, 239, 227, .68); font-variant-numeric: tabular-nums; }
.list li a { margin-left: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; border: 1px solid rgba(217, 199, 160, .4); }
.list li a:hover { border-color: var(--champagne-hi); }

/* ---------- мобилен портрет ---------- */
@media (max-width: 700px) {
  /* палцов скрол: 6.4 екрана са уморителни на телефон — 4.8 пазят
     драматургията (сцените са фракции от --t, темпото се свива равномерно) */
  .timeline { height: 480vh; }
  .sc-dawn__copy { top: 22%; }
  .sc-dawn__img-wrap img { height: 64%; }
  /* фасадата е широка — на портрет я уголемяваме и центрираме, за да са тап-ясни прозорците */
  .city { width: 175%; max-width: none; }
  .cwin__card { min-width: 220px; max-width: min(300px, 86vw); }
  .bar__name { display: none; }
  /* подписът и етикетът на главата не се допират: бележката по-нагоре,
     главата — компактна в самото дъно */
  .night-note { bottom: 92px; }
  .night-note h2 { font-size: 1.35rem; }
  .night-note p { font-size: .76rem; }
  .chapter { bottom: max(12px, env(safe-area-inset-bottom)); left: 16px; font-size: .58rem; letter-spacing: .24em; }
}

/* ---------- reduced motion: нищо не тлее, нищо не се плъзга ---------- */
@media (prefers-reduced-motion: reduce) {
  .cwin__btn { transition: none; }
}

/* ---------- no-JS: сцените не могат да се карат от скрола — показваме списъка ---------- */
.nojs-note { background: var(--ink); color: var(--champagne); padding: 18px; text-align: center; font-size: .85rem; }
