@import url('fonts/fonts.css');

:root {
  /* Цвета приложения */
  --red: #E8202A;
  --red-btn: #DC1A24;    /* красный кнопок: белый текст проходит 4.5:1 */
  --red-dark: #C4121B;
  --orange: #FF7A1A;
  --green: #1F9D55;
  --blue: #2F6FEB;
  --ink: #1B1B1F;
  --ink-2: #4A4B55;
  /* Ночь и рассвет */
  --night: #07060C;
  --night-2: #120E1A;
  --plum: #2A1230;
  --wine: #6B1A2C;
  --dawn: #FFB27A;
  --morning: #FFF3E8;
  --glass: #FFF8F2;        /* «освещённое окно»: панели интерфейса */
  --text: #F6EFE9;
  --text-2: rgba(246, 239, 233, .8);
  --line-night: rgba(246, 239, 233, .12);
  --line-day: #EADBCF;
  /* Шрифты */
  --f-display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --f-text: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  /* Моушен (шкала transitions.dev) */
  --duration-stagger: 40ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.22, 1, 0.36, 1);
  --blur-small: 2px;
  --blur-medium: 3px;
  /* Ритм */
  --gutter: clamp(16px, 4vw, 56px);
  --rail: clamp(0px, 9vw, 132px);
  --r: 18px;
  --shadow-window: 0 2px 4px rgba(10, 4, 12, .25), 0 24px 60px -12px rgba(10, 4, 12, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--wine) var(--night); }
