/* Birthday Site — праздничная открытка (клей-морфизм, розовая палитра) */

:root {
  --bg: #FFF1F2;
  --surface: #FFFFFF;
  --primary: #E11D48;
  --primary-strong: #BE123C;
  --on-primary: #FFFFFF;
  --secondary: #FB7185;
  --accent: #2563EB;
  --text: #881337;
  --text-strong: #4C0519;
  --text-muted: #9F1239;
  --border: #FECDD3;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-soft: 0 10px 24px -8px rgba(136, 19, 55, 0.18);
  --shadow-clay: 0 14px 28px -10px rgba(225, 29, 72, 0.4),
    inset 0 -4px 10px rgba(190, 18, 60, 0.25),
    inset 0 3px 6px rgba(255, 255, 255, 0.55);
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Comfortaa', 'Nunito', sans-serif;
  --font-hand: 'Caveat', 'Segoe Script', cursive;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(700px 460px at 88% -8%, #FFE4E6 0%, rgba(255, 228, 230, 0) 65%),
    radial-gradient(560px 420px at -8% 28%, #FEF3C7 0%, rgba(254, 243, 199, 0) 62%),
    radial-gradient(620px 460px at 108% 72%, #E0E7FF 0%, rgba(224, 231, 255, 0) 60%),
    var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ---------- шарики ---------- */
.balloons { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.balloon {
  position: absolute;
  width: 64px;
  height: 80px;
  border-radius: 50% 50% 50% 50% / 46% 46% 54% 54%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 42%),
    var(--b, var(--secondary));
  opacity: 0.55;
  animation: balloon-float 12s ease-in-out infinite alternate;
}
.balloon::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -84px;
  width: 2px;
  height: 84px;
  background: linear-gradient(rgba(136, 19, 55, 0.35), rgba(136, 19, 55, 0));
}
.balloon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--b, var(--secondary));
}
.b1 { --b: #FB7185; left: 4%; top: 58%; }
.b2 { --b: #F59E0B; right: 6%; top: 16%; width: 54px; height: 68px; animation-duration: 15s; }
.b3 { --b: #8B5CF6; left: 10%; top: 12%; width: 48px; height: 60px; animation-duration: 10s; }
.b4 { --b: #2563EB; right: 12%; top: 62%; animation-duration: 17s; }
.b5 { --b: #10B981; left: 46%; top: 76%; width: 44px; height: 56px; animation-duration: 13s; }
@keyframes balloon-float {
  from { transform: translateY(0) rotate(-2deg); }
  to { transform: translateY(-28px) rotate(3deg); }
}
@media (max-width: 640px) {
  .b3, .b5 { display: none; }
}

/* ---------- герой ---------- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 108px 20px 48px;
  max-width: 860px;
  margin: 0 auto;
}
.bunting {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, 112%);
  height: 74px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px;
  padding: 8px 20px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  font-weight: 800;
  color: var(--primary-strong);
}
.hero-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 6.5vw, 3.9rem);
  line-height: 1.15;
  color: var(--primary);
  overflow-wrap: break-word;
}
.hero-title em {
  font-style: normal;
  color: var(--primary-strong);
  text-decoration: underline wavy rgba(245, 158, 11, 0.75) 4px;
  text-underline-offset: 10px;
}
.hero-subtitle {
  margin: 0 auto 30px;
  max-width: 520px;
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 26px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-lg { min-height: 56px; padding: 14px 34px; font-size: 1.1rem; }
.btn-primary {
  background: linear-gradient(180deg, #F43F5E, var(--primary));
  color: var(--on-primary);
  box-shadow: var(--shadow-clay);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-primary:active { transform: scale(0.96); }
.btn-ghost {
  background: var(--surface);
  color: var(--primary-strong);
  border: 2px solid var(--border);
}
.btn-ghost:hover { border-color: var(--secondary); }
.btn-ghost:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
:is(button, input, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--primary-strong);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { background: var(--border); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- секции ---------- */
main { position: relative; z-index: 1; }
.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 44px;
}
.section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--text-strong);
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--secondary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 800;
}

/* ---------- галерея ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 22px;
}
.polaroid {
  padding: 10px 10px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: zoom-in;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.polaroid:hover { transform: rotate(0deg) scale(1.04); box-shadow: 0 16px 32px -10px rgba(136, 19, 55, 0.3); }
.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* ---------- видео ---------- */
.video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-soft);
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- стена поздравлений ---------- */
.wall { columns: 280px 3; column-gap: 22px; }
.greet-card {
  break-inside: avoid;
  margin: 0 0 22px;
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease;
}
.greet-card:hover { transform: rotate(0deg) translateY(-3px); }
.greet-drawing {
  display: block;
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}
.greet-text {
  margin: 12px 0 6px;
  font-family: var(--font-hand);
  font-size: 1.75rem;
  line-height: 1.25;
  color: var(--text-strong);
  overflow-wrap: break-word;
}
.greet-card > .greet-text:first-child { margin-top: 2px; }
.greet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
}
.greet-author { font-weight: 800; color: var(--primary); }
.greet-meta time { font-size: 0.8rem; color: var(--text-muted); }

.empty {
  text-align: center;
  padding: 44px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
}
.empty p { margin: 0 0 18px; font-size: 1.15rem; font-weight: 700; color: var(--text-muted); }

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 26px 20px 34px;
  color: var(--text-muted);
  font-weight: 700;
}

/* ---------- модалка поздравления ---------- */
.modal {
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(680px, calc(100vw - 20px));
  background: var(--surface);
  box-shadow: 0 30px 60px -20px rgba(76, 5, 25, 0.5);
}
.modal::backdrop { background: rgba(76, 5, 25, 0.45); backdrop-filter: blur(3px); }
.modal-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  max-height: calc(100dvh - 40px);
  overflow: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-strong);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--c);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--accent); }
.tool-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--primary-strong);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.tool-btn:hover { border-color: var(--secondary); }
.tool-btn:active { transform: scale(0.93); }
.tool-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.tool-btn[aria-pressed='true'] {
  border-color: var(--accent);
  background: #EFF6FF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.tool-btn .dot {
  width: var(--d, 8px);
  height: var(--d, 8px);
  border-radius: 50%;
  background: currentColor;
}
@media (pointer: coarse) {
  .swatch { width: 42px; height: 42px; }
}

.canvas-wrap {
  position: relative;
  flex-shrink: 0;
  aspect-ratio: 3 / 2;
  background: #fff;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.pad-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-family: var(--font-hand);
  font-size: 1.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-strong);
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-strong);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.field ::placeholder { color: #C48A9B; }

.form-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  font-weight: 700;
}

/* ---------- лайтбокс ---------- */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
}
.lightbox::backdrop { background: rgba(30, 5, 12, 0.8); backdrop-filter: blur(4px); }
.lightbox img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 85dvh;
  border-radius: var(--radius-md);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.92);
}

/* ---------- тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  z-index: 60;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--text-strong);
  color: #fff;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .balloon { animation: none; }
  html { scroll-behavior: auto; }
}
