/* «Солнце садится. Линия — нет.» — город из рваной бумаги, сутки в руках у посетителя (daynight.js).
   Слои сцены снизу вверх: небо (полосы глянцевой бумаги) → растр → звёзды → облака → солнце/луна → город
   (дома, тень-умножение, свет окон) → зерно бумаги → пунктиры звонков → значок «Ярус» → текст, стопка заявок, ручка.
   Цвет текста (--dn-ink) и пунктира (--dn-sig) ставит скрипт по цвету верхней полосы неба. */

main > section#daynight { padding: 0 !important; height: auto !important; min-height: 0 !important; display: block !important; background: #17181c; }
.dn-stage {
  --dn-nav: var(--v3-nav, 72px);
  --dn-ink: #17181c;
  --dn-sig: #17181c;
  --dn-body: 150px;
  --dn-grab: 118px;
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  color: var(--dn-ink);
  background: linear-gradient(#93c4d8, #b9dbe3 55%, #f1eedd);
}

/* ---------- слои */
.dn-sky, .dn-dots, .dn-stars, .dn-clouds, .dn-grain, .dn-fx { position: absolute; inset: 0; pointer-events: none; }
.dn-sky { z-index: 0; }
.dn-sky svg, .dn-stars svg { display: block; width: 100%; height: 100%; }
.dn-dots { z-index: 1; background-size: 6px 6px; will-change: opacity; }
.dn-dots--ink { background-image: radial-gradient(circle, rgb(23 24 28 / 13%) 0 1px, transparent 1.5px); }
.dn-dots--paper { background-image: radial-gradient(circle, rgb(251 250 246 / 9%) 0 1px, transparent 1.5px); opacity: 0; }
.dn-stars { z-index: 2; opacity: 0; will-change: opacity; }
.dn-clouds { z-index: 3; }
.dn-cloud { position: absolute; height: auto; }
.dn-cloud svg { display: block; width: 100%; height: auto; overflow: visible; }
.dn-cloud--0 { left: 55%; top: 11%; width: clamp(150px, 15vw, 250px); }
.dn-cloud--1 { left: 79%; top: 27%; width: clamp(110px, 11vw, 190px); }
.dn-cloud--2 { left: -2%; top: 50%; width: clamp(120px, 12vw, 210px); }
.dn-cloud--3 { left: 33%; top: 44%; width: clamp(90px, 8vw, 150px); }
.dn-body { position: absolute; left: 0; top: 0; z-index: 4; width: var(--dn-body); height: var(--dn-body); pointer-events: none; will-change: transform; }
.dn-body svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dn-rays { transform-box: view-box; transform-origin: 0 0; }
.dn-city { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; height: min(28.75vw, 52%); pointer-events: none; }
.dn-city > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.dn-city__shade { mix-blend-mode: multiply; opacity: 0; will-change: opacity; }
.dn-win { opacity: 0; transition: opacity .35s ease; }
.dn-win.is-on, .dn-win.is-call { opacity: 1; }
.dn-grain { z-index: 6; background: url("../poster/paper/paper-news.webp") 0 0 / 560px auto; mix-blend-mode: multiply; opacity: .42; }
.dn-fx { z-index: 7; display: block; width: 100%; height: 100%; overflow: visible; }
.dn-signal { fill: none; stroke: var(--dn-sig); stroke-width: 2.6; stroke-dasharray: 2 8; stroke-linecap: round; }
.dn-ring { fill: none; stroke: #fbd530; stroke-width: 3; }
.dn-badge { position: absolute; left: 0; top: 0; z-index: 8; height: auto; pointer-events: none; filter: drop-shadow(0 8px 10px rgb(0 0 0 / 28%)); }
.dn-caller { position: absolute; left: 0; top: 0; z-index: 8; width: clamp(28px, 2.4vw, 38px); height: auto; pointer-events: none; filter: drop-shadow(0 4px 5px rgb(0 0 0 / 30%)); will-change: transform; }

/* ---------- текст */
.dn-text { position: relative; z-index: 9; padding-top: calc(var(--dn-nav) + clamp(22px, 5.5vh, 56px)); pointer-events: none; }
.dn-text .dn-controls { pointer-events: auto; }
main > section#daynight :is(h1, h2) { max-width: 16ch; color: inherit !important; }
main > section#daynight .dn-sub { margin: 18px 0 0; max-width: 31ch; color: inherit !important; font-weight: 500; }
.dn-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 26px; }
.dn-stage:not(.is-live) .dn-controls { display: none; }
.dn-clock { display: inline-flex; align-items: baseline; gap: 10px; margin: 0; padding: 12px 18px 11px; color: #fbd530; border: 0 solid transparent; border-image: url("../poster/paper/card-black.webp?v=1") 40 fill / 40px / 14px stretch; rotate: -2deg; }
.dn-clock__time { font: 800 30px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dn-clock__part { min-width: 5.6em; font: 700 12px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .16em; text-transform: uppercase; color: #fbfaf6; }
.dn-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dn-chip { min-height: 44px; padding: 0 16px; border: 2px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: 700 15px/1 "Onest", system-ui, sans-serif; cursor: pointer; transition: transform .15s, background .2s, border-color .2s; }
.dn-chip:hover { transform: translateY(-2px); }
.dn-chip.is-on { background: #fbd530; border-color: #fbd530; color: #17181c; }
.dn-chip:focus-visible { outline: 3px solid #fbd530; outline-offset: 3px; }

/* ---------- ручка: солнце или луна, кого видно */
.dn-handle { position: absolute; left: 0; top: 0; z-index: 10; width: var(--dn-grab); height: var(--dn-grab); border-radius: 50%; cursor: grab; touch-action: none; color: var(--dn-ink); -webkit-tap-highlight-color: transparent; }
.dn-handle::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px dashed currentColor; opacity: 0; transition: opacity .2s; }
.dn-handle:hover::before, .dn-handle.is-drag::before { opacity: .55; }
.dn-handle:focus { outline: none; }
.dn-handle:focus-visible::before { opacity: 1; border: 3px solid #fbd530; box-shadow: 0 0 0 3px #17181c; }
.dn-handle.is-drag { cursor: grabbing; }
/* подсказка «тяните» — до первого касания */
.dn-handle::after { content: "тяните"; position: absolute; left: 50%; top: calc(100% - 4px); translate: -50% 0; padding: 4px 9px 5px; border-radius: 6px; background: #fbd530; color: #17181c; font: 800 12px/1.2 "Onest", system-ui, sans-serif; letter-spacing: .02em; white-space: nowrap; box-shadow: 0 4px 10px rgb(0 0 0 / 22%); pointer-events: none; }
.dn-handle.is-used::after { display: none; }

/* ---------- стопка заявок */
.dn-stack { position: absolute; z-index: 9; right: max(40px, calc((100% - 1280px) / 2)); bottom: 34px; width: 272px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; pointer-events: none; }
.dn-ticket { position: relative; display: grid; gap: 4px; padding: 18px 16px 13px 26px; color: #17181c; border: 0 solid transparent; border-image: url("../poster/paper/card-white.webp?v=1") 40 fill / 40px / 16px stretch; will-change: transform; }
.dn-ticket + .dn-ticket { margin-top: -33px; }
/* у старых записок видна только шапка: время и «Заявка принята» */
.dn-ticket:not(:last-child) .dn-ticket__what { opacity: 0; transition: opacity .3s; }
.dn-ticket::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 6px; background: #fbd530; }
.dn-ticket__top { display: flex; align-items: baseline; gap: 10px; }
.dn-ticket time { padding: 3px 6px 2px; background: #17181c; color: #fbd530; font: 800 13px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.dn-ticket b { font: 800 15px/1.2 "Onest", system-ui, sans-serif; letter-spacing: -.01em; }
.dn-ticket__what { font: 600 16px/1.3 "Onest", system-ui, sans-serif; color: rgb(23 24 28 / 78%); }

/* ---------- движение */
@media (prefers-reduced-motion: no-preference) {
  .dn-rays { animation: dn-spin 60s linear infinite; }
  .dn-cloud { animation: dn-drift 46s ease-in-out infinite alternate; }
  .dn-cloud--1 { animation-duration: 58s; animation-delay: -20s; }
  .dn-cloud--2 { animation-duration: 64s; animation-delay: -9s; }
  .dn-cloud--3 { animation-duration: 40s; animation-delay: -31s; }
  .dn-tw { animation: dn-twinkle 2.6s ease-in-out infinite; }
  .dn-beacon { animation: dn-blink 1.6s steps(2, jump-none) infinite; }
  .dn-win.is-call { animation: dn-flash .5s ease-in-out 3; }
  .dn-signal { animation: dn-flow .5s linear infinite; }
  .dn-handle::after { animation: dn-nudge 1.8s ease-in-out infinite; }
}
@keyframes dn-spin { to { rotate: 360deg; } }
@keyframes dn-drift { from { translate: -4vw 0; } to { translate: 4vw 0; } }
@keyframes dn-twinkle { 50% { opacity: .25; } }
@keyframes dn-blink { 50% { opacity: .15; } }
@keyframes dn-flash { 50% { opacity: .35; } }
@keyframes dn-flow { to { stroke-dashoffset: -20; } }
@keyframes dn-nudge { 50% { translate: -50% 4px; } }
@media (prefers-reduced-motion: reduce) { .dn-win { transition: none; } }

/* ---------- узкие экраны: текст сверху, дуга по центру, стопка — одна-две записки над нижней панелью */
@media (max-width: 899px) {
  .dn-city { height: 37%; }
  main > section#daynight .dn-sub { max-width: 34ch; margin-top: 12px; }
  .dn-controls { gap: 10px 12px; margin-top: 16px; }
  .dn-stack { right: 16px; bottom: calc(var(--bar, 0px) + 18px); width: min(250px, 64vw); }
}
@media (max-width: 639px) {
  .dn-text { padding-top: calc(var(--dn-nav) + 22px); }
  .dn-clock { padding: 9px 13px 8px; }
  .dn-clock__time { font-size: 24px; }
  .dn-clock__part { min-width: 0; font-size: 11px; }
  .dn-chips { gap: 6px; }
  .dn-chip { min-height: 38px; padding: 0 11px; font-size: 13px; }
  .dn-ticket { padding: 15px 12px 10px 22px; gap: 2px; }
  .dn-ticket + .dn-ticket { margin-top: -28px; }
  .dn-ticket b { font-size: 13px; }
  .dn-ticket time { font-size: 12px; }
  .dn-ticket__what { font-size: 14px; }
  .dn-cloud--0 { left: 50%; top: 47%; }
  .dn-cloud--1 { left: 78%; top: 56%; }
  .dn-cloud--2 { left: -6%; top: 53%; }
  .dn-cloud--3 { display: none; }
}
/* низкий телефон (SE и т. п.): мельче текст, чтобы небу осталось место */
@media (max-width: 639px) and (max-height: 720px) {
  .dn-text { padding-top: calc(var(--dn-nav) + 14px); }
  main > section#daynight :is(h1, h2) { font-size: 34px !important; }
  main > section#daynight h2::before { margin-bottom: 10px; }
  main > section#daynight .dn-sub { font-size: 15px; line-height: 1.45; margin-top: 8px; }
  .dn-controls { margin-top: 10px; gap: 8px; }
  .dn-clock { padding: 7px 11px 6px; }
  .dn-clock__time { font-size: 20px; }
  .dn-chip { min-height: 34px; padding: 0 10px; font-size: 12.5px; }
  .dn-city { height: 34%; }
}

/* ---------- первый экран сайта (просьба владельца 15.11): заголовок страницы, надпись «что это», кнопка */
main > section#daynight { counter-increment: none; }
main > section#daynight h1 {
  margin: 0; font-family: "Onest", system-ui, sans-serif !important; font-weight: 900 !important;
  font-size: clamp(40px, 5.6vw, 96px) !important; line-height: .92 !important; letter-spacing: -.05em !important;
}
.dn-kicker { margin: 0 0 14px; max-width: 34ch; font: 700 15px/1.35 "Onest", system-ui, sans-serif; color: inherit; }
.dn-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 22px; pointer-events: auto; }
.dn-cta .btn--primary { background: #fbd530 !important; color: #17181c !important; border-color: #17181c !important; box-shadow: 4px 4px 0 #17181c; }
.dn-more { font: 700 15px/1.2 "Onest", system-ui, sans-serif; color: inherit !important; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.dn-cta + .dn-controls { margin-top: 18px; }
@media (max-width: 900px) {
  .dn-kicker { font-size: 13px; margin-bottom: 8px; }
  .dn-cta { margin-top: 12px; gap: 8px 14px; }
  .dn-cta .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }
  .dn-more { display: none; }
  main > section#daynight .dn-cta { justify-content: flex-start !important; }
  .dn-cta + .dn-controls { margin-top: 10px; }
}

/* 18.11 (владелец: «пару секунд просто текст и только потом красота»): первый кадр — та же сцена готовой картинкой
   (11:00, без текста; снята со страницы, scratchpad dn-poster.mjs). Она грузится сразу (preload в index.html),
   скрипт потом рисует поверх живую сцену — шва нет: картинка совпадает с первым кадром. */
.dn-stage { background: url("poster-d.webp?v=2") center bottom / cover no-repeat, linear-gradient(#93c4d8, #b9dbe3 55%, #f1eedd); }
@media (max-width: 639px) {
  .dn-stage { background-image: url("poster-m.webp?v=2"), linear-gradient(#93c4d8, #b9dbe3 55%, #f1eedd); }
}
