/* ==========================================================================
   La mulți ani, Alexia! — stiluri
   ========================================================================== */

/* ---------- Variabile ---------- */
:root {
  --bg-1: #1a1033;
  --bg-2: #3b1d4f;
  --pink: #ff7eb6;
  --gold: #ffd27d;
  --text: #fff6fb;
  --muted: #d9c6e6;
  --card: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.14);

  --font-script: 'Dancing Script', cursive;
  --font-body: 'Nunito', system-ui, sans-serif;

  /* straturi (z-index) */
  --z-stars: 0;
  --z-content: 1;
  --z-planets: 5;
  --z-hearts: 40;
  --z-cow: 46;
  --z-rainbow: 47;
  --z-confetti: 50;
  --z-videos: 60;
  --z-lightbox: 100;
}

/* ---------- Bază ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg-1) 70%) fixed;
  background-color: var(--bg-1);
}

main {
  position: relative;
  z-index: var(--z-content);
}

/* Secțiunile lasă click-ul să treacă; doar conținutul real îl prinde */
section {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 64px 16px;
  text-align: center;
  pointer-events: none;
}

section h1,
section h2,
.sub,
.hint,
.cake,
.who,
.bubble,
.wish,
.polaroid,
.btn {
  pointer-events: auto;
}

footer {
  position: relative;
  z-index: var(--z-content);
  padding: 24px 16px 40px;
  font-size: 0.9rem;
  text-align: center;
  color: var(--muted);
}

/* ---------- Canvas-uri pe tot ecranul ---------- */
.fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

#stars {
  z-index: var(--z-stars);
}

#confetti {
  z-index: var(--z-confetti);
}

#rainbow {
  z-index: var(--z-rainbow);
}

/* ---------- Tipografie ---------- */
h1 {
  /* padding = loc pentru buclele fontului, altfel degradeul le taie */
  padding: 0 0.25em 0.1em;
  font-family: var(--font-script);
  font-size: clamp(3rem, 11vw, 7rem);
  line-height: 1.05;
  color: transparent;
  background: linear-gradient(90deg, var(--gold), var(--pink), var(--gold));
  background-size: 200%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 6s linear infinite;
}

h1.h1--small {
  font-size: clamp(2.6rem, 9vw, 5rem);
}

h2 {
  margin-bottom: 24px;
  font-family: var(--font-script);
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  color: var(--gold);
}

.sub {
  max-width: 560px;
  margin: 12px auto 0;
  font-size: 1.15rem;
  color: var(--muted);
}

.hint {
  margin-top: 28px;
  font-size: 0.95rem;
  color: var(--muted);
  animation: pulse 2s ease-in-out infinite;
}

/* ---------- Apariție la scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.9s ease,
    transform 0.9s ease;
}

.reveal.show {
  opacity: 1;
  transform: none;
}

.reveal--wide {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ---------- Tort ---------- */
.cake {
  width: min(280px, 75vw);
  margin-top: 28px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.flame {
  transform-origin: 50% 100%;
  animation: flicker 0.25s ease-in-out infinite alternate;
  transition:
    opacity 0.4s,
    transform 0.4s;
}

.smoke {
  opacity: 0;
}

.cake.out .flame {
  opacity: 0;
  transform: scaleY(0);
}

.cake.out .smoke {
  animation: smoke 1.6s ease-out forwards;
}

/* ---------- „Pentru tine” ---------- */
.letter {
  display: flex;
  flex-direction: column;
  gap: 36px;
  width: 100%;
  max-width: 760px;
  text-align: left;
}

.letter__row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.letter__row--reverse {
  flex-direction: row-reverse;
}

.who {
  flex: 0 0 clamp(96px, 26vw, 180px);
}

.who img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.who figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  color: var(--gold);
}

.bubble {
  flex: 1;
  min-width: 0;
  margin-bottom: 34px;
  padding: 24px 22px;
  font-size: 1.1rem;
  line-height: 1.8;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(6px);
}

.bubble p + p {
  margin-top: 12px;
}

.bubble .sign {
  margin-top: 16px;
  font-family: var(--font-script);
  font-size: 1.8rem;
  text-align: right;
  color: var(--pink);
}

/* ---------- Urări ---------- */
.wishes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 900px;
}

.wish {
  padding: 24px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition: transform 0.3s;
}

.wish:hover {
  transform: translateY(-6px) rotate(-1deg);
}

.wish__emoji {
  font-size: 2.2rem;
}

.wish h3 {
  margin: 10px 0 6px;
  color: var(--gold);
}

.wish p {
  color: var(--muted);
}

