/* Волшебный слой: 3D-хрусталь, живые фоны, наклон карточек, раскрывающиеся заголовки */

/* ---------- живые фоны секций ---------- */
.has-aura { position: relative; isolation: isolate; overflow: hidden; }
.aura { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.aura i {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  opacity: 0.55;
  will-change: transform;
  animation: waltz 26s ease-in-out infinite alternate;
}
.aura i:nth-child(1) { left: -12vmax; top: -16vmax; }
.aura i:nth-child(2) { right: -14vmax; top: 20%; animation-duration: 32s; animation-delay: -8s; }
.aura i:nth-child(3) { left: 30%; bottom: -24vmax; animation-duration: 38s; animation-delay: -15s; }

/* светлые: тюль, шампанское, розовая пудра и дамаск */
.aura-light .aura i { opacity: 0.9; }
.aura-light .aura i:nth-child(1) { background: radial-gradient(circle, rgba(211, 172, 99, 0.6), transparent 65%); }
.aura-light .aura i:nth-child(2) { background: radial-gradient(circle, rgba(200, 140, 165, 0.48), transparent 65%); }
.aura-light .aura i:nth-child(3) { background: radial-gradient(circle, rgba(120, 145, 215, 0.45), transparent 65%); }
.aura b {
  position: absolute;
  inset: -60px;
  opacity: 0.75;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='%23b88a3b' stroke-opacity='0.4' stroke-width='1'><path d='M60 14 C 74 30, 74 44, 60 60 C 46 44, 46 30, 60 14 Z'/><path d='M60 106 C 74 90, 74 76, 60 60 C 46 76, 46 90, 60 106 Z'/><path d='M14 60 C 30 46, 44 46, 60 60 C 44 74, 30 74, 14 60 Z'/><path d='M106 60 C 90 46, 76 46, 60 60 C 76 74, 90 74, 106 60 Z'/><circle cx='60' cy='60' r='3'/><path d='M0 0 C 12 6, 12 18, 0 24 M120 0 C 108 6, 108 18, 120 24 M0 120 C 12 114, 12 102, 0 96 M120 120 C 108 114, 108 102, 120 96'/></g></svg>");
  background-size: 120px 120px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 50%, #000 10%, transparent 75%);
  animation: lace 60s linear infinite;
}

/* тёмные: боке от люстры */
.aura-dark .aura i { opacity: 0.45; }
.aura-dark .aura i:nth-child(1) { background: radial-gradient(circle, rgba(211, 172, 99, 0.28), transparent 62%); }
.aura-dark .aura i:nth-child(2) { background: radial-gradient(circle, rgba(110, 130, 230, 0.25), transparent 62%); }
.aura-dark .aura i:nth-child(3) { background: radial-gradient(circle, rgba(170, 60, 90, 0.22), transparent 62%); }
.aura em {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(243, 223, 174, 0.9), transparent 60%),
    radial-gradient(1.5px 1.5px at 78% 14%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(2.5px 2.5px at 64% 72%, rgba(243, 223, 174, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 32% 84%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(2px 2px at 90% 56%, rgba(243, 223, 174, 0.8), transparent 60%),
    radial-gradient(1.5px 1.5px at 46% 38%, rgba(255, 255, 255, 0.6), transparent 60%);
  background-size: 420px 420px;
  animation: twinkle 5s ease-in-out infinite alternate, rise 80s linear infinite;
}

@keyframes waltz {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(8vmax, 4vmax) scale(1.12); }
  66% { transform: translate(-4vmax, 9vmax) scale(0.94); }
  100% { transform: translate(6vmax, -5vmax) scale(1.06); }
}
@keyframes lace { to { background-position: 120px 240px; } }
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes rise { to { background-position: 0 -840px; } }

/* ---------- 3D-наклон карточек ---------- */
.tilt3d {
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.6s;
  will-change: transform;
}
.tilt3d.tilting { transition: transform 0.08s linear, box-shadow 0.4s; box-shadow: 0 30px 60px -24px rgba(8, 12, 32, 0.55); }
.tilt3d > .glare {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 244, 214, 0.28), transparent 45%);
  mix-blend-mode: soft-light;
}
.tilt3d.tilting > .glare { opacity: 1; }
.collage figure.tilt3d, .card-wrap.tilt3d, .pledge.tilt3d { position: relative; }

