/* ============================================================
   BUDINO — tema erba / verde, festoso & minimale
   ============================================================ */

:root {
  --bg:       #eef8e6;
  --bg-2:     #d8efbf;
  --ink:      #1e3a1e;
  --ink-2:    #41603a;
  --green:    #57b23a;
  --green-d:  #2e7d32;
  --lime:     #a5d84a;
  --haze:     #7e57c2;   /* pop viola "haze" per il pill VIDEO */
  --mint:     #3ddc97;
  --leaf:     #4c9a2a;
  --leaf-stem:#3f7a24;
  --radius:   18px;
  --shadow:   0 10px 30px rgba(24, 58, 24, .16);
  --font: "Fredoka", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 500px at 90% 110%, rgba(87,178,58,.14), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}

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

/* ---------------------------- HERO ---------------------------- */
.hero {
  position: relative;
  min-height: 88vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 6vh 20px 4vh;
}

.hero-inner { position: relative; z-index: 2; }

.pudding { margin: 0 auto 6px; animation: bob 3.2s ease-in-out infinite; }
.pud-shadow   { fill: rgba(24, 58, 24, .12); }
.pud-body     { fill: #5c8a34; }
.pud-top      { fill: #8bc34a; }
.pud-glaze    { fill: #3f7a24; opacity: .8; }
.pud-leaf path { fill: var(--leaf); }
.pud-leaf .leaf-stem { fill: var(--leaf-stem); }

.title {
  font-size: clamp(3.4rem, 15vw, 9rem);
  font-weight: 700;
  letter-spacing: .04em;
  margin: 0;
  line-height: .95;
  color: var(--green-d);
  text-shadow: 0 4px 0 rgba(255, 255, 255, .55), 0 12px 26px rgba(46, 125, 50, .28);
  cursor: pointer;
  user-select: none;
}
.title span {
  display: inline-block;
  animation: jiggle 2.6s ease-in-out infinite;
}
.title span:nth-child(2) { animation-delay: .08s; }
.title span:nth-child(3) { animation-delay: .16s; }
.title span:nth-child(4) { animation-delay: .24s; }
.title span:nth-child(5) { animation-delay: .32s; }
.title span:nth-child(6) { animation-delay: .40s; }

.tagline {
  margin: 14px auto 0;
  max-width: 30ch;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  font-weight: 500;
  color: var(--ink-2);
}

.scroll-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 40px;
  color: var(--green-d);
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  opacity: .9;
}
.scroll-cue svg { animation: bob 1.8s ease-in-out infinite; }
.scroll-cue:hover { opacity: 1; }

/* --------------------------- GALLERY -------------------------- */
.gallery {
  column-count: 4;
  column-gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px 60px;
}
@media (max-width: 1024px) { .gallery { column-count: 3; } }
@media (max-width: 680px)  { .gallery { column-count: 2; column-gap: 12px; padding: 10px 12px 48px; } }
@media (max-width: 380px)  { .gallery { column-count: 1; } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  border: none;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  break-inside: avoid;
  transform: rotate(var(--rot, 0deg));
  transition: transform .32s cubic-bezier(.2,.9,.3,1.3), box-shadow .32s ease;
  outline: none;
  /* stato iniziale reveal */
  opacity: 0;
}
.tile.in { opacity: 1; animation: pop .55s cubic-bezier(.2,.9,.3,1.25) both; }
.tile:hover,
.tile:focus-visible {
  transform: rotate(0deg) translateY(-6px) scale(1.02);
  box-shadow: 0 18px 40px rgba(24, 58, 24, .26);
  z-index: 3;
}

.tile img,
.tile video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-2);
}

/* badge play sul video */
.tile.is-video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(20, 40, 18, .4));
  pointer-events: none;
}
.tile .play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 66px; height: 66px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .92);
  color: var(--green-d);
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  z-index: 2;
  transition: transform .25s ease;
}
.tile:hover .play { transform: scale(1.12); }
.tile .play svg { margin-left: 4px; }
.tile .vlabel {
  position: absolute;
  left: 12px; bottom: 12px;
  z-index: 2;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: #fff;
  background: var(--haze);
  padding: 4px 10px;
  border-radius: 999px;
}

/* --------------------------- FOOTER --------------------------- */
.footer {
  text-align: center;
  padding: 34px 20px 60px;
  color: var(--ink-2);
}
.footer p { margin: 0 0 14px; font-weight: 500; }
.footer strong { color: var(--green-d); }
.pud-emoji { display: inline-block; animation: jiggle 2.6s ease-in-out infinite; }
.to-top {
  font-family: var(--font);
  font-weight: 500;
  color: var(--green-d);
  background: transparent;
  border: 2px solid var(--green);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.to-top:hover { background: var(--green); color: #fff; transform: translateY(-2px); }

/* -------------------------- LIGHTBOX -------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(12, 26, 12, .93);
  backdrop-filter: blur(6px);
  padding: 4vh 3vw;
}
.lightbox.open { display: grid; animation: fade .25s ease both; }

.lb-stage {
  max-width: 92vw;
  max-height: 88vh;
  display: grid;
  place-items: center;
}
.lb-stage img,
.lb-stage video {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  animation: pop .35s cubic-bezier(.2,.9,.3,1.2) both;
}

.lb-close, .lb-nav {
  position: fixed;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s ease, transform .2s ease;
  z-index: 52;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .30); transform: scale(1.08); }
.lb-close {
  top: 18px; right: 20px;
  width: 46px; height: 46px;
  font-size: 1.2rem;
}
.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 54px; height: 54px;
  font-size: 2rem;
  line-height: 1;
  display: grid; place-items: center;
}
.lb-nav:hover { transform: translateY(-50%) scale(1.08); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-counter {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-weight: 500;
  letter-spacing: .05em;
  background: rgba(0, 0, 0, .35);
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 52;
}

@media (max-width: 680px) {
  .lb-nav { width: 44px; height: 44px; font-size: 1.6rem; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}

/* -------------------------- ANIMAZIONI ------------------------ */
@keyframes jiggle {
  0%, 100% { transform: translateY(0) rotate(0); }
  25%      { transform: translateY(-4px) rotate(-3deg); }
  50%      { transform: translateY(0) rotate(0); }
  75%      { transform: translateY(3px) rotate(2deg); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* easter egg: click sul titolo */
.title.wobble span { animation: jiggle .5s ease-in-out 2; }

/* Rispetta chi non vuole animazioni */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .tile { opacity: 1 !important; transform: none !important; }
  #confetti { display: none; }
}
