:root{
  --bg:#f7f2e7;
  --paper:#fffdf7;
  --ink:#24301f;
  --muted:#5f6b57;
  --green:#3d5a2f;
  --green-2:#56794a;
  --potato:#e8c26b;
  --bd:rgba(36,48,31,.14);
  --shadow:0 10px 28px rgba(36,48,31,.10);
  --radius:18px;
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size:18px;
  line-height:1.55;
}
a{ color:var(--green); }
.wrap{ max-width:1040px; margin:0 auto; padding:0 16px; }

/* Header */
.top{ background:var(--paper); border-bottom:1px solid var(--bd); position:sticky; top:0; z-index:5; }
.top-in{ display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:64px; flex-wrap:wrap; }
.logo{ font-weight:700; font-size:20px; text-decoration:none; color:var(--green); white-space:nowrap; }
.logo em{ font-weight:400; color:var(--muted); }
nav{ display:flex; gap:16px; align-items:center; font-family:system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size:15px; }
nav a{ text-decoration:none; color:var(--ink); }
.cart-link{ font-weight:600; }
.pill{ display:inline-block; min-width:22px; padding:0 7px; border-radius:999px; background:var(--green); color:#fff; font-size:13px; text-align:center; }

/* Hero */
.hero{ padding:56px 0 36px; display:grid; gap:28px; align-items:center; }
@media (min-width:820px){ .hero{ grid-template-columns:1.2fr .8fr; padding:72px 0 48px; } }
.hero h1{ font-size:clamp(34px,5vw,56px); line-height:1.08; margin:0 0 14px; color:var(--green); }
.hero p{ font-size:20px; color:var(--muted); margin:0 0 22px; max-width:34em; }
.kicker{ font-family:system-ui, sans-serif; font-size:13px; letter-spacing:.12em; text-transform:uppercase; color:var(--green-2); margin-bottom:10px; }

/* Hero animata */
.hero{ position:relative; }
.hero-text{ position:relative; z-index:1; }
.hero-text .btn{ margin:0 8px 8px 0; }
.hl{ background:linear-gradient(transparent 62%, rgba(232,194,107,.65) 62%); padding:0 .08em; }
.needles{ position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:0; }
/* Sacchetto 3D a 360° */
.bag-scene{
  --w:200px; --h:360px; --d:120px;
  /* il sacchetto è chiuso in alto: davanti e dietro si inclinano fino a toccarsi, i fianchi sono triangoli */
  --tilt:atan2(calc(var(--d) / 2), var(--h));
  --slant:hypot(var(--h), calc(var(--d) / 2));
  position:relative; z-index:1; justify-self:center; width:min(400px, 92vw); height:500px;
  display:grid; place-items:center; cursor:grab; touch-action:pan-y; user-select:none; -webkit-user-select:none;
}
.bag-scene.dragging{ cursor:grabbing; }
@media (max-width:560px){ .bag-scene{ --w:172px; --h:310px; --d:104px; height:430px; } }
.bag-stage{ position:relative; width:var(--w); height:var(--h); perspective:1100px; animation:float 6s ease-in-out infinite; }
@keyframes float{ 0%,100%{ translate:0 0; } 50%{ translate:0 -12px; } }
.bag3d{ position:absolute; inset:0; transform-style:preserve-3d; transform:rotateX(-8deg) rotateY(-25deg); }
.face{
  position:absolute; left:0; top:0; width:var(--w); height:var(--h); overflow:hidden;
  backface-visibility:hidden; -webkit-backface-visibility:hidden;
  background:
    linear-gradient(97deg, rgba(0,0,0,.035) 0 1px, transparent 1px 30%, rgba(0,0,0,.03) 31%, transparent 33% 70%, rgba(0,0,0,.035) 71%, transparent 72%),
    linear-gradient(180deg, #fbfaf6 0%, #f3f1eb 100%);
}
.face::after{ content:""; position:absolute; inset:0; background:#2a2418; opacity:var(--shade,0); pointer-events:none; }
.f-front, .f-back{ height:var(--slant); top:calc(var(--h) - var(--slant)); transform-origin:50% 100%; }
.f-front{ transform:translateZ(calc(var(--d) / 2)) rotateX(var(--tilt)); }
.f-back{ transform:rotateY(180deg) translateZ(calc(var(--d) / 2)) rotateX(var(--tilt)); }
.f-left, .f-right{
  width:var(--d); left:calc((var(--w) - var(--d)) / 2);
  clip-path:polygon(50% 0, 100% 100%, 0 100%);
  background:linear-gradient(90deg, #e6e2da 0%, #faf9f5 35%, #d6d1c6 50%, #faf9f5 65%, #e6e2da 100%);
}
.f-left{ transform:rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.f-right{ transform:rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.f-top{ display:none; }
.f-bottom{ height:var(--d); top:calc((var(--h) - var(--d)) / 2); background:#efece5; transform:rotateX(-90deg) translateZ(calc(var(--h) / 2)); }
/* risvolto in alto, come il sacchetto vero */
.f-front::before, .f-back::before{
  content:""; position:absolute; left:0; right:0; top:0; height:9%; z-index:1;
  background:linear-gradient(180deg, #fdfcf9, #eeebe4); box-shadow:0 3px 4px rgba(0,0,0,.10);
  clip-path:polygon(0 0,100% 0,100% 88%,92% 100%,80% 90%,66% 100%,52% 91%,38% 100%,24% 90%,10% 100%,0 92%);
}
.face img{
  position:absolute; left:50%; top:12%; width:45%; height:auto; transform:translateX(-50%);
  border-radius:3px; box-shadow:0 1px 3px rgba(0,0,0,.25); pointer-events:none;
}
.bow{ position:absolute; left:50%; top:-50px; width:140px; margin-left:-70px; filter:drop-shadow(0 3px 3px rgba(0,0,0,.25)); }
.bag-scene:focus-visible{ outline:3px solid var(--potato); outline-offset:4px; border-radius:24px; }
.bag-ground{
  position:absolute; left:50%; bottom:-38px; width:calc(var(--w) * 1.3); height:44px; margin-left:calc(var(--w) * -.65);
  background:radial-gradient(closest-side, rgba(36,48,31,.32), rgba(36,48,31,0)); animation:groundPulse 6s ease-in-out infinite;
}
@keyframes groundPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.7; } }
.bag-hint{ position:absolute; bottom:6px; left:0; right:0; text-align:center; font:600 14px system-ui, sans-serif; color:var(--green-2); transition:opacity .4s ease; }
.bag-scene.touched .bag-hint{ opacity:0; }
.badge-round{
  position:absolute; top:16px; left:16px; width:78px; height:78px; border-radius:50%;
  display:grid; place-items:center; text-align:center;
  background:#c8261e; color:#fff; font:800 13px/1.15 system-ui, sans-serif;
  box-shadow:0 6px 16px rgba(0,0,0,.25); animation:sway 7s ease-in-out infinite;
}
@keyframes sway{ 0%,100%{ rotate:-12deg; } 50%{ rotate:12deg; } }

/* Striscia foto */
.marquee{ overflow:hidden; margin:8px -16px 0; padding:18px 0; -webkit-mask-image:linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image:linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track{ display:flex; gap:18px; width:max-content; padding:0 9px; animation:marquee 40s linear infinite; }
.marquee:hover .marquee-track{ animation-play-state:paused; }
.marquee img{ width:190px; height:auto; border-radius:18px; box-shadow:var(--shadow); transition:transform .3s ease; }
.marquee img:nth-child(odd){ rotate:-2deg; }
.marquee img:nth-child(even){ rotate:2deg; }
.marquee img:hover{ transform:scale(1.06); }
@keyframes marquee{ to{ transform:translateX(-50%); } }

/* Ricetta con l'etichetta del retro */
.flip-wrap{ display:grid; gap:28px; align-items:center; }
@media (min-width:760px){ .flip-wrap{ grid-template-columns:200px 1fr; } }
.back-label{ justify-self:center; width:min(200px, 52vw); height:auto; border-radius:8px; box-shadow:0 18px 40px rgba(0,0,0,.35); rotate:-3deg; transition:rotate .4s ease, transform .4s ease; }
.back-label:hover{ rotate:0deg; transform:scale(1.04); }
.steps{ counter-reset:s; list-style:none; padding:0; margin:0 0 16px; }
.steps li{ counter-increment:s; position:relative; padding:6px 0 6px 46px; }
.steps li::before{
  content:counter(s); position:absolute; left:0; top:4px; width:32px; height:32px; border-radius:50%;
  display:grid; place-items:center; background:var(--potato); color:var(--green); font:800 15px system-ui, sans-serif;
}
.origin{ font:15px/1.5 system-ui, sans-serif; opacity:.9; margin:0; }
.recipe a{ color:var(--potato); }

/* Comparsa allo scroll (solo se il JS è attivo) */
.js-reveal .reveal{ opacity:0; transform:translateY(28px); transition:opacity .8s ease, transform .8s ease; }
.js-reveal .reveal.in{ opacity:1; transform:none; }
.js-reveal .reveal .steps li{ opacity:0; transform:translateX(-14px); transition:opacity .5s ease, transform .5s ease; }
.js-reveal .reveal.in .steps li{ opacity:1; transform:none; }
.js-reveal .reveal.in .steps li:nth-child(2){ transition-delay:.12s; }
.js-reveal .reveal.in .steps li:nth-child(3){ transition-delay:.24s; }
.js-reveal .reveal.in .steps li:nth-child(4){ transition-delay:.36s; }
.js-reveal .reveal.in .steps li:nth-child(5){ transition-delay:.48s; }

@media (prefers-reduced-motion: reduce){
  .bag-stage, .bag-ground, .badge-round, .marquee-track{ animation:none; }
  .marquee{ overflow-x:auto; }
}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:48px; padding:0 22px; border-radius:999px; border:0;
  background:var(--green); color:#fff; font:600 16px system-ui, sans-serif;
  text-decoration:none; cursor:pointer; transition:background .15s ease, transform .1s ease;
}
.btn:hover{ background:var(--green-2); }
.btn:active{ transform:translateY(1px); }
.btn.ghost{ background:transparent; color:var(--green); border:1px solid var(--green); }
.btn.block{ width:100%; }
.btn.small{ min-height:38px; padding:0 14px; font-size:14px; }

/* Sections */
section{ padding:28px 0; }
h2{ font-size:clamp(26px,3.4vw,36px); color:var(--green); margin:0 0 18px; }

.grid{ display:grid; gap:18px; }
@media (min-width:640px){ .grid{ grid-template-columns:repeat(2,1fr); } }
@media (min-width:960px){ .grid{ grid-template-columns:repeat(4,1fr); } }

.card{ background:var(--paper); border:1px solid var(--bd); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.product{ display:flex; flex-direction:column; gap:10px; }
.art-photo{ width:100%; height:auto; aspect-ratio:3 / 4; object-fit:cover; border-radius:14px; }
.grid.single{ grid-template-columns:1fr; max-width:820px; }
@media (min-width:640px){
  .grid.single .product{ display:grid; grid-template-columns:280px 1fr; column-gap:24px; align-content:center; }
  .grid.single .art-photo{ grid-row:1 / span 5; }
}
.product .art{ font-size:56px; text-align:center; background:var(--bg); border-radius:14px; padding:18px 0; }
.product h3{ font-size:19px; margin:0; }
.product p{ margin:0; color:var(--muted); font-size:16px; flex:1; }
.price{ font:700 20px system-ui, sans-serif; color:var(--ink); }
.product form{ display:flex; gap:8px; align-items:center; }

.facts{ display:grid; gap:14px; }
@media (min-width:720px){ .facts{ grid-template-columns:repeat(3,1fr); } }
.facts .card h3{ margin:0 0 6px; font-size:18px; color:var(--green); }
.facts .card p{ margin:0; color:var(--muted); font-size:16px; }

.recipe{ background:var(--green); color:#f7f2e7; border-radius:24px; padding:28px; }
.recipe h2{ color:var(--potato); }
.recipe ol{ margin:0; padding-left:22px; }

/* Forms / tables */
.qty{ width:64px; min-height:38px; border:1px solid var(--bd); border-radius:10px; padding:0 8px; font:16px system-ui, sans-serif; background:#fff; }
table.cart{ width:100%; border-collapse:collapse; font-family:system-ui, sans-serif; font-size:16px; }
table.cart td, table.cart th{ padding:12px 6px; border-bottom:1px solid var(--bd); text-align:left; vertical-align:middle; }
table.cart th{ font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
table.cart .num{ text-align:right; white-space:nowrap; }
.totals{ font-family:system-ui, sans-serif; margin-top:14px; display:grid; gap:6px; justify-content:end; text-align:right; }
.totals .tot{ font-size:22px; font-weight:700; }
.note{ font-family:system-ui, sans-serif; font-size:14px; color:var(--muted); }
.check{ display:flex; gap:10px; align-items:flex-start; font-family:system-ui, sans-serif; font-size:15px; margin:16px 0; }
.check input{ margin-top:4px; width:18px; height:18px; }
.msg{ padding:12px 14px; border-radius:12px; font-family:system-ui, sans-serif; font-size:15px; margin:0 0 16px; }
.msg.ok{ background:#e6f1df; border:1px solid #b9d3a9; }
.msg.err{ background:#f8e3df; border:1px solid #e3b4aa; }
#checkout{ min-height:560px; margin-top:12px; }

@media (max-width:560px){
  table.cart thead{ display:none; }
  table.cart tr{ display:grid; grid-template-columns:1fr auto; gap:4px 10px; padding:10px 0; border-bottom:1px solid var(--bd); }
  table.cart td{ border:0; padding:2px 0; }
  table.cart td.name{ grid-column:1 / -1; }
}

/* Footer */
.foot{ margin-top:56px; padding:28px 0 40px; background:var(--paper); border-top:1px solid var(--bd); font-family:system-ui, sans-serif; font-size:14px; color:var(--muted); }
.foot-in{ display:flex; justify-content:space-between; gap:20px; flex-wrap:wrap; }

.prose{ max-width:760px; }
.prose h1{ color:var(--green); font-size:clamp(30px,4vw,42px); margin:36px 0 12px; }
.prose h2{ font-size:22px; margin:26px 0 8px; }

/* Domande frequenti */
.faq{ display:grid; gap:12px; }
.faq details{ padding:14px 18px; }
.faq summary{ cursor:pointer; font-weight:700; list-style:none; position:relative; padding-right:28px; }
.faq summary::-webkit-details-marker{ display:none; }
.faq summary::after{ content:"+"; position:absolute; right:0; top:-2px; font:700 22px system-ui, sans-serif; color:var(--green); transition:rotate .2s ease; }
.faq details[open] summary::after{ rotate:45deg; }
.faq details p{ margin:10px 0 0; color:var(--muted); font-size:17px; }

/* Pagina ricetta */
.recipe-page .recipe-label{ float:right; width:min(180px, 38vw); height:auto; margin:6px 0 16px 20px; border-radius:8px; box-shadow:var(--shadow); rotate:2deg; }
.recipe-page ul{ padding-left:22px; }
.steps-light li::before{ background:var(--green); color:#fff; }
.recipe-cta{ clear:both; display:flex; gap:16px; align-items:center; justify-content:space-between; flex-wrap:wrap; margin-top:28px; font-family:system-ui, sans-serif; }

/* Contatore visite */
.counter{ align-self:center; background:var(--bg); border:1px solid var(--bd); border-radius:999px; padding:8px 16px; }
.counter strong{ color:var(--green); font-size:16px; }
.stats{ display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:12px; margin-bottom:16px; }
.stat{ text-align:center; }
.stat .n{ font:700 30px system-ui, sans-serif; color:var(--green); }
.stat .l{ font:13px system-ui, sans-serif; color:var(--muted); }
.bars{ display:flex; align-items:flex-end; gap:3px; height:120px; padding-top:8px; }
.bars span{ flex:1; background:var(--green-2); border-radius:3px 3px 0 0; min-height:2px; }

/* Pulsante musica */
.music-btn{
  position:fixed; right:16px; bottom:16px; z-index:20;
  display:inline-flex; align-items:center; gap:8px; min-height:44px; padding:0 16px;
  border:0; border-radius:999px; cursor:pointer;
  background:var(--green); color:#fff; font:600 15px system-ui, sans-serif;
  box-shadow:0 8px 22px rgba(36,48,31,.3); transition:transform .15s ease, background .15s ease;
}
.music-btn:hover{ background:var(--green-2); transform:translateY(-1px); }
.music-btn[aria-pressed="false"]{ background:var(--paper); color:var(--green); border:1px solid var(--bd); }
.music-btn.waiting::after{ content:"tocca per riprendere"; font-weight:400; font-size:12px; opacity:.75; }
.music-btn .eq{ display:inline-flex; align-items:flex-end; gap:2px; height:14px; }
.music-btn .eq i{ width:3px; background:currentColor; border-radius:1px; animation:eq .9s ease-in-out infinite; }
.music-btn .eq i:nth-child(2){ animation-delay:.2s; }
.music-btn .eq i:nth-child(3){ animation-delay:.4s; }
@keyframes eq{ 0%,100%{ height:4px; } 50%{ height:14px; } }
@media (prefers-reduced-motion: reduce){ .music-btn .eq i{ animation:none; height:10px; } }

/* Acquisto in un clic */
.buy-form{ display:inline-flex; gap:8px; align-items:center; margin:0; }
.hero-buy{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.hero-buy .btn{ margin:0; }
.hero-buy .buy-form .btn{ font-size:17px; min-height:54px; padding:0 26px; box-shadow:0 8px 20px rgba(61,90,47,.3); }
.hero-note{ margin-top:10px; }
.product .buy-form{ flex-wrap:wrap; }
.product .buy-form .btn{ min-height:46px; }
.add-form{ margin:0; }
.linklike{ all:unset; cursor:pointer; color:var(--green); text-decoration:underline; font:14px system-ui, sans-serif; }
.linklike:focus-visible{ outline:2px solid var(--green); outline-offset:2px; }
.price .note{ font-weight:400; }
.pay-summary{ display:grid; gap:4px; font-family:system-ui, sans-serif; margin-bottom:8px; }
.pay-summary .tot{ font-size:20px; font-weight:700; }
.legal{ margin:12px 0 0; }

/* Barra "Compra ora" fissa sul telefono */
.buy-bar{ display:none; }
@media (max-width:760px){
  .buy-bar{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    position:fixed; left:0; right:0; bottom:0; z-index:19; padding:10px 16px calc(10px + env(safe-area-inset-bottom));
    background:var(--paper); border-top:1px solid var(--bd); box-shadow:0 -6px 20px rgba(36,48,31,.12);
    font:13px/1.3 system-ui, sans-serif;
  }
  .buy-bar strong{ font-size:14px; }
  .buy-bar span{ color:var(--muted); }
  body:has(.buy-bar){ padding-bottom:76px; }
  body:has(.buy-bar) .music-btn{ bottom:86px; }
}
.hero p.hero-note{ font-size:14px; margin:12px 0 0; }