/* ---------- заголовки раскрываются, как страница книги ---------- */
.unfold-wait { opacity: 0; transform: perspective(700px) rotateX(-75deg) translateY(18px); transform-origin: 50% 100%; }
.unfold-in {
  opacity: 1;
  transform: none;
  transform-origin: 50% 100%;
  transition: opacity 1.1s ease, transform 1.3s cubic-bezier(0.16, 0.9, 0.25, 1.15);
}

@media (prefers-reduced-motion: reduce) {
  .aura i, .aura b, .aura em { animation: none; }
  .unfold-wait { opacity: 1; transform: none; }
}

/* ---------- фото-открытки ---------- */
.pc-able { cursor: zoom-in; }
.pc-lock, .pc-lock body { overflow: hidden; }
.pc-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  perspective: 1600px;
  background: rgba(8, 12, 32, 0);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition: background 0.45s, backdrop-filter 0.45s, -webkit-backdrop-filter 0.45s;
}
.pc-veil.open { background: rgba(8, 12, 32, 0.78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pc-card {
  position: relative;
  width: min(92vw, 640px);
  aspect-ratio: 3 / 2;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
  outline: none;
}
.pc-veil.open .pc-card { animation: pc-float 6s ease-in-out 1s infinite; }
.pc-card.flipped { transform: rotateY(180deg); animation: none; }
.pc-card:focus-visible { box-shadow: 0 0 0 3px var(--brass-soft); }
@keyframes pc-float { 0%, 100% { translate: 0 0; rotate: 0deg; } 50% { translate: 0 -8px; rotate: 0.6deg; } }

.pc-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: #f6f1e6;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(184, 138, 59, 0.35);
}
.pc-front { padding: 14px; }
.pc-front img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.pc-hint {
  position: absolute;
  right: 22px;
  bottom: 22px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  color: var(--tulle);
  background: rgba(8, 12, 32, 0.6);
}
.pc-back {
  transform: rotateY(180deg);
  display: grid;
  grid-template-columns: 1.2fr 1px 1fr;
  gap: 0 clamp(14px, 3vw, 28px);
  padding: clamp(18px, 4vw, 34px);
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(211, 172, 99, 0.12), transparent 50%),
    #f6f1e6;
}
.pc-back::before { content: ""; grid-column: 2; grid-row: 1; background: rgba(184, 138, 59, 0.45); }
.pc-text { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; justify-content: center; }
.pc-greet { margin: 0 0 0.6rem; font-family: "Pinyon Script", "Great Vibes", cursive; font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.1; color: var(--velvet); }
.pc-cap { margin: 0 0 1rem; font-family: "Pinyon Script", "Great Vibes", cursive; font-size: clamp(1.2rem, 3.2vw, 1.7rem); line-height: 1.3; }
.pc-sign { margin: 0; font-size: clamp(0.75rem, 1.8vw, 0.9rem); color: #4b5166; font-style: italic; }
.pc-side { grid-column: 3; grid-row: 1; position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 1.4rem; padding-bottom: 8%; }
.pc-line { display: block; height: 1px; background: rgba(22, 26, 42, 0.25); }
.pc-stamp {
  position: absolute;
  top: 0;
  right: 0;
  width: clamp(64px, 14vw, 92px);
  aspect-ratio: 4 / 5;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--tulle);
  background: var(--midnight);
  outline: 2px dashed #f6f1e6;
  outline-offset: -6px;
  box-shadow: 0 0 0 4px #f6f1e6, 0 0 0 5px rgba(184, 138, 59, 0.5);
  rotate: 4deg;
}
.pc-stamp b { font-family: "Pinyon Script", "Great Vibes", cursive; font-weight: 400; font-size: clamp(0.95rem, 2.4vw, 1.25rem); color: var(--brass-soft); }
.pc-stamp i { font-size: 0.65rem; font-style: normal; color: var(--mist); }
.pc-mark {
  position: absolute;
  top: 10%;
  right: 22%;
  padding: 0.5rem 0.9rem;
  border: 2px solid rgba(84, 18, 31, 0.5);
  border-radius: 50%;
  color: rgba(84, 18, 31, 0.55);
  font-size: 0.7rem;
  rotate: -14deg;
}
.pc-close {
  position: fixed;
  top: 14px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(211, 172, 99, 0.6);
  border-radius: 50%;
  background: rgba(8, 12, 32, 0.6);
  color: var(--tulle);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.4s;
}
.pc-veil.open .pc-close { opacity: 1; }
@media (max-width: 560px) {
  .pc-card { aspect-ratio: 3 / 4; }
  .pc-back { grid-template-columns: 1fr; grid-template-rows: auto 1px auto; gap: 14px 0; }
  .pc-back::before { grid-column: 1; grid-row: 2; }
  .pc-text { grid-row: 1; }
  .pc-side { grid-column: 1; grid-row: 3; min-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .pc-card { transition: none; }
  .pc-veil.open .pc-card { animation: none; }
}

/* широкое фото артиста (по пояс, с гитарой) */
.cutout.wide { height: auto; width: 122%; bottom: 19%; }

/* ================= ещё волшебство ================= */

/* снег */
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 54; opacity: 0.75; }

