/* ==========================================================================
   Come Mamma Crea — «Il filo»
   Livello che si appoggia su style.css (stessi colori, font e componenti).
   ========================================================================== */

/* ---------- Ingresso: la busta (solo home, una volta per visita) ---------- */
html.lock { overflow: hidden; }
#intro {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #fff6f2, var(--blush) 70%);
  transition: opacity .8s, visibility .8s;
}
html.no-intro #intro, html:not(.js) #intro { display: none; }
#intro.out { opacity: 0; visibility: hidden; }
.intro-skip { position: absolute; top: max(18px, env(safe-area-inset-top)); right: 20px; border: 0; background: none; font: 600 13px var(--f-body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); cursor: pointer; padding: 12px; }
.intro-skip:hover { color: var(--rose-deep); }
.intro-stage { display: flex; flex-direction: column; align-items: center; gap: 34px; }
.env { position: relative; width: min(470px, 84vw); aspect-ratio: 1.55; perspective: 1400px; animation: env-bob 3.2s ease-in-out infinite; }
@keyframes env-bob { 50% { transform: translateY(-8px) rotate(-.6deg); } }
.started .env { animation: none; }
.env-back { position: absolute; inset: 0; border-radius: 12px; background: #e9a7aa; box-shadow: 0 40px 70px -30px rgba(140, 63, 73, .55); transition: transform .9s var(--ease), opacity .7s; }
.env-letter { position: absolute; left: 5%; right: 5%; top: 7%; height: 86%; z-index: 2; background: #fffdfb; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); transition: transform .9s var(--ease), opacity .7s; }
.env-letter img { width: 58px; height: 58px; }
.env-letter b { font: 400 clamp(26px, 5vw, 36px)/1 var(--f-script); color: var(--rose-deep); margin-top: 6px; }
.env-letter span { font: italic 500 clamp(13px, 2.4vw, 16px) var(--f-title); color: var(--muted); }
.env-pk { position: absolute; inset: 0; z-index: 3; border-radius: 12px; overflow: hidden; pointer-events: none; transition: transform .9s var(--ease), opacity .7s; }
.env-pk i { position: absolute; inset: 0; }
.env-pk .l { background: #f3b6b8; clip-path: polygon(0 0, 52% 56%, 0 100%); }
.env-pk .r { background: #efadb0; clip-path: polygon(100% 0, 48% 56%, 100% 100%); }
.env-pk .b { background: #f6c3c4; clip-path: polygon(0 100%, 50% 46%, 100% 100%); }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 60%; z-index: 4; transform-origin: top center; transition: transform .85s var(--ease), opacity .7s; transform-style: preserve-3d; }
.env-flap i { position: absolute; inset: 0; background: #eaa4a8; clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 12px 12px 0 0; }
.env-seal { position: absolute; left: 50%; top: 60%; z-index: 6; width: 104px; height: 104px; margin: -52px 0 0 -52px; border: 0; padding: 0; border-radius: 50%; cursor: pointer; background: radial-gradient(circle at 35% 30%, #c46572, #8c3f49); box-shadow: 0 8px 18px rgba(80, 20, 30, .45), inset 0 0 0 6px rgba(255, 255, 255, .12); display: grid; place-items: center; transition: transform .45s var(--ease), opacity .45s; }
.env-seal img { width: 78px; height: 78px; border-radius: 50%; background: #fdf3f1; padding: 3px; }
.env-seal:hover { transform: scale(1.06) rotate(-6deg); }
.intro-hint { font: 400 30px var(--f-script); color: var(--rose-deep); animation: hint-pulse 2s ease-in-out infinite; margin: 0; }
@keyframes hint-pulse { 50% { opacity: .45; } }
.s1 .env-seal { transform: scale(1.5) rotate(25deg); opacity: 0; pointer-events: none; }
.s1 .intro-hint { opacity: 0; animation: none; transition: opacity .3s; }
.s2 .env-flap { transform: rotateX(180deg); }
.s3 .env-flap { z-index: 1; }
.s3 .env-letter { transform: translateY(-62%); }
.s4 .env-letter { transform: translateY(-62%) scale(3.2); opacity: 0; }
.s4 .env-pk, .s4 .env-back, .s4 .env-flap { transform: translateY(70vh) rotate(6deg); opacity: 0; }
.petal { position: fixed; left: 50%; top: 50%; width: 14px; height: 14px; border-radius: 50% 0; background: var(--rose); pointer-events: none; z-index: 210; animation: petal-fly 1.6s var(--ease) forwards; }
.petal:nth-child(3n) { background: var(--coral); }
.petal:nth-child(4n) { background: #fff; }
@keyframes petal-fly { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

/* ---------- Apertura: foto fluttuanti e titolo che si svela ---------- */
.fhero { position: relative; min-height: min(calc(100vh - 84px), 900px); display: grid; place-items: center; overflow: hidden; padding: 70px 0 80px; }
.fblob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .75; z-index: 0; animation: fblob 18s ease-in-out infinite; }
.fb1 { width: 520px; height: 520px; background: var(--blush); left: -120px; top: -80px; }
.fb2 { width: 420px; height: 420px; background: #fde4da; right: -100px; bottom: -60px; animation-delay: -6s; }
.fb3 { width: 300px; height: 300px; background: #f9d0d6; left: 45%; top: 55%; animation-delay: -12s; }
@keyframes fblob { 50% { transform: translate(60px, -40px) scale(1.1); } }
.fhero-t { position: relative; z-index: 3; text-align: center; }
.fhero .kicker { opacity: 0; transform: translateY(10px); transition: 1s var(--ease) .1s; }
.fhero h1 { font-size: clamp(3.4rem, 9.4vw, 9.2rem); letter-spacing: -.02em; line-height: .92; margin: 10px 0 0; }
.ln { display: block; overflow: hidden; padding: 0 .06em .08em; }
.ln > span { display: inline-block; transform: translateY(110%); transition: transform 1.2s var(--ease); }
.ln.sc > span { font: 400 1.05em/1.1 var(--f-script); color: var(--rose-deep); }
.fhero .lead { margin: 26px auto 30px; opacity: 0; transform: translateY(10px); transition: 1s var(--ease) .9s; }
.fhero .hero-actions { justify-content: center; opacity: 0; transform: translateY(10px); transition: 1s var(--ease) 1.05s; }
body.go .fhero .kicker, body.go .fhero .lead, body.go .fhero .hero-actions { opacity: 1; transform: none; }
body.go .ln > span { transform: none; }
body.go .ln:nth-child(2) > span { transition-delay: .15s; }
body.go .ln:nth-child(3) > span { transition-delay: .3s; }
.fc { position: absolute; z-index: 2; opacity: 0; scale: .7; transition: opacity 1s, scale 1.2s var(--ease); }
body.go .fc { opacity: 1; scale: 1; }
.fc .in { background: #fff; padding: 8px; border-radius: 16px; box-shadow: 0 30px 50px -26px rgba(108, 46, 56, .5); }
.fc img { border-radius: 10px; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; animation: fc-float 7s ease-in-out infinite; }
@keyframes fc-float { 50% { transform: translateY(-10px); } }
.f1 { width: clamp(150px, 17vw, 250px); left: 4%; top: 14%; rotate: -7deg; transition-delay: .2s; }
.f2 { width: clamp(120px, 13vw, 190px); right: 6%; top: 11%; rotate: 6deg; transition-delay: .35s; }
.f3 { width: clamp(110px, 11vw, 170px); left: 12%; bottom: 7%; rotate: 5deg; transition-delay: .5s; }
.f4 { width: clamp(100px, 10vw, 150px); right: 16%; bottom: 9%; rotate: -5deg; transition-delay: .65s; }
.f5 { width: clamp(80px, 8vw, 120px); left: 21%; top: 6%; rotate: 4deg; transition-delay: .8s; }
.f6 { width: clamp(90px, 9vw, 140px); right: 4%; top: 56%; rotate: -3deg; transition-delay: .95s; }
.f3 img, .f5 img { animation-delay: -2s; }
.f2 img, .f6 img { animation-delay: -4s; }
.fbadge { position: absolute; left: 3%; top: 54%; z-index: 3; width: 130px; height: 130px; opacity: 0; transition: opacity 1s 1.2s; }
body.go .fbadge { opacity: 1; }
.fbadge svg { width: 100%; height: 100%; animation: spin 22s linear infinite; fill: var(--rose-deep); font: 700 10.5px var(--f-body); letter-spacing: 3px; }
.fbadge img { position: absolute; inset: 28%; width: 44%; height: 44%; }
@media (max-width: 960px) {
  .fbadge { display: none; }
  .f5, .f6 { display: none; }
}
@media (max-width: 600px) {
  .fhero { padding: 290px 0 56px; min-height: 0; place-items: start center; }
  .fc { top: auto !important; bottom: auto !important; left: auto !important; right: auto !important; }
  .f1 { width: 150px; top: 76px !important; left: 50% !important; translate: -50% 0; rotate: -3deg; z-index: 3; }
  .f2 { width: 112px; top: 106px !important; left: 5% !important; rotate: -11deg; }
  .f3 { width: 112px; top: 106px !important; right: 5% !important; rotate: 10deg; }
  .f4 { display: none; }
  .fhero .lead { font-size: 1rem; margin: 18px auto 24px; }
  .fhero .hero-actions { flex-direction: column; align-items: center; }
}

/* ---------- Il filo che cuce le pagine ---------- */
.flow { position: relative; }
.flow > section, .flow > div:not(.thread-wrap) { position: relative; z-index: 1; }
.thread-wrap { position: absolute; left: 0; top: 0; width: 100%; z-index: 0; pointer-events: none; }
.thread { position: absolute; left: 0; top: 0; width: 100%; overflow: visible; }
.thread .guide { fill: none; stroke: var(--rose); stroke-width: 1.5; stroke-dasharray: 5 11; opacity: .7; }
.thread .sew { fill: none; stroke: var(--rose-deep); stroke-width: 2.4; stroke-linecap: round; }
.needle { position: absolute; left: 0; top: 0; width: 46px; height: 12px; margin: -6px 0 0 -40px; transform-origin: 40px 6px; }
/* nelle pagine interne e su telefono il filo resta discreto per non disturbare la lettura */
body:not(.page-home) .thread .sew { opacity: .32; }
body:not(.page-home) .thread .guide { opacity: .35; }
body:not(.page-home) .needle { filter: opacity(.45); }
@media (max-width: 600px) {
  .thread .sew { stroke-width: 1.8; opacity: .55; }
  .thread .guide { opacity: .35; }
  body:not(.page-home) .thread .sew { opacity: .22; }
}

/* ---------- Occasioni a ventaglio ---------- */
.occ { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.words { list-style: none; margin: 0; padding: 0; }
.words button { all: unset; display: flex; align-items: baseline; gap: 18px; cursor: pointer; font: 500 clamp(46px, 6.4vw, 100px)/1.05 var(--f-title); color: transparent; -webkit-text-stroke: 1.2px var(--rose-deep); transition: color .4s, transform .4s var(--ease); padding: 2px 0; white-space: nowrap; }
.words small { font: 700 13px var(--f-body); letter-spacing: .14em; -webkit-text-stroke: 0; color: var(--muted); opacity: 0; transition: opacity .3s; }
.words button.on, .words button:focus-visible { color: var(--rose-deep); transform: translateX(18px); }
.words button.on small { opacity: 1; }
.fans { position: relative; height: 520px; }
.fan { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.fan.on { pointer-events: auto; }
.fan .fp { position: absolute; width: min(260px, 44vw); background: #fff; padding: 10px; border-radius: 18px; box-shadow: 0 30px 50px -28px rgba(108, 46, 56, .55); transition: transform .7s var(--ease), opacity .5s; opacity: 0; transform: translateY(40px) scale(.85); }
.fan .fp img { aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; width: 100%; }
.fan.on .fp { opacity: 1; }
.fan.on .fp:nth-child(1) { transform: translateX(-46%) rotate(-11deg); }
.fan.on .fp:nth-child(2) { transform: translateY(-14px); z-index: 2; }
.fan.on .fp:nth-child(3) { transform: translateX(46%) rotate(10deg); }
.fan .go-l { position: absolute; bottom: -6px; z-index: 3; font: 400 30px var(--f-script); color: var(--rose-deep); text-decoration: none; padding: 6px 10px; opacity: 0; transition: opacity .4s .3s; }
.fan.on .go-l { opacity: 1; }
@media (max-width: 960px) {
  .occ { grid-template-columns: 1fr; gap: 10px; }
  .words { display: flex; gap: 18px; overflow-x: auto; padding: 6px 4px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .words::-webkit-scrollbar { display: none; }
  .words button { font-size: 40px; white-space: nowrap; }
  .words button.on { transform: none; }
  .words small { display: none; }
  .fans { height: 400px; }
}

/* ---------- Il kit cerimonia: foto ferma che cambia scorrendo ---------- */
.kit { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; }
.kit-frame { position: sticky; top: 110px; height: min(72vh, 640px); border-radius: 999px 999px 28px 28px; overflow: hidden; box-shadow: 0 40px 70px -40px rgba(108, 46, 56, .6); background: var(--blush); }
.kit-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.08); transition: opacity .8s, transform 1.4s var(--ease); }
.kit-frame img.on { opacity: 1; transform: none; }
.kit-steps { padding: 14vh 0; }
.ks { min-height: 52vh; display: flex; flex-direction: column; justify-content: center; opacity: .25; transition: opacity .5s; }
.ks.on { opacity: 1; }
.ks .script { font-size: 30px; }
.ks h3 { font-size: clamp(2.4rem, 4vw, 3.6rem); margin: 6px 0 12px; }
.ks p { color: var(--muted); max-width: 38ch; margin: 0; }
@media (max-width: 960px) {
  .kit { grid-template-columns: 1fr; gap: 0; }
  .kit-frame { top: 80px; height: 46vh; z-index: 2; }
  .kit-steps { padding: 4vh 0; }
  .ks { min-height: 42vh; }
}

/* ---------- Come lavoriamo: cartellini ---------- */
.tags { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; list-style: none; margin: 0; padding: 0; }
.tag { position: relative; background: #fff; padding: 56px 26px 30px; clip-path: polygon(18% 0, 82% 0, 100% 12%, 100% 100%, 0 100%, 0 12%); box-shadow: 0 20px 40px -26px rgba(108, 46, 56, .5); text-align: center; transform-origin: 50% -40px; transition: transform .6s var(--ease); border-radius: 0 0 14px 14px; }
.tag::before { content: ''; position: absolute; top: 18px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .15); }
.tag:hover { transform: rotate(-4deg); }
.tag b { display: block; font: 400 54px/1 var(--f-script); color: var(--rose-deep); }
.tag h3 { font-size: 1.75rem; margin: 8px 0; }
.tag p { color: var(--muted); margin: 0; font-size: .95rem; }
.tags-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 2.8rem; }
@media (max-width: 960px) { .tags { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .tags { grid-template-columns: 1fr; } }

/* ---------- Le creazioni come bottoni da cucito ---------- */
.btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 40px 34px; }
.bt { width: 150px; text-align: center; text-decoration: none; color: var(--ink); }
.bt .c { position: relative; display: block; width: 150px; height: 150px; border-radius: 50%; padding: 10px; background: #fff; box-shadow: 0 20px 34px -20px rgba(108, 46, 56, .6); }
.bt .c img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; transition: transform .8s var(--ease); }
.bt .c::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 2px dashed var(--rose); transition: border-color .3s; }
.bt:hover .c::after { border-color: var(--rose-deep); animation: spin 6s linear infinite; }
.bt:hover img { transform: scale(1.1); }
.bt b { display: block; font: 500 1.55rem var(--f-title); margin-top: 14px; }
.bt small { color: var(--muted); font-size: .82rem; }
@media (max-width: 560px) { .btns { gap: 26px 18px; } .bt { width: 132px; } .bt .c { width: 132px; height: 132px; } .bt b { font-size: 1.3rem; } }

/* ---------- Ultime creazioni: anello 3D ---------- */
.ring-sec { overflow: hidden; }
.ring-wrap { height: 470px; perspective: 1500px; display: grid; place-items: center; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.ring-wrap.grabbing { cursor: grabbing; }
.ring { position: relative; width: 225px; height: 295px; transform-style: preserve-3d; }
.ring a { position: absolute; inset: 0; background: #fff; padding: 8px; border-radius: 18px; box-shadow: 0 24px 34px -22px rgba(108, 46, 56, .55); -webkit-user-drag: none; }
.ring img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; pointer-events: none; }
.ring-hint { text-align: center; font: 400 26px var(--f-script); color: var(--muted); margin: 0; }
@media (max-width: 600px) { .ring-wrap { height: 390px; } .ring { width: 170px; height: 225px; } .ring-hint { font-size: 22px; padding: 0 16px; } }

/* ---------- Frase che si colora leggendo + firma ---------- */
.fill span { color: #e7d3d0; transition: color .3s; }
.fill span.on { color: var(--ink); }
.sig { clip-path: inset(0 100% 0 0); transition: clip-path 2s var(--ease); }
.sig.on { clip-path: inset(0 0 0 0); }
.me-filo { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.me-filo .arch { aspect-ratio: 4 / 5; }
.me-filo .fill { font: 500 clamp(1.7rem, 3vw, 2.75rem)/1.3 var(--f-title); margin: 14px 0 26px; }
.me-filo .sig { font: 400 4rem/1 var(--f-script); color: var(--rose-deep); }
@media (max-width: 900px) { .me-filo { grid-template-columns: 1fr; } .me-filo .arch { max-width: 420px; margin: 0 auto; } }

/* ---------- Invito finale: «Ti aspetto» ---------- */
.end-filo { text-align: center; padding: clamp(4rem, 9vw, 8rem) 0 clamp(5rem, 10vw, 9rem); }
.end-filo .big { display: block; font: 400 clamp(5rem, 13vw, 12rem)/.9 var(--f-script); color: var(--rose-deep); }
.end-filo h2 { margin: 10px 0 18px; }
.end-filo p { color: var(--muted); max-width: 48ch; margin: 0 auto 32px; }

/* ---------- Cursore (solo con il mouse) ---------- */
.cur { position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--rose-deep); transition: width .3s, height .3s, margin .3s, background .3s, opacity .3s; }
.cur span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: #fff; opacity: 0; transition: opacity .2s; }
.cur.big { width: 78px; height: 78px; margin: -39px 0 0 -39px; background: rgba(169, 80, 91, .88); }
.cur.big span { opacity: 1; }
.cur.hide { opacity: 0; }
@media (hover: none) { .cur { display: none; } }

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ln > span, .fhero .kicker, .fhero .lead, .fhero .hero-actions, .fc, .fbadge { transform: none !important; opacity: 1 !important; scale: 1 !important; }
  .sig { clip-path: none; }
}

/* ---------- Menu su telefono ----------
   L'effetto vetro (backdrop-filter) della barra in alto "imprigiona" il menu
   a tendina dentro la barra: quando il menu è aperto lo togliamo. */
@media (max-width: 900px) {
  .nav-open .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  .site-nav { height: calc(100dvh - 72px); padding-bottom: max(3rem, env(safe-area-inset-bottom)); }
}
