/* =========================================================
   O Bosque Encantado da Olívia — woodland watercolor theme
   Paleta inspirada no convite: creme, terracota, sálvia,
   marrom-urso e vermelhos suaves. Mobile-first.
   ========================================================= */

:root {
  /* base */
  --cream: #fbf3e3;
  --cream-2: #f4e8d2;
  --cream-3: #efe1c6;
  --parchment: #fdf8ee;

  /* accents (do convite) */
  --terracotta: #b3593c;
  --terracotta-deep: #98472e;
  --rust: #a64a32;
  --berry: #b5402f;
  --heart: #c0432f;
  --sage: #8f9b63;
  --sage-deep: #6f7c47;
  --olive: #7e8a4d;
  --gold: #c8a86a;
  --gold-glow: #ecc987;
  --bark: #5c4632;
  --bark-soft: #806a52;
  --fox: #d2703a;
  --ink: #463323;

  --radius: 24px;
  --radius-sm: 15px;
  --shadow-soft: 0 16px 40px -18px rgba(92, 70, 50, 0.45);
  --shadow-glow: 0 0 28px -6px rgba(236, 201, 135, 0.55);

  --font-display: "Great Vibes", cursive;
  --font-head: "Quicksand", system-ui, sans-serif;
  --font-body: "Gantari", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* O atributo `hidden` perde para qualquer `display` definido por classe do
   autor (a origem "author" sempre vence "user-agent" na cascata, mesmo com
   especificidade igual). Sem isso, elementos com `display:flex` numa classe
   continuam visíveis mesmo com `hidden` presente. */
[hidden] { display: none !important; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, #fdf7ea 0%, #f5e9d2 48%, #ecdcbe 100%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* ---------- Background atmosfera ---------- */
.forest-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.sunbeams {
  position: absolute; inset: 0;
  background:
    radial-gradient(55% 45% at 18% 0%, rgba(236, 201, 135, 0.35), transparent 70%),
    radial-gradient(50% 40% at 85% 6%, rgba(143, 155, 99, 0.18), transparent 70%),
    radial-gradient(70% 55% at 50% 112%, rgba(126, 138, 77, 0.16), transparent 70%);
}

.mist {
  position: absolute; inset: -20%;
  background:
    radial-gradient(40% 30% at 30% 70%, rgba(179, 89, 60, 0.07), transparent 70%),
    radial-gradient(40% 30% at 70% 80%, rgba(236, 201, 135, 0.12), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to   { transform: translate3d(3%, -2%, 0) scale(1.08); }
}

/* vaga-lumes / poeira dourada */
#fireflies { position: absolute; inset: 0; }
.firefly {
  position: absolute;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-glow);
  box-shadow: 0 0 8px 2px rgba(236, 201, 135, 0.85), 0 0 18px 6px rgba(200, 168, 106, 0.4);
  opacity: 0;
  animation: float-firefly linear infinite, glow-firefly ease-in-out infinite;
}
@keyframes float-firefly {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(var(--dx, 30px), var(--dy, -120px), 0); }
}
@keyframes glow-firefly {
  0%, 100% { opacity: 0; }
  20%, 80% { opacity: var(--max-op, 0.8); }
}

/* folhas caindo */
#leaves { position: absolute; inset: 0; }
.leaf {
  position: absolute;
  top: -8%;
  font-size: var(--size, 20px);
  opacity: 0;
  will-change: transform;
  animation: fall linear infinite;
  filter: drop-shadow(0 3px 4px rgba(92, 70, 50, 0.18));
}
@keyframes fall {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  10%  { opacity: var(--leaf-op, 0.85); }
  90%  { opacity: var(--leaf-op, 0.85); }
  100% { opacity: 0; transform: translate3d(var(--sway, 40px), 112vh, 0) rotate(var(--spin, 320deg)); }
}

/* ---------- Views ---------- */
.view {
  position: fixed; inset: 0; z-index: 1;
  display: none;
  flex-direction: column;
  padding: max(env(safe-area-inset-top), 18px) 22px max(env(safe-area-inset-bottom), 18px);
}
.view.is-active { display: flex; }

/* ---------- Home ---------- */
.view--home { justify-content: space-between; text-align: center; }

.home-header { padding-top: 5vh; animation: rise 0.9s cubic-bezier(.2,.8,.2,1) both; }

.animals-row {
  display: flex; justify-content: center; gap: 14px;
  font-size: clamp(2rem, 11vw, 3rem);
  margin-bottom: 6px;
  filter: drop-shadow(0 6px 8px rgba(92, 70, 50, 0.22));
}
.animals-row .animal { display: inline-block; animation: bob 4s ease-in-out infinite; }
.animals-row .animal:nth-child(2) { animation-delay: .5s; }
.animals-row .animal:nth-child(3) { animation-delay: 1s; }
.animals-row .animal:nth-child(4) { animation-delay: 1.5s; }
@keyframes bob { 0%,100%{ transform: translateY(0) rotate(-2deg);} 50%{ transform: translateY(-7px) rotate(2deg);} }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--bark-soft);
  font-size: 0.74rem;
  margin-top: 10px;
  margin-bottom: 18px;
}
.title {
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 25vw, 6.5rem);
  line-height: 1.05;
  font-weight: 400;
  color: var(--rust);
  text-shadow: 0 3px 0 rgba(255,255,255,0.45), 0 8px 22px rgba(166, 74, 50, 0.25);
  margin: 0 0 6px;
}

