/* ============================================================
   Адиль, 25. Одна тёмная тема на всю страницу, один акцент.
   Радиусы: 999px у кнопок, 20px у карточек, 6px у мелочи.
   ============================================================ */

:root {
  --bg:        #07070c;
  --bg-soft:   #0d0d15;
  --ink:       #f3efe8;
  --ink-dim:   #9c9aa6;
  --accent:    #ff4a1c;   /* единственный акцент страницы */
  --accent-lo: #ff8a4c;
  --edge:      rgba(255,255,255,.09);
  --shadow:    0 30px 90px rgba(0,0,0,.55), 0 2px 10px rgba(0,0,0,.4);
  --ease:      cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Golos Text', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }
body.locked { overflow: hidden; height: 100dvh; }

::selection { background: var(--accent); color: #fff; }

/* --- фон --------------------------------------------------- */

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* Виньетка и зерно поверх фона, кликам не мешают. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(0,0,0,.75) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: .7;
}

/* --- ворота ------------------------------------------------ */

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(90% 70% at 50% 45%, rgba(28,14,8,.55), var(--bg) 70%);
  transition: opacity .8s var(--ease);
}
.gate.gone { opacity: 0; pointer-events: none; }

.gate__inner { text-align: center; max-width: 760px; }

.gate__eyebrow {
  margin: 0 0 clamp(18px, 4vh, 40px);
  font-size: clamp(12px, 1.4vw, 14px);
  letter-spacing: .16em;
  text-transform: lowercase;
  color: var(--ink-dim);
}

.gate__name {
  margin: 0 0 clamp(26px, 5vh, 52px);
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: clamp(3.4rem, 15vw, 11rem);
  line-height: .92;
  letter-spacing: -.02em;
  display: flex;
  justify-content: center;
  gap: .02em;
}
.gate__name span {
  display: inline-block;
  transform: translateY(110%);
  animation: gateIn .95s var(--ease) forwards;
}
.gate__name span:nth-child(1) { animation-delay: .05s; }
.gate__name span:nth-child(2) { animation-delay: .12s; }
.gate__name span:nth-child(3) { animation-delay: .19s; }
.gate__name span:nth-child(4) { animation-delay: .26s; }
.gate__name span:nth-child(5) { animation-delay: .33s; }
@keyframes gateIn { to { transform: translateY(0); } }

.gate__hint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--ink-dim);
}

/* --- кнопки ------------------------------------------------ */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: clamp(15px, 1.6vw, 17px);
  color: #150802;
  background: var(--accent);
  padding: 16px 42px;
  border-radius: 999px;
  white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s;
  box-shadow: 0 14px 40px rgba(255,74,28,.28);
}
.btn:hover { transform: translateY(-2px); background: var(--accent-lo); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--edge);
  box-shadow: none;
  padding: 13px 30px;
  font-size: 14px;
}
.btn--ghost:hover { background: rgba(255,255,255,.06); }

/* --- каркас страницы --------------------------------------- */

.page {
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 1s var(--ease);
}
.page.on { opacity: 1; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(72px, 10vh, 130px) clamp(20px, 5vw, 76px);
  max-width: 1400px;
  margin: 0 auto;
}

/* --- экран отсчёта ----------------------------------------- */

.count { align-items: flex-start; }

.count__label {
  margin: 0 0 clamp(22px, 4vh, 44px);
  font-size: clamp(13px, 1.5vw, 16px);
  letter-spacing: .14em;
  color: var(--ink-dim);
}

.count__grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: clamp(18px, 4vw, 64px);
  align-items: end;
}

.unit__digits {
  display: flex;
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: clamp(3.2rem, 12.5vw, 11rem);
  line-height: .86;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}

/* Барабан: колонка из десяти цифр, видно одну. */
.digit {
  height: .86em;
  overflow: hidden;
  position: relative;
}
.digit__reel {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform .62s var(--ease);
  will-change: transform;
}
.digit__reel > i {
  height: .86em;
  line-height: .86em;
  font-style: normal;
  display: block;
}

/* Секунды — единственное, что подсвечено акцентом: там движение. */
.unit--sec .unit__digits { color: var(--accent); }
.unit--sec .digit__reel { transition-duration: .42s; }

.unit__cap {
  margin-top: clamp(6px, 1.2vh, 14px);
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.count__when {
  margin: clamp(30px, 6vh, 60px) 0 0;
  font-size: clamp(15px, 1.8vw, 19px);
  color: var(--ink-dim);
  max-width: 46ch;
  line-height: 1.6;
}
.count__when b { color: var(--ink); font-weight: 500; }

/* --- четверть века ----------------------------------------- */

.quarter { align-items: center; text-align: center; }

.quarter__stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Цифра с фотографией внутри. Пока фото нет, внутри живой градиент. */
.quarter__num {
  font-family: 'Unbounded', sans-serif;
  font-weight: 900;
  font-size: clamp(9rem, 36vw, 27rem);
  line-height: .8;
  letter-spacing: -.06em;
  background-image:
    linear-gradient(150deg, rgba(255,138,76,.22), rgba(255,74,28,.2) 45%, rgba(122,28,6,.34)),
    url(photos/roses.jpg);
  background-size: cover;
  background-position: center 26%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 24px 60px rgba(255,74,28,.22));
}

.quarter__word {
  position: absolute;
  left: 50%;
  top: 76%;
  transform: translate(-50%, -50%) rotate(-6deg);
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: clamp(1rem, 3.4vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: .02em;
  text-transform: lowercase;
  color: #fff;
  text-shadow: 0 6px 34px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.4);
  pointer-events: none;
}