body {
  margin: 0; min-height: 100vh; background: var(--night); color: var(--text);
  font: 400 17px/1.55 var(--f-text); font-feature-settings: 'tnum' 0; overflow-x: hidden;
}
::selection { background: var(--orange); color: var(--night); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--night); }
::-webkit-scrollbar-thumb { background: var(--wine); border-radius: 10px; border: 2px solid var(--night); }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 6px; }
img, svg, canvas { display: block; }
.tnum { font-variant-numeric: tabular-nums; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Небо ---------- */
.sky { position: fixed; inset: 0; z-index: -3; background: linear-gradient(180deg, var(--sky-top, #07060C) 0%, var(--sky-mid, #0E0A16) 55%, var(--sky-low, #15101F) 100%); }
.sky::after { /* полоса зари у горизонта */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 38vh;
  background: linear-gradient(180deg, transparent, var(--sky-glow, rgba(232, 32, 42, 0)) 85%, var(--sky-edge, rgba(255, 122, 26, 0)));
}
.stars { position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: var(--stars, 1); }

/* ---------- Верхняя панель ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; gap: 20px;
  padding: 14px var(--gutter); transition: background var(--duration-slow) var(--ease-smooth-out), backdrop-filter var(--duration-slow);
}
.top.scrolled { background: rgba(7, 6, 12, .72); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 1px 0 var(--line-night); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 15px/1 var(--f-display); letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.clock { font: 500 13px/1 var(--f-mono); color: var(--text-2); display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line-night); border-radius: 999px; }
.clock i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
@keyframes blink { 50% { opacity: .35; } }
.top.light.scrolled { background: rgba(255, 243, 232, .84); box-shadow: 0 1px 0 var(--line-day); }
.top.light .brand, .top.light nav a.link { color: var(--ink); }
.top.light nav a.link:hover { background: rgba(27,27,31,.06); }
.top.light .clock { color: var(--ink-2); border-color: var(--line-day); }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top nav a.link { text-decoration: none; padding: 9px 14px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 15px; transition: color var(--duration-quick), background var(--duration-quick); }
.top nav a.link:hover { color: var(--text); background: rgba(246, 239, 233, .07); }

/* ---------- Кнопки ---------- */
.btn {
  --bg: var(--red-btn); --fg: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px; background: var(--bg); color: var(--fg); font: 600 16px/1 var(--f-text); text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(10, 4, 12, .3), 0 10px 24px -10px rgba(10, 4, 12, .7);
  transition: transform var(--duration-fast) var(--ease-smooth-out), background var(--duration-quick), box-shadow var(--duration-fast) var(--ease-smooth-out);
}
.btn:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(10, 4, 12, .3), 0 16px 32px -12px rgba(10, 4, 12, .85); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn .arr { width: 18px; height: 18px; transition: transform var(--duration-fast) var(--ease-smooth-out); }
.btn:hover .arr { transform: translateX(3px); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn.ghost { --bg: transparent; --fg: var(--text); box-shadow: inset 0 0 0 1px rgba(246, 239, 233, .28); }
.btn.ghost:hover { background: rgba(246, 239, 233, .08); box-shadow: inset 0 0 0 1px rgba(246, 239, 233, .5); }
.btn.ink { --bg: var(--ink); box-shadow: 0 1px 2px rgba(10,4,12,.2), 0 12px 26px -12px rgba(27,27,31,.6); }
.btn.ink:hover { background: #000; }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }

/* ---------- Типографика ---------- */
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: -.03em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(36px, 6.2vw, 92px); line-height: .98; }
h2 { font-size: clamp(30px, 4.4vw, 62px); line-height: 1.02; }
h3 { font-size: clamp(20px, 1.8vw, 26px); line-height: 1.15; letter-spacing: -.02em; }
p { margin: 0; }
.lead { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.5; color: var(--text-2); max-width: 46ch; text-wrap: pretty; }
.ex { font: 500 12px/1 var(--f-mono); color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.ex::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--orange); }

/* ---------- Горизонт (город) ---------- */
.city { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; pointer-events: auto; }
.tip {
  position: fixed; z-index: 40; pointer-events: none; min-width: 220px; max-width: 280px; padding: 12px 14px; border-radius: 14px;
  background: var(--glass); color: var(--ink); box-shadow: var(--shadow-window); font-size: 14px; line-height: 1.35;
  opacity: 0; transform: translateY(6px) scale(.98); filter: blur(var(--blur-small));
  transition: opacity var(--duration-quick) ease-out, transform var(--duration-quick) ease-out, filter var(--duration-quick) ease-out;
}
.tip.on { opacity: 1; transform: none; filter: none; transition-duration: var(--duration-fast); }
.tip b { display: block; font-weight: 600; margin-bottom: 2px; }
.tip small { color: var(--ink-2); display: block; }
.tip .pct { position: absolute; top: 10px; right: 12px; font: 600 13px/1 var(--f-mono); color: var(--green); }

/* ---------- Разделы по времени ---------- */
.hour { position: relative; padding: clamp(80px, 12vh, 150px) var(--gutter); display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); column-gap: clamp(16px, 3vw, 48px); }
.hour > .t { position: sticky; top: 88px; align-self: start; font: 500 15px/1 var(--f-mono); color: var(--orange); font-variant-numeric: tabular-nums; padding-top: 10px; }
.hour > .t::after { content: ''; display: block; width: 1px; height: 64px; margin: 14px 0 0 6px; background: linear-gradient(var(--orange), transparent); }
.hour > .body { min-width: 0; }
.hour .head { display: grid; gap: 18px; max-width: 760px; margin-bottom: clamp(32px, 5vh, 56px); }

/* ---------- Окна интерфейса (демо-панели) ---------- */
.win { background: var(--glass); color: var(--ink); border-radius: var(--r); box-shadow: var(--shadow-window); overflow: hidden; }
.win .bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-day); font-size: 13px; color: var(--ink-2); }
.win .bar .dots { display: flex; gap: 6px; }
.win .bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: #E7D9CE; }
.win .bar .ex { margin-left: auto; color: #6E625C; }
.win .bar .ex::before { background: var(--red); }

/* Журнал: строки со статусами */
.st { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px/1 var(--f-text); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.st.found { background: #F2E9E2; color: #6B5F58; }
.st.sent { background: #EAF1FE; color: #1F55C0; }
.st.reply { background: #FFF1E6; color: #B4520B; }
.st.meet { background: #E7F6EE; color: #17794A; }
.st.no { background: #FDECEC; color: #B3141C; }
.flap { display: inline-flex; }
.flap span { display: inline-block; transform-origin: 50% 60%; }
.flap span.flip { animation: flip 260ms var(--ease-smooth-out) both; }
@keyframes flip { 0% { transform: rotateX(90deg); opacity: 0; filter: blur(2px); } 100% { transform: none; opacity: 1; filter: none; } }

/* ---------- Подвал ---------- */
.foot { padding: 40px var(--gutter) 48px; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; color: #7A6A64; font-size: 14px; background: var(--morning); border-top: 1px solid var(--line-day); }
.foot .brand { color: var(--ink); }
.foot a { color: #5A4C47; }
.foot .sp { margin-left: auto; }

/* ---------- Появление (только с JS и без reduced motion) ---------- */
.js .rise { opacity: 0; transform: translateY(var(--rise, 14px)); filter: blur(var(--blur-medium)); }
.js .rise.in { opacity: 1; transform: none; filter: none; transition: opacity var(--duration-very-slow) ease-in-out, transform 700ms var(--ease-smooth-out), filter var(--duration-very-slow) ease-in-out; transition-delay: var(--d, 0ms); }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .clock { display: none; }
  .top { gap: 10px; }
  .top nav a.link { padding: 8px 10px; font-size: 14px; }
  .hour { grid-template-columns: minmax(0, 1fr); }
  .hour > .t { position: static; margin-bottom: 18px; padding: 0; }
  .hour > .t::after { display: none; }
}
@media (max-width: 560px) {
  .brand { white-space: nowrap; font-size: 14px; }
  .top nav a#switch { display: none; }
  .top nav .btn.small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .js .rise { opacity: 1; transform: none; filter: none; }
}