.divider {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--heart); font-size: 1rem;
}
.divider i {
  color: var(--sage-deep); font-style: normal; font-size: 1.2rem;
  transform: rotate(0deg);
}
.divider i:last-child { transform: scaleX(-1); }

.ribbon {
  display: inline-block;
  font-family: var(--font-head); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  font-size: 0.74rem; color: var(--cream);
  background: linear-gradient(180deg, var(--gold), #b89653);
  padding: 7px 18px; border-radius: 6px;
  margin-top: 10px;
  box-shadow: 0 6px 14px -6px rgba(184, 150, 83, 0.7);
  position: relative;
}

.home-card {
  position: relative;
  background: linear-gradient(180deg, var(--parchment), #f7eeddee);
  border: 1.5px solid rgba(143, 155, 99, 0.4);
  border-radius: var(--radius);
  padding: 26px 22px 24px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 13px;
  animation: rise 0.9s 0.1s cubic-bezier(.2,.8,.2,1) both;
}
.home-card__mush {
  position: absolute; top: -18px; right: 16px;
  font-size: 2.1rem;
  filter: drop-shadow(0 4px 6px rgba(92,70,50,.25));
  animation: bob 5s ease-in-out infinite;
}
.home-card__lead { font-size: 1.04rem; color: var(--bark); line-height: 1.5; margin-bottom: 2px; }

.home-counter { font-family: var(--font-head); font-weight: 500; font-size: .9rem; color: var(--sage-deep); margin-top: 2px; }
.home-counter #home-counter-num { color: var(--terracotta); font-weight: 700; }

.home-footer {
  font-family: var(--font-head); font-weight: 500;
  font-size: 0.82rem; color: var(--bark-soft);
  padding-bottom: 4px;
  animation: rise 0.9s 0.2s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn__icon { font-size: 1.2em; }
.btn--sm { font-size: 0.98rem; padding: 13px 18px; }

.btn--primary {
  color: #fff7ec;
  background: linear-gradient(135deg, var(--terracotta), var(--fox));
  box-shadow: 0 10px 22px -8px rgba(179, 89, 60, 0.65);
}
.btn--primary:active { filter: brightness(1.04); }

.btn--ghost {
  color: var(--sage-deep);
  background: rgba(143, 155, 99, 0.14);
  border: 1.5px solid rgba(143, 155, 99, 0.55);
}

.icon-btn {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid rgba(253, 248, 238, 0.5);
  background: rgba(70, 51, 35, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff7ec;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.icon-btn:active { transform: scale(0.9); }

/* ---------- Camera ---------- */
.view--camera { padding: 0; background: #2a2018; }
.camera-stage { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; }
#camera-video, #camera-preview {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #2a2018;
}
.camera-vignette {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px 30px rgba(60, 44, 30, 0.6);
}
.camera-close { position: absolute; top: max(env(safe-area-inset-top), 14px); right: 14px; z-index: 3; }

.camera-fallback {
  position: relative; z-index: 2;
  text-align: center; color: var(--cream);
  background: rgba(70, 51, 35, 0.82);
  padding: 24px; border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 16px; align-items: center;
  max-width: 320px;
}

.camera-controls {
  background: linear-gradient(0deg, rgba(42, 32, 24, 0.96), rgba(42, 32, 24, 0.45));
  padding: 20px 22px max(env(safe-area-inset-bottom), 24px);
}
.camera-controls__row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.camera-controls__row .spacer { width: 48px; }
.camera-controls__row .btn { flex: 1; }

.shutter {
  width: 76px; height: 76px; border-radius: 50%;
  border: 4px solid var(--gold-glow);
  background: transparent;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.12s ease;
}
.shutter span {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-glow), var(--terracotta));
  display: block;
}
.shutter:active { transform: scale(0.92); }

/* ---------- Gallery / Carousel ---------- */
.view--gallery { padding: 0; background: #2a2018; }
.gallery-close { position: absolute; top: max(env(safe-area-inset-top), 14px); right: 14px; z-index: 5; }

.carousel { position: absolute; inset: 0; overflow: hidden; }
.carousel__slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  background-size: cover;
  background-position: center;
  transform: scale(1.08);
}
.carousel__slide.is-active { opacity: 1; animation: kenburns 8s ease-out forwards; }
@keyframes kenburns {
  from { transform: scale(1.0) translate(0,0); }
  to   { transform: scale(1.12) translate(var(--kx, -1.5%), var(--ky, -1.5%)); }
}
.carousel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(60,44,30,0.30) 0%, transparent 22%, transparent 58%, rgba(42,32,24,0.85) 100%);
  box-shadow: inset 0 0 140px 40px rgba(60,44,30,0.55);
}

.carousel__empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; color: var(--cream); padding: 24px;
}
.carousel__empty-emoji { font-size: 56px; animation: bob 5s ease-in-out infinite; }
.carousel__empty p { font-family: var(--font-head); font-weight: 600; font-size: 1.3rem; }
.carousel__empty span { color: var(--cream-2); font-size: 0.95rem; }