.quarter__note {
  margin: clamp(34px, 6vh, 64px) auto 0;
  max-width: 40ch;
  font-size: clamp(15px, 1.8vw, 19px);
  line-height: 1.65;
  color: var(--ink-dim);
}

/* --- пожелание ---------------------------------------------- */

.wish { align-items: center; text-align: center; }
.wish__text {
  margin: 0;
  max-width: 22ch;
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: clamp(1.5rem, 4.6vw, 3.4rem);
  line-height: 1.25;
  letter-spacing: -.02em;
}
.wish__from {
  margin: clamp(26px, 5vh, 48px) 0 0;
  font-size: 15px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* --- последний экран перед нулём ---------------------------- */

.last { align-items: center; text-align: center; }
.last__line {
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: clamp(1.2rem, 3.6vw, 2.6rem);
  color: var(--ink-dim);
  letter-spacing: -.01em;
}

/* --- финал --------------------------------------------------- */

.finale {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: #05040a;
  text-align: center;
  padding: 24px;
}
.finale.on { display: grid; }

#boom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.finale__flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.finale__flash.fire { animation: flash 1.1s ease-out forwards; }
@keyframes flash {
  0%   { opacity: .95; }
  100% { opacity: 0; }
}

.finale__text {
  position: relative;
  z-index: 2;
  padding: clamp(24px, 6vh, 60px) clamp(20px, 5vw, 70px);
}
/* Мягкое затемнение под текстом: салют не съедает поздравление. */
.finale__text::before {
  content: "";
  position: absolute;
  inset: -10% -14%;
  z-index: -1;
  background: radial-gradient(60% 55% at 50% 48%, rgba(3,2,8,.86), rgba(3,2,8,.5) 55%, rgba(3,2,8,0) 78%);
  pointer-events: none;
}

.finale__pre {
  margin: 0 0 clamp(14px, 2.4vh, 26px);
  font-size: clamp(13px, 1.5vw, 16px);
  letter-spacing: .22em;
  text-transform: lowercase;
  color: var(--ink-dim);
  opacity: 0;
  animation: rise .8s var(--ease) .25s forwards;
}

.finale__title {
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: clamp(1.9rem, 7.4vw, 6.4rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  max-width: 16ch;
  text-shadow: 0 10px 50px rgba(0,0,0,.7);
}
.finale__title .fw {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px) scale(.9);
  animation: word .85s var(--ease) forwards;
}
.finale__title .fw:nth-child(1) { animation-delay: .35s; }
.finale__title .fw:nth-child(2) { animation-delay: .45s; }
.finale__title .fw:nth-child(3) { animation-delay: .55s; }
.finale__title .fw--name {
  color: var(--accent);
  animation-delay: .72s;
  animation-duration: 1.1s;
}
@keyframes word { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rise { to { opacity: 1; } }

.finale__sub {
  margin: clamp(16px, 3vh, 34px) 0 clamp(26px, 5vh, 46px);
  font-family: 'Unbounded', sans-serif;
  font-weight: 200;
  font-size: clamp(2.4rem, 9vw, 7rem);
  line-height: 1;
  letter-spacing: .04em;
  color: rgba(255,255,255,.16);
  opacity: 0;
  animation: rise 1.2s var(--ease) 1.1s forwards;
}

#againBtn { opacity: 0; animation: rise .8s var(--ease) 2.4s forwards; }

/* --- кнопка звука -------------------------------------------- */

.sound {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 70;
  width: 46px;
  height: 46px;
  display: none;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(12,12,18,.72);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s;
}
.sound.show { display: grid; }
.sound:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.24); }
.sound:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sound__bars { display: flex; align-items: center; gap: 3px; height: 18px; }
.sound__bars i {
  width: 3px;
  border-radius: 6px;
  background: var(--ink);
  height: 6px;
  animation: bars 1.1s ease-in-out infinite;
}
.sound__bars i:nth-child(2) { animation-delay: .18s; height: 14px; }
.sound__bars i:nth-child(3) { animation-delay: .36s; height: 9px; }
@keyframes bars {
  0%, 100% { transform: scaleY(.5); }
  50%      { transform: scaleY(1.35); }
}
.sound.off .sound__bars i { animation: none; transform: scaleY(.45); opacity: .5; }

/* Последние десять секунд: секунды дышат, страница подбирается. */
body.hot .unit--sec .unit__digits {
  animation: pulse 1s ease-in-out infinite;
  text-shadow: 0 0 60px rgba(255,74,28,.45);
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  12%      { transform: scale(1.045); }
}

/* --- появление блоков ---------------------------------------- */

/* Прячем только когда скрипт жив: без него страница читается целиком. */
html.anim .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
html.anim .reveal.in { opacity: 1; transform: none; }

/* --- узкие экраны -------------------------------------------- */

@media (max-width: 760px) {
  .count { align-items: center; text-align: center; }
  .count__grid {
    grid-template-columns: repeat(2, auto);
    justify-content: center;
    gap: 20px 34px;
  }
  .unit__digits { font-size: clamp(3.4rem, 21vw, 6rem); }
  .count__when { margin-left: auto; margin-right: auto; }

  .quarter__word { font-size: clamp(.9rem, 5.4vw, 1.4rem); }
  .wish__text { max-width: 16ch; }
}

/* --- без движения --------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html.anim .reveal { opacity: 1; transform: none; transition: none; }
  .gate__name span { transform: none; animation: none; }
  .digit__reel { transition: none; }
  .finale__title .fw,
  .finale__pre,
  .finale__sub,
  #againBtn { opacity: 1; transform: none; animation: none; }
  .sound__bars i { animation: none; }
  .finale__flash.fire { animation: none; }
}