/* золотая нить прокрутки */
.thread { position: fixed; left: 0; top: 0; right: 0; height: 2px; z-index: 120; pointer-events: none; }
.thread::before {
  content: "";
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, #9c722b, #f3dfae, #d3ac63);
  box-shadow: 0 0 10px rgba(243, 223, 174, 0.8);
}
.thread i {
  position: absolute;
  top: -5px;
  left: calc(var(--p, 0) * 100% - 6px);
  width: 12px;
  height: 12px;
  background: #fff4d6;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 6px #f3dfae);
  animation: spinstar 3s linear infinite;
}
@keyframes spinstar { to { rotate: 360deg; } }

/* буквы-вальс */
h2.waltz .w { display: inline-block; white-space: nowrap; }
h2.waltz .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.6em) rotateX(-90deg) rotateZ(-8deg);
  transform-origin: 50% 100%;
  transition: opacity 0.6s ease, transform 0.9s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition-delay: calc(var(--i) * 32ms);
}
h2.waltz.danced .ch { opacity: 1; transform: none; }
h2.waltz.danced .ch:hover { transform: translateY(-0.12em) rotate(-4deg); color: var(--brass-soft); transition-delay: 0s; transition-duration: 0.3s; }

/* вензель-разделитель */
.divider { position: absolute; top: 1.4rem; left: 50%; translate: -50% 0; display: flex; pointer-events: none; }
.divider { width: 220px; }
.divider svg { width: 220px !important; height: 22px !important; max-width: none; overflow: visible; }
.divider path { fill: none; stroke: var(--brass); stroke-width: 1.2; stroke-dasharray: 260; stroke-dashoffset: 260; transition: stroke-dashoffset 2s ease-out; }
.divider path:nth-child(2) { transition-delay: 0.6s; fill: rgba(211, 172, 99, 0); transition: stroke-dashoffset 1.4s 0.6s ease-out, fill 0.8s 1.6s; }
.divider.drawn path { stroke-dashoffset: 0; }
.divider.drawn path:nth-child(2) { fill: rgba(211, 172, 99, 0.85); }
.aura-dark .divider path { stroke: var(--brass-soft); }