/* ---------- Floating gallery (fotos flutuantes espalhadas) ---------- */
.floating-gallery {
  position: absolute; inset: 0;
  overflow: hidden;
}

.floating-photo {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.9s ease;
  cursor: pointer;
}
.floating-photo.is-visible { opacity: 1; }

.floating-photo__frame {
  width: var(--fw, 108px);
  padding: 7px 7px 20px;
  background: var(--parchment);
  border-radius: 5px;
  box-shadow: 0 16px 30px -14px rgba(60, 44, 30, 0.6), 0 3px 8px rgba(60, 44, 30, 0.28);
  transform: rotate(var(--rot, 0deg)) scale(var(--scl, 1));
  animation: photo-bob var(--bob-dur, 6s) ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
  transition: filter 0.15s ease;
}
.floating-photo:active .floating-photo__frame { filter: brightness(0.9); }

@keyframes photo-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 var(--bob, -10px); }
}

.floating-photo__frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 2px;
  background: #e7dcc4;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.floating-photo__frame img.is-loaded { opacity: 1; }

/* ---------- Lightbox ---------- */
.photo-lightbox {
  position: fixed; inset: 0; z-index: 30;
  display: none; place-items: center;
  background: rgba(42, 32, 24, 0.88);
  padding: 30px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.photo-lightbox.is-show { display: grid; opacity: 1; }
.photo-lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px;
  border: 7px solid var(--parchment);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}
.photo-lightbox.is-show img { transform: scale(1); }

.gallery-caption {
  position: absolute; left: 0; right: 0;
  bottom: max(env(safe-area-inset-bottom), 22px);
  z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.gallery-caption__title { font-family: var(--font-display); font-size: 2.1rem; color: var(--gold-glow); }
.gallery-caption__count { font-family: var(--font-head); font-weight: 500; font-size: 0.85rem; color: var(--cream-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(30px);
  z-index: 50;
  background: var(--parchment);
  border: 1.5px solid rgba(143, 155, 99, 0.6);
  color: var(--bark);
  font-family: var(--font-head); font-weight: 600; font-size: 0.95rem;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow-soft);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 86vw; text-align: center;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-success { border-color: var(--sage); }
.toast.is-error { border-color: var(--terracotta); }

/* upload sparkle overlay */
.sending {
  position: fixed; inset: 0; z-index: 40;
  display: none; place-items: center;
  background: rgba(60, 44, 30, 0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.sending.is-show { display: grid; }
.sending__orb {
  width: 70px; height: 70px; border-radius: 50%;
  border: 3px solid rgba(236, 201, 135, 0.3);
  border-top-color: var(--gold-glow);
  animation: spin 0.9s linear infinite;
  box-shadow: var(--shadow-glow);
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }
}
