/* Ночная страница: тема одна, тёмная, потому что это небо. */
:root {
  color-scheme: dark;
  --ink: #070a12;
  --ink-2: #0d1322;
  --text: #e9ecf4;
  --muted: #9ba6c2;
  --faint: #6c7795;
  --accent: #c9d6ff;      /* цвет самой звезды: голубовато-белый */
  --line: rgba(201, 214, 255, 0.18);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 5vw, 72px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { background: var(--ink); overflow-x: clip; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text);
  font-family: var(--serif); font-weight: 400; font-size: clamp(19px, 1.35vw, 22px); line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.mono { font-family: var(--mono); font-size: 0.62em; letter-spacing: 0.02em; }
em { font-style: italic; }
h1, h2 { font-weight: 300; margin: 0; }

#sky { position: fixed; inset: 0; z-index: 0; display: block; }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main { position: relative; z-index: 2; }

/* Кнопки: тонкая рамка, скругление-пилюля для всех интерактивных */
.btn {
  display: inline-flex; align-items: center; gap: 0.6em; white-space: nowrap;
  font: 400 0.62rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  color: var(--text); background: rgba(7, 10, 18, 0.35);
  border: 1px solid rgba(201, 214, 255, 0.4); border-radius: 999px; padding: 1.05em 1.6em;
  transition: background .5s var(--ease), border-color .5s var(--ease), transform .2s var(--ease);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer;
}
.btn:hover { background: rgba(201, 214, 255, 0.12); border-color: var(--accent); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible, select:focus-visible, input:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

/* ---------- Первый экран ---------- */
.hero { min-height: 100dvh; display: flex; align-items: flex-end; padding: 0 var(--gutter) clamp(40px, 9vh, 96px); }
.hero__inner { max-width: 640px; }
.hero__date { color: var(--muted); margin: 0 0 0.6rem; font-size: 0.7rem; }
.hero__name {
  font: italic 300 clamp(140px, 22vw, 300px)/0.9 var(--serif); letter-spacing: -0.02em;
  margin: 0 0 0.12em -0.04em; padding-bottom: 0.04em;
}
.hero__name .split { display: inline-block; }
.hero__lead { font-size: clamp(22px, 2vw, 28px); line-height: 1.35; color: #d4d9e7; margin: 0 0 2rem; max-width: 26ch; }

/* ---------- Поиск: прокрутка приближает небо ---------- */
.find { height: 340vh; position: relative; }
.find__sticky { position: sticky; top: 0; height: 100dvh; display: flex; align-items: flex-end; padding: 0 var(--gutter) clamp(48px, 12vh, 120px); pointer-events: none; }
.find__steps { position: relative; width: min(440px, 100%); min-height: 7.5em; }
.step {
  position: absolute; left: 0; bottom: 0; margin: 0; font-size: clamp(24px, 2.3vw, 34px); line-height: 1.3; font-weight: 300;
  opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease), transform .9s var(--ease);
  text-shadow: 0 1px 24px rgba(7, 10, 18, 0.9);
}
.step.is-on { opacity: 1; transform: none; }
.step--name { font-size: clamp(44px, 5vw, 72px); }

/* ---------- Сегодня ---------- */
section + section:not(.find) { padding-block: clamp(96px, 16vh, 180px); }
.tonight {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 6vw, 96px);
  align-items: center; padding-inline: var(--gutter); max-width: 1400px; margin: 0 auto;
}
.tonight__chart { display: flex; justify-content: center; }
#dome { display: block; max-width: 100%; }
.tonight h2, .portrait h2 { font-size: clamp(40px, 4.6vw, 68px); line-height: 1.05; margin-bottom: 1.4rem; }
.tonight__answer { font-size: clamp(24px, 2.1vw, 30px); line-height: 1.3; margin: 0 0 0.9rem; min-height: 2.6em; }
.tonight__hint { color: #c7cde0; margin: 0 0 2.2rem; max-width: 36ch; min-height: 3em; }
.tonight__note { color: var(--muted); font-size: 0.82em; max-width: 38ch; margin: 1.8rem 0 0; }

.controls { display: grid; gap: 1.4rem; max-width: 420px; }
.field { display: grid; grid-template-columns: 5.5rem 1fr; grid-template-rows: auto auto; column-gap: 1rem; row-gap: 0.4rem; align-items: center; }
.field__label { font: 400 0.6rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); grid-row: 1 / span 2; }
.field__value { color: #c7cde0; font-size: 0.66rem; }
select {
  appearance: none; -webkit-appearance: none; width: 100%;
  font: 400 1.05rem var(--serif); color: var(--text); background: rgba(13, 19, 34, 0.8);
  border: 1px solid rgba(201, 214, 255, 0.35); border-radius: 999px; padding: 0.55em 2.4em 0.55em 1.1em;
  background-image: linear-gradient(45deg, transparent 50%, #c9d6ff 50%), linear-gradient(135deg, #c9d6ff 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
select option { background: #0d1322; color: var(--text); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: rgba(201, 214, 255, 0.45); }
input[type=range]::-moz-range-track { height: 1px; background: rgba(201, 214, 255, 0.45); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--ink); border: 1px solid var(--accent); box-shadow: 0 0 0 4px rgba(201, 214, 255, 0.1); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 1px solid var(--accent); }

/* ---------- Свет ---------- */
.light { padding-inline: var(--gutter); max-width: 1400px; margin: 0 auto; }
.light__intro { font-size: clamp(24px, 2.4vw, 36px); line-height: 1.3; max-width: 22ch; margin: 0; font-weight: 300; }
.light__year {
  font: 300 clamp(150px, 27vw, 420px)/0.86 var(--serif); letter-spacing: -0.035em; margin: 0.08em 0 0.15em -0.05em;
  font-variant-numeric: lining-nums; color: #f1f3fa;
}
.light__year small { font-size: 0.11em; letter-spacing: 0; font-style: italic; margin-left: 0.4em; color: var(--muted); vertical-align: 0.3em; }
.light__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 34ch)); gap: clamp(24px, 6vw, 96px); margin-left: clamp(0px, 18vw, 320px); }
.light__cols p { margin: 0; color: #cdd3e4; }
.light__counter .mono { font-size: 0.78em; color: var(--text); white-space: nowrap; }

/* ---------- Портрет ---------- */
.portrait {
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(32px, 6vw, 96px); align-items: center;
  padding-inline: var(--gutter); max-width: 1400px; margin: 0 auto;
}
.portrait__visual { display: flex; flex-direction: column; align-items: center; }
#star { display: block; max-width: 100%; }
.portrait__caption { color: var(--faint); margin: 0.6rem 0 0; font-size: 0.6rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.4rem 2.4rem; margin: 0; }
.fact { border-top: 1px solid var(--line); padding-top: 1rem; }
.fact dt { font-size: clamp(34px, 3.2vw, 48px); font-weight: 300; line-height: 1; margin-bottom: 0.6rem; white-space: nowrap; }
.fact dd { margin: 0; color: #c2c9dc; font-size: 0.9em; line-height: 1.4; }

/* ---------- Имена ---------- */
.names { padding-inline: var(--gutter); max-width: 1400px; margin: 0 auto; display: grid; gap: clamp(72px, 12vh, 140px); }
.names__pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 34ch); gap: clamp(24px, 5vw, 80px); align-items: end; }
.names__pair--her { grid-template-columns: minmax(0, 34ch) minmax(0, 1fr); }
.names__pair--her .word { order: 2; text-align: right; }
.word { font: italic 300 clamp(110px, 17vw, 260px)/0.95 var(--serif); margin: 0; letter-spacing: -0.01em; white-space: nowrap; color: #b8c3e3; }
.word span { display: inline-block; will-change: transform; }
.word.is-rev { color: var(--text); }
.word--her { color: #d6def5; }
.names__text { margin: 0 0 1.2em; color: #cdd3e4; }

/* ---------- Подарок ---------- */
.gift { padding-inline: var(--gutter); display: flex; flex-wrap: wrap; gap: clamp(32px, 5vw, 72px); justify-content: center; align-items: center; }
.gift__photo { margin: 0; width: min(420px, 100%); aspect-ratio: 4 / 5; overflow: hidden; border-radius: 2px; transform: rotate(-1.5deg); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8); }
.gift__photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.9) contrast(1.02); }
.card {
  width: min(520px, 100%); padding: clamp(28px, 4vw, 52px);
  background: linear-gradient(180deg, rgba(14, 20, 36, 0.82), rgba(9, 13, 24, 0.9));
  border: 1px solid var(--line); border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 50px 100px -40px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card__kicker { color: var(--muted); margin: 0 0 0.8rem; font-size: 0.62rem; }
.card__name { font: italic 300 clamp(56px, 6vw, 84px)/1 var(--serif); margin-bottom: 1.6rem; }
.card__data { margin: 0 0 1.6rem; display: grid; gap: 0.85rem; }
.card__data div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; align-items: baseline; }
.card__data dt { font: 400 0.58rem/1.6 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.card__data dd { margin: 0; font-size: 1.02rem; }
.card__data dd.mono { font-size: 0.7rem; }
.card__honest { color: #c2c9dc; font-size: 0.92em; border-top: 1px solid var(--line); padding-top: 1.3rem; margin: 0 0 1.8rem; }

.end { position: relative; z-index: 2; min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 0 var(--gutter); }
.end p { font: italic 300 clamp(36px, 5vw, 72px)/1.1 var(--serif); margin: 0; text-align: center; }

/* ---------- Телефон ---------- */
@media (max-width: 767px) {
  .hero { padding-bottom: 56px; }
  .hero__name { font-size: clamp(120px, 40vw, 180px); }
  .find__sticky { padding-bottom: 64px; }
  .tonight, .portrait { grid-template-columns: 1fr; }
  .tonight__text { order: -1; }
  .controls { max-width: none; }
  .field { grid-template-columns: 4.6rem 1fr; }
  .light__cols { grid-template-columns: 1fr; margin-left: 0; }
  .light__year small { display: block; margin: 0.2em 0 0; vertical-align: 0; font-size: 0.14em; }
  .facts { grid-template-columns: 1fr; gap: 1.6rem; }
  .names__pair, .names__pair--her { grid-template-columns: 1fr; }
  .names__pair--her .word { order: 0; text-align: left; }
  .card__data div { grid-template-columns: 1fr; gap: 0.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .step, .btn { transition: none; }
}

/* ================= Шрифты второго прохода ================= */
:root { --display: "Noto Serif Display", "Cormorant Garamond", serif; --script: "Great Vibes", "Cormorant Garamond", cursive; }
h2, .tonight h2, .portrait h2 { font-family: var(--display); font-weight: 200; letter-spacing: -0.015em; }
.light__year { font-family: var(--display); font-weight: 200; letter-spacing: -0.04em; }
.light__year small { font-family: var(--display); font-weight: 300; }
.fact dt { font-family: var(--display); font-weight: 200; letter-spacing: -0.02em; }
.step { font-family: var(--display); font-weight: 200; font-size: clamp(24px, 2.2vw, 32px); }
.step--name { font-family: var(--script); font-weight: 400; font-size: clamp(72px, 8vw, 120px); line-height: 1.15; letter-spacing: 0; }
.step--name em { font-style: normal; }
.word { font-family: var(--display); font-weight: 200; }
.card__name { font-family: var(--display); font-weight: 200; }
.end p { font-family: var(--display); font-weight: 200; }
.tonight__answer { font-family: var(--display); font-weight: 300; font-size: clamp(22px, 1.9vw, 28px); letter-spacing: -0.01em; }
.light__intro { font-family: var(--display); font-weight: 200; }

/* ---------- Имя, написанное светом ---------- */
.hero__for {
  font: italic 300 clamp(18px, 1.5vw, 23px)/1.3 var(--display); color: var(--muted); letter-spacing: 0.01em; margin: 0 0 0.4rem;
}
.hero__name { font: inherit; margin: 0 0 1.4rem -0.02em; padding: 0; line-height: 0; }
.sign { display: block; width: clamp(280px, 40vw, 620px); height: auto; overflow: visible; filter: drop-shadow(0 0 18px rgba(170, 195, 255, 0.28)); }
.pen {
  fill: #eef2ff; fill-opacity: 0; stroke: #e6edff; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
}
.sign.go .pen--0 { animation: draw 1.7s cubic-bezier(.55, .05, .35, 1) .5s forwards, ink 1.4s ease 1.9s forwards; }
.sign.go .pen--1 { animation: draw 1.2s cubic-bezier(.55, .05, .35, 1) 1.6s forwards, ink 1.4s ease 2.6s forwards; }
.sign.go .pen--2 { animation: draw 1.1s cubic-bezier(.55, .05, .35, 1) 2.3s forwards, ink 1.4s ease 3.2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ink { to { fill-opacity: 1; stroke-opacity: 0.25; } }

/* ---------- Сегодня / в ночь рождения ---------- */
.modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.6rem; }
.mode {
  font: 400 12px/1 var(--mono); letter-spacing: 0.04em; color: var(--muted); cursor: pointer; white-space: nowrap;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  transition: color .4s var(--ease), border-color .4s var(--ease), background .4s var(--ease), transform .15s;
}
.mode:hover { color: var(--text); border-color: rgba(201, 214, 255, 0.45); }
.mode:active { transform: scale(0.98); }
.mode.is-on { color: var(--text); border-color: var(--accent); background: rgba(201, 214, 255, 0.1); }
.mode:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* ---------- Свет дня рождения ---------- */
.birth { margin: clamp(90px, 16vh, 170px) 0 0 clamp(0px, 18vw, 320px); max-width: 860px; }
.birth__text { font-size: clamp(21px, 1.7vw, 26px); line-height: 1.45; color: #cdd3e4; max-width: 44ch; margin: 0 0 3.2rem; }
.birth__text em { color: var(--text); }
.route { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.route__end { font: italic 300 22px/1 var(--display); color: var(--muted); }
.route__end--star { font: 400 40px/1 var(--script); color: var(--accent); }
.route__line { position: relative; height: 1px; background: linear-gradient(90deg, rgba(201,214,255,.7), rgba(201,214,255,.14)); }
.route__dot {
  position: absolute; top: 50%; left: var(--p, 3.7%); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: #f3f6ff; box-shadow: 0 0 0 4px rgba(201, 214, 255, 0.12), 0 0 18px 4px rgba(190, 208, 255, 0.55);
}
.route__tag { position: absolute; left: -2px; top: 22px; white-space: nowrap; color: var(--muted); font-size: 11px; }

@media (max-width: 767px) {
  .sign { width: min(78vw, 340px); }
  .birth { margin-left: 0; }
  .route__end--star { font-size: 32px; }
  .route__end { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .pen { stroke-dashoffset: 0; fill-opacity: 1; stroke-opacity: 0.25; }
  .sign.go .pen { animation: none; }
}