/* артисты выходят на сцену по очереди */
.stage .artist .cutout { opacity: 0; translate: -50% 40px; transition: opacity 1s ease, translate 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.5s; }
.stage .artist .cone { opacity: 0.2; transition: opacity 1.2s; }
.stage.lit .artist .cutout { opacity: 1; translate: -50% 0; }
.stage.lit .artist .cone { opacity: 0.85; }
.stage.lit .artist:nth-child(2) .cutout { transition-delay: 0.15s; }
.stage.lit .artist:nth-child(3) .cutout { transition-delay: 0.3s; }
.stage.lit .artist:nth-child(4) .cutout { transition-delay: 0.45s; }
.stage.lit .artist:nth-child(5) .cutout { transition-delay: 0.6s; }
.stage.lit .artist:nth-child(6) .cutout { transition-delay: 0.75s; }
.stage.lit .artist:nth-child(7) .cutout { transition-delay: 0.9s; }
.artist:hover .cutout { filter: drop-shadow(0 0 18px rgba(243, 223, 174, 0.45)) drop-shadow(0 14px 18px rgba(0, 0, 0, 0.6)); }
.artist::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 244, 214, 0.16) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 120% 0;
  transition: background-position 1.1s ease;
}
.artist:hover::after { background-position: -20% 0; }

/* программа вечера и партнёры раздаются, как карты */
.dance-card li { opacity: 0; transform: translateX(-30px) rotate(-2deg); transition: opacity 0.7s, transform 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.dance-card.dealt li { opacity: 1; transform: none; }
.dance-card.dealt li:nth-child(2) { transition-delay: 0.12s; }
.dance-card.dealt li:nth-child(3) { transition-delay: 0.24s; }
.dance-card.dealt li:nth-child(4) { transition-delay: 0.36s; }
.dance-card.dealt li:nth-child(5) { transition-delay: 0.48s; }
.dance-card.dealt li:nth-child(6) { transition-delay: 0.6s; }
.dance-card.dealt li:nth-child(7) { transition-delay: 0.72s; }
.dance-card li b { background: linear-gradient(var(--brass-soft), var(--brass-soft)) 0 100% / 0 1px no-repeat; transition: background-size 0.5s; }
.dance-card li:hover b { background-size: 100% 1px; }

.collage figure { opacity: 0; transform: translateY(40px) scale(0.96); transition: opacity 0.9s, transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.collage.dealt figure { opacity: 1; transform: none; }
.collage.dealt figure:nth-child(2) { transition-delay: 0.1s; }
.collage.dealt figure:nth-child(3) { transition-delay: 0.2s; }
.collage.dealt figure:nth-child(4) { transition-delay: 0.3s; }
.collage.dealt figure:nth-child(5) { transition-delay: 0.4s; }
.collage.dealt figure:nth-child(6) { transition-delay: 0.5s; }
.collage.dealt figure:nth-child(7) { transition-delay: 0.6s; }

/* у мест для партнёров бежит золотая рамка */
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.slots li { position: relative; }
.slots li::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0 70%, #f3dfae 82%, var(--brass) 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: orbit 4s linear infinite;
}
.slots li:nth-child(2)::before { animation-delay: -1s; }
.slots li:nth-child(3)::before { animation-delay: -2s; }
.slots li:nth-child(4)::before { animation-delay: -3s; }
@keyframes orbit { to { --ang: 360deg; } }

/* галерея-дуга */
.strip { perspective: 1400px; }
.track figure { will-change: transform, opacity; }

/* параллакс фото */
img.par { translate: 0 var(--py, 0); transition: translate 0.2s linear; }

/* кнопки: магнит и проблеск */
.btn { transition: translate 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s, color 0.2s; position: relative; overflow: hidden; }
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 248, 225, 0.55) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: glint 5s ease-in-out 2s infinite;
}
@keyframes glint { 0%, 70% { transform: translateX(-120%); } 90%, 100% { transform: translateX(120%); } }