/* ---------- Galerie ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 900px;
}

.polaroid {
  position: relative;
  padding: 10px 10px 36px;
  font-family: var(--font-script);
  font-size: 1.3rem;
  color: #333;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s;
}

.polaroid:nth-child(odd) {
  transform: rotate(-2.5deg);
}

.polaroid:nth-child(even) {
  transform: rotate(2deg);
}

.polaroid:hover {
  z-index: 2;
  transform: rotate(0) scale(1.04);
}

.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #eee;
}

.polaroid figcaption {
  position: absolute;
  right: 0;
  bottom: 6px;
  left: 0;
}

/* ---------- Buton + inimioare ---------- */
.btn {
  margin-top: 32px;
  padding: 14px 32px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--bg-1);
  background: linear-gradient(90deg, var(--gold), var(--pink));
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(255, 126, 182, 0.35);
  cursor: pointer;
  transition: transform 0.2s;
}

.btn:hover {
  transform: scale(1.06);
}

.btn:active {
  transform: scale(0.97);
}

.heart {
  position: fixed;
  bottom: -40px;
  z-index: var(--z-hearts);
  pointer-events: none;
  animation: rise linear forwards;
}

/* ---------- Vaca Milka ---------- */
#milka {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-cow);
  width: min(200px, 38vw);
  border-radius: 4px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
  cursor: pointer;
  user-select: none;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Planete ---------- */
#planets {
  position: absolute;
  inset: 0;
  z-index: var(--z-planets); /* deasupra conținutului, ca să se poată apăsa */
  overflow: hidden;
  pointer-events: none;
}

.planet {
  position: absolute;
  width: clamp(64px, 17vw, 170px);
  aspect-ratio: 1;
  cursor: pointer;
  pointer-events: auto;
  animation: float 6s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.planet__ball {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: 50%;
  box-shadow:
    0 0 30px 4px rgba(255, 126, 182, 0.45),
    0 0 70px 14px rgba(126, 200, 255, 0.16);
  transition: transform 0.3s;
}

.planet:hover .planet__ball {
  transform: scale(1.08);
}

.planet__ball img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: spin 40s linear infinite;
}

/* lumină sus-stânga, umbră jos-dreapta */
.planet__ball::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(circle at 70% 75%, rgba(10, 0, 30, 0.65), transparent 65%);
}

/* inelul e desenat de două ori: jumătatea din spate și cea din față */
.planet__ring {
  position: absolute;
  top: 42%;
  right: -40%;
  left: -40%;
  height: 16%;
  border: clamp(3px, 0.6vw, 6px) solid rgba(255, 210, 125, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 210, 125, 0.6);
  transform: rotate(-18deg);
  pointer-events: none;
}

.planet__ring--back {
  z-index: 1;
}

.planet__ring--front {
  z-index: 3;
  clip-path: inset(50% 0 0 0);
}

.planet__name {
  position: absolute;
  top: calc(100% + 16px);
  right: -30%;
  left: -30%;
  font-size: clamp(0.65rem, 1.6vw, 0.85rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  white-space: nowrap;
  color: var(--gold);
}

/* ---------- Poza mare (lightbox) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  background: rgba(10, 4, 25, 0.88);
  opacity: 0;
  cursor: zoom-out;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: min(92vw, 700px);
  max-height: 78vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.lightbox.open img {
  transform: none;
}

.lightbox__title {
  font-family: var(--font-script);
  font-size: 2rem;
  color: var(--gold);
}

.lightbox__hint {
  color: var(--muted);
}

/* ---------- Clipurile aruncate pe ecran ---------- */
.flyvid {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-videos);
  width: clamp(130px, 30vw, 260px);
  overflow: hidden;
  background: #000;
  border: 4px solid #fff;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  container-type: inline-size;
  transition: transform 0.9s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.flyvid.bye {
  opacity: 0;
  transition:
    transform 0.4s ease-in,
    opacity 0.4s;
}

.flyvid video {
  display: block;
  width: 100%;
}

/* petic negru peste textul original al clipului */
.flyvid__patch {
  position: absolute;
  background: radial-gradient(ellipse, #000 55%, transparent 75%);
  pointer-events: none;
}

.flyvid__sub {
  position: absolute;
  font:
    italic 800 6cqw/1 Arial,
    sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #fff;
  text-shadow:
    0 0 2px #000,
    0 0 2px #000,
    1px 1px 0 #000;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ---------- Animații ---------- */
@keyframes shine {
  to {
    background-position: 200%;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

@keyframes flicker {
  from {
    transform: scaleY(1) rotate(-2deg);
  }
  to {
    transform: scaleY(1.12) rotate(2deg);
  }
}

@keyframes smoke {
  0% {
    opacity: 0.7;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px);
  }
}

@keyframes rise {
  to {
    opacity: 0;
    transform: translateY(-115vh) rotate(25deg);
  }
}

@keyframes float {
  50% {
    transform: translateY(-14px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .planet__name {
    top: calc(100% + 12px);
    right: -25%;
    left: -25%;
    line-height: 1.15;
    white-space: normal;
  }

  .planet__ring {
    border-width: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