/* золотое кольцо за курсором */
.ring {
  position: fixed;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(211, 172, 99, 0.85);
  border-radius: 50%;
  pointer-events: none;
  z-index: 130;
  transition: width 0.3s, height 0.3s, left 0.3s, top 0.3s, background-color 0.3s;
  will-change: transform;
  box-shadow: 0 0 0 1px rgba(13, 19, 48, 0.35);
}
.ring.big { width: 56px; height: 56px; left: -28px; top: -28px; background: rgba(211, 172, 99, 0.12); }

/* сердечки в сборе */
.hearts { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.fund > :not(.hearts):not(.aura):not(.divider), .donate > :not(.hearts):not(.aura):not(.divider) { position: relative; z-index: 1; }
.hearts i {
  position: absolute;
  bottom: -30px;
  font-style: normal;
  color: #e7c27c;
  opacity: 0;
  text-shadow: 0 0 10px rgba(243, 223, 174, 0.6);
  animation-name: floatheart;
  animation-timing-function: ease-in;
  animation-iteration-count: infinite;
}
@keyframes floatheart {
  0% { transform: translateY(0) rotate(0) scale(0.6); opacity: 0; }
  15% { opacity: 0.7; }
  50% { transform: translateY(-45vh) translateX(20px) rotate(14deg) scale(1); }
  100% { transform: translateY(-95vh) translateX(-10px) rotate(-10deg) scale(0.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  h2.waltz .ch, .stage .artist .cutout, .dance-card li, .collage figure { opacity: 1; transform: none; translate: -50% 0; transition: none; }
  .dance-card li, .collage figure { translate: none; }
  .hearts, .btn::after, .slots li::before, .thread i { animation: none; display: none; }
}

/* ================= телефон ================= */
@media (max-width: 700px) {
  /* меню в одну строку с прокруткой вбок, шапка прилипает и размывает фон */
  .bar, .top {
    position: sticky !important;
    top: 0;
    z-index: 60;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.9rem !important;
    padding: 0.7rem 16px !important;
    background: rgba(13, 19, 48, 0.96) !important;
    border-bottom: 1px solid rgba(184, 138, 59, 0.25);
  }
  .bar .mark, .top .mark { flex: none; font-size: 1.6rem; }
  .bar nav, .top nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 1.1rem !important;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 0.92rem !important;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
    mask-image: linear-gradient(90deg, #000 82%, transparent);
    padding-right: 1.5rem;
  }
  .bar nav::-webkit-scrollbar, .top nav::-webkit-scrollbar { display: none; }
  .hero { padding-top: 2.4rem !important; min-height: 0 !important; }

  /* сказка спокойнее по размеру */
  .intro p { font-size: 1.3rem; line-height: 1.5; }
  .intro .tale::first-letter { font-size: 3em; }

  /* заголовок страницы выпускников в одну-две аккуратные строки */
  .hero h1 { font-size: clamp(3rem, 14vw, 4.4rem); line-height: 1; }
  .hero h1 .yr { white-space: nowrap; }

  /* вензель не налезает на заголовки */
  main > section.has-aura { padding-top: 5rem; }
  .divider { top: 1.6rem; width: 150px; }
  .divider svg { width: 150px !important; height: 16px !important; }

  /* сцена артистов: карточка почти на весь экран, видно край следующей */
  .stage { padding-left: 16px !important; padding-right: 16px !important; scroll-padding: 0 16px; }
  .artist { width: 72vw !important; height: 104vw !important; max-height: 430px; }
  .a-name { font-size: 2rem; }

  /* фото в галерее ровные, без дуги */
  .track figure { transform: none !important; filter: none !important; }

  /* открытка на телефоне */
  .pc-hint { right: 12px; bottom: 12px; font-size: 0.72rem; }

  /* меньше снега и без кольца */
  .snow { opacity: 0.55; }
}
