/* ---------- hero: la tela di Figma ---------- */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 640px; overflow: hidden; }
/* la griglia di puntini della tela: in fondo sfuma, così la hero scivola nei lavori senza un taglio netto */
.hero::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, #cbcac2 1px, transparent 1.3px); background-size: 22px 22px; background-position: center;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 240px), transparent); mask-image: linear-gradient(#000 calc(100% - 240px), transparent); }
@media (pointer: fine) { .hero, .hero * { cursor: none !important; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hero-nav { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: center; align-items: center; padding: 22px 32px; font-size: 14px; font-weight: 500; }

#toolbar { display: flex; gap: 4px; background: var(--ink); padding: 4px; border-radius: 10px; box-shadow: 0 8px 20px -10px rgba(0,0,0,.5); }
#toolbar button { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; color: #b9b5ab; transition: background .15s, color .15s; }
#toolbar button:hover { color: #fff; }
#toolbar button.on { background: var(--acc); color: #fff; }
#toolbar button[hidden] { display: none; }
#toolbar svg { width: 16px; height: 16px; }

.hero-center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); text-align: center; width: min(1100px, 92vw); z-index: 4; pointer-events: none; }
.hero-center .hi { font: 600 30px var(--f-hand); display: inline-block; transform: rotate(-2deg); margin-bottom: 30px; }

/* il nome dentro la selezione */
#frame { position: relative; display: inline-block; padding: 10px 34px 4px; pointer-events: auto; transform-origin: 50% 50%; }
#frame .lbl { position: absolute; left: 0; top: -22px; font-size: 11.5px; font-weight: 500; color: var(--acc-text); white-space: nowrap; }
#frame .box { position: absolute; inset: 0; border: 1.5px solid var(--acc); pointer-events: none; }
#frame .h { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--acc); }
#frame .h { touch-action: none; z-index: 2; }
#frame .h::before { content: ''; position: absolute; inset: -10px; }
#frame.back { transition: transform .9s var(--ease); }
/* appena fuori dagli angoli si ruota, come in Figma (solo col mouse) */
#frame .rot { position: absolute; width: 24px; height: 24px; display: none; touch-action: none; z-index: 1; }
#frame .rot.tl { left: -34px; top: -34px; } #frame .rot.tr { right: -34px; top: -34px; }
#frame .rot.bl { left: -34px; bottom: -34px; } #frame .rot.br { right: -34px; bottom: -34px; }
@media (pointer: fine) { #frame .rot { display: block; } }
#frame .lbl { transform-origin: 0 100%; }
#dim { transform-origin: 50% 0; }
#dim:empty { display: none; }
#frame .h.tl { left: -5px; top: -5px; } #frame .h.tr { right: -5px; top: -5px; }
#frame .h.bl { left: -5px; bottom: -5px; } #frame .h.br { right: -5px; bottom: -5px; }
#dim { position: absolute; left: 50%; bottom: -30px; transform: translateX(-50%); background: var(--acc); color: #fff; font-size: 11.5px; font-weight: 500; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
#name { display: block; font: 800 clamp(76px, 15vw, 230px)/.9 var(--f-title); letter-spacing: -.055em; font-variation-settings: 'wdth' 100; transition: transform .15s; }

.claim { margin-top: 70px; font: 500 clamp(28px, 4.2vw, 62px)/1.04 var(--f-title); letter-spacing: -.035em; }
.claim em { font-family: var(--f-serif); font-weight: 400; color: var(--acc); letter-spacing: -.01em; }
.claim-in { display: inline-block; transform-origin: 50% 50%; will-change: transform; pointer-events: auto; cursor: pointer; }
.hero.pen .claim-in { pointer-events: none; }

/* ---------- senso di ragno e ragnatele (solo sulla frase) ---------- */
.web-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.sense { opacity: 0; transition: opacity .25s; }
.sense path { fill: none; stroke: var(--acc); stroke-width: 2.4; stroke-linecap: round; --tx: 1.6px; --ty: -1.4px; }
.sense.on path { animation: tingle .14s steps(2) infinite alternate; }
.sense g:nth-child(2n) path { animation-delay: -.07s; --tx: -1.4px; --ty: 1.6px; }
@keyframes tingle { to { transform: translate(var(--tx, 0), var(--ty, 0)); } }
.web-line { fill: none; stroke: #8f9693; stroke-width: 1.6; stroke-linecap: round; }
.web-shine { fill: none; stroke: #fff; stroke-width: .7; stroke-linecap: round; opacity: .9; transform: translate(.6px, -.6px); }

/* ---------- angoli: stato e coordinate (sinistra), giradischi (destra) ---------- */
.hero-status { position: absolute; left: 32px; bottom: 28px; z-index: 4; display: flex; flex-direction: column; gap: 5px; }
.st-line { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.st-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acc); animation: pulse 2s infinite; }
.st-text { font: 500 17px/1.2 var(--f-body); color: var(--ink); }
.st-coord { margin-top: 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }

/* il giradischi: sempre aperto. La copertina è la busta, il vinile ne spunta e gira solo mentre suona */
.deck { position: absolute; right: 32px; bottom: 28px; z-index: 6; width: 360px; display: flex; align-items: center; gap: 16px; padding: 14px;
  background: #fff; border-radius: 16px; box-shadow: 0 14px 30px -18px rgba(16, 20, 18, .5); text-align: left; } /* ombra corta: il bordo della hero non la taglia */
.deck-art { position: relative; flex: none; width: 116px; height: 116px; }
.deck-sleeve-wrap { position: absolute; inset: 0; z-index: 2; border-radius: 4px; overflow: hidden; box-shadow: 4px 0 14px -4px rgba(0, 0, 0, .45);
  background: linear-gradient(150deg, var(--acc), #0d5a37); }
.deck-sleeve { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s; }
.deck-disc { position: absolute; left: 4px; top: 4px; width: 108px; height: 108px; z-index: 1; --out: 46px; transform: translateX(var(--out)); transition: transform .55s var(--ease); }
.deck.swap .deck-disc { transform: none; transition: transform .4s cubic-bezier(.6, 0, .8, .3); } /* rientra nella busta */
.deck-vin { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .6);
  background: repeating-radial-gradient(circle, #1b1e1c 0 1.6px, #0b0d0c 1.6px 3px); animation: spin 2.4s linear infinite paused; }
.deck-vin::before { content: ''; position: absolute; width: 40px; height: 40px; border-radius: 50%; background: var(--acc); }
.deck-lbl { position: relative; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.deck.playing .deck-vin { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.deck-info { flex: 1; min-width: 0; padding-left: 34px; display: flex; flex-direction: column; }
.deck-caps { display: flex; justify-content: space-between; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.deck-n { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.deck-title { margin-top: 4px; font: 600 15.5px/1.2 var(--f-body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .25s; }
.deck-artist { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .25s; }
.deck.swap .deck-title, .deck.swap .deck-artist { opacity: 0; }
.deck-bar { height: 3px; margin: 10px 0 4px; border-radius: 3px; background: #e7e3da; overflow: hidden; }
.deck-bar i { display: block; height: 100%; width: 0; background: var(--acc); }
.deck-time { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck.stuck .deck-cur { color: var(--acc-text); }
.deck.stuck .deck-len { display: none; }
.deck-ctr { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.deck-ctr button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #e7e3da; color: var(--ink); transition: background .2s, border-color .2s; }
.deck-ctr button:hover { border-color: var(--ink); }
.deck-ctr svg { width: 12px; height: 12px; fill: currentColor; }
.deck-ctr .deck-prev path:first-child, .deck-ctr .deck-next path:first-child { stroke: currentColor; stroke-width: 1.8; }
.deck-ctr .deck-play { width: 36px; height: 36px; border: 0; background: var(--ink); color: #fff; }
.deck-ctr .deck-play:hover { background: var(--acc); }
.deck-play .i-pause, .deck.playing .deck-play .i-play { display: none; }
.deck.playing .deck-play .i-pause { display: inline; }
.deck-ctr .deck-ls { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; width: auto; height: 30px; padding: 0 11px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.deck-ls[aria-expanded="true"] span { display: inline-block; transform: rotate(180deg); }
/* la lista dei brani: si apre sopra la scheda */
.deck:has(.deck-list:not([hidden])) { z-index: 35; } /* aperta, sta sopra anche al cursore di Enrico */
.deck-list { position: absolute; right: 0; bottom: calc(100% + 10px); width: 100%; max-height: min(420px, 60vh); overflow-y: auto; list-style: none; padding: 8px;
  background: #fff; border-radius: 14px; box-shadow: 0 24px 50px -24px rgba(16, 20, 18, .55); animation: list-in .3s var(--ease); }
.deck-list[hidden] { display: none; }
@keyframes list-in { from { opacity: 0; transform: translateY(8px); } }
.deck-list li { display: flex; align-items: center; gap: 6px; border-radius: 8px; }
.deck-list li:hover { background: var(--bg); }
.deck-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; text-align: left; }
.deck-row img { flex: none; width: 36px; height: 36px; border-radius: 4px; object-fit: cover; background: var(--line); }
.deck-row span { min-width: 0; display: flex; flex-direction: column; }
.deck-row b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-row small { font-size: 11.5px; color: var(--muted); }
.deck-row[aria-current="true"] b { color: var(--acc-text); }
.deck-full { flex: none; padding: 6px 8px; font-size: 11px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.deck-full:hover { color: var(--acc-text); }
.deck-mini, .deck-close { display: none; }
@keyframes deck-pop { from { opacity: 0; transform: scale(.4); } }
@media (prefers-reduced-motion: reduce) {
  .deck-disc, .deck.swap .deck-disc { transform: translateX(var(--out)); transition: opacity .2s; }
  .deck.swap .deck-disc { opacity: 0; }
}
@media (max-width: 1000px) { .scroll-hint { display: none; } }
.now { margin-top: 26px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 10px; }
.now i { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(19,131,79,.5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(19,131,79,0); } }

/* adesivi */

/* cursori */
.cur { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; will-change: transform; }
.cur svg { display: block; filter: drop-shadow(0 2px 3px rgba(16, 20, 18, .28)); }
/* l'etichetta del cursore: una pillola. Quando Enrico parla, la pillola si allunga e il testo compare sotto il nome */
.cur .tag { position: absolute; left: 16px; top: 19px; white-space: nowrap; }
.cur .who { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 5px; border-radius: 5px 999px 999px 999px; font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 22px -10px rgba(16, 20, 18, .55); }
#me .who { padding-left: 11px; color: var(--ink); background: linear-gradient(135deg, #ffe58f, #f5c84a); }
#me .who small { font-weight: 500; opacity: .6; }
/* come la chat dei cursori di Figma: una forma sola, bordo più scuro, un alone; il nome sta sopra, piccolo */
#enr .tag { left: 18px; top: 21px; display: grid; grid-template-rows: auto 0fr; padding: 7px 16px 8px 15px; border-radius: 6px 26px 26px 26px; color: #fff;
  background: #1c9a5d; border: 2px solid #11744a; box-shadow: 0 0 0 4px rgba(28, 154, 93, .2), 0 14px 30px -14px rgba(15, 111, 66, .8);
  transition: grid-template-rows .4s var(--ease), padding .4s var(--ease); }
#enr .tag:has(#chat:not(:empty)) { grid-template-rows: auto 1fr; padding: 9px 22px 13px 19px; }
#enr .who { padding: 0; box-shadow: none; border-radius: 0; background: none; font-size: 13px; font-weight: 600; opacity: .85; }
#me { display: none; opacity: 0; transition: opacity .15s; }
#me.in { opacity: 1; }
@media (pointer: fine) { #me { display: block; } }
#enr { position: absolute; z-index: 30; transform: translate(110vw, 110vh); }
#enr.glide { transition: transform .9s cubic-bezier(.45,.05,.25,1); }
#enr.flip .tag { left: auto; right: 6px; border-radius: 26px 6px 26px 26px; }
/* il testo sta dentro la pillola, allineato sotto il nome */
#chat { display: block; min-height: 0; overflow: hidden; width: max-content; max-width: 330px; white-space: normal;
  font-size: 19px; font-weight: 500; line-height: 1.3; letter-spacing: -.01em; color: #fff; }
#chat:not(:empty) { margin-top: 3px; animation: chat-in .35s var(--ease); }
@keyframes chat-in { from { opacity: 0; transform: translateY(-4px); } }

#ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.hero.pen #ink { z-index: 12; pointer-events: auto; touch-action: none; }
.hero.pen #frame { pointer-events: none; }
#me.pen svg { display: none; }
#me.rot svg { display: none; }
#me.rot::before { content: ''; display: block; width: 26px; height: 26px; transform: translate(-13px, -13px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15a7 7 0 0 1 11-8M18 3.5v4.5h-4.5M2.5 11.5 6 15.5l3.5-3.8' stroke='%23fff' stroke-width='4'/%3E%3Cpath d='M6 15a7 7 0 0 1 11-8M18 3.5v4.5h-4.5M2.5 11.5 6 15.5l3.5-3.8' stroke='%23101412' stroke-width='1.6'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
#me.pen::before { content: ''; display: block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: var(--acc); transform: translate(-9px, -9px); box-shadow: 0 1px 3px rgba(0,0,0,.3); }

#toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); font-size: 13px; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); transition: opacity .25s, transform .25s var(--ease); pointer-events: none; white-space: nowrap; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.scroll-hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); font-size: 13px; color: var(--muted); text-decoration: none; z-index: 4; }

@media (max-width: 760px) {
  #chat { font-size: 16px; max-width: 230px; }
  .scroll-hint { display: none; }
  .hero-status { left: 16px; bottom: 20px; max-width: 46%; }
  .st-text { font-size: 14.5px; }
  .st-coord, .st-label { display: none; }
  .hero-status { max-width: 40%; }
  /* da telefono la scheda è compatta, larga quanto lo schermo; lo stato sale sopra di lei */
  .deck { left: 16px; right: 16px; bottom: 16px; width: auto; gap: 12px; padding: 10px; border-radius: 14px; }
  .deck-art { width: 64px; height: 64px; }
  .deck-disc { left: 3px; top: 3px; width: 58px; height: 58px; --out: 22px; }
  .deck-vin::before, .deck-lbl { width: 22px; height: 22px; }
  .deck-info { padding-left: 18px; }
  .deck-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "caps caps" "title ctr" "artist ctr"; column-gap: 8px; }
  .deck-caps { grid-area: caps; font-size: 9px; }
  .deck-title { grid-area: title; font-size: 14px; }
  .deck-artist { grid-area: artist; font-size: 12px; }
  .deck-ctr { grid-area: ctr; margin: 0; align-self: center; gap: 6px; }
  .deck-bar, .deck-time, .deck-prev { display: none !important; }
  .deck-ctr .deck-ls { padding: 0 9px; }
  .deck-n { margin-right: 30px; }
  .deck.open { z-index: 35; transform-origin: 100% 100%; animation: deck-pop .35s var(--ease); }
  .deck-close { position: absolute; top: 6px; right: 6px; z-index: 3; width: 28px; height: 28px; border-radius: 50%; place-items: center; color: var(--muted); }
  .deck.open .deck-close { display: grid; }
  .deck-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  /* chiuso: una pastiglia con la copertina rotonda, che gira mentre suona, e il titolo */
  .deck:not(.open) { left: auto; width: auto; max-width: 54vw; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; }
  .deck:not(.open) .deck-art { width: 36px; height: 36px; }
  .deck:not(.open) .deck-disc { display: none; }
  .deck:not(.open) .deck-sleeve-wrap { border-radius: 50%; box-shadow: none; animation: spin 2.4s linear infinite paused; }
  .deck.playing:not(.open) .deck-sleeve-wrap { animation-play-state: running; }
  .deck:not(.open) .deck-info { display: block; padding-left: 0; }
  .deck:not(.open) :is(.deck-caps, .deck-artist, .deck-ctr) { display: none; }
  .deck:not(.open) .deck-title { margin: 0; font-size: 13px; }
  .deck:not(.open) .deck-mini { display: block; position: absolute; inset: 0; z-index: 3; border-radius: inherit; }
  .hero-nav { padding: 58px 16px 0; justify-content: flex-start; } /* sotto "ES" */
  .hero-center { top: 45%; }
  .hero-center .hi { font-size: 24px; margin-bottom: 24px; }
  #frame { padding: 6px 16px 2px; }
  #frame .lbl { font-size: 10px; top: -19px; }
  #dim { font-size: 10.5px; bottom: -27px; }
  .claim { margin-top: 52px; }
  .now { font-size: 10px; letter-spacing: .12em; }
}

/* schermi bassi (laptop piccoli) */
@media (min-width: 761px) and (max-height: 800px) {
  .hero-center { top: 50%; }
  .hero-center .hi { font-size: 26px; margin-bottom: 26px; }
  #name { font-size: clamp(76px, min(15vw, 24vh), 230px); }
  .claim { margin-top: 56px; font-size: clamp(28px, min(4.2vw, 6.5vh), 62px); }
}

/* tablet in verticale */
@media (min-width: 761px) and (orientation: portrait) {
  #name { font-size: 19vw; }
}

/* ---------- intro "la penna" ---------- */
#intro { display: none; }
html.intro { overflow: hidden; }
html.intro #intro { display: block; position: fixed; inset: 0; z-index: 100; cursor: pointer;
  background: var(--bg) radial-gradient(circle, #cbcac2 1px, transparent 1.3px) center / 22px 22px; transition: opacity .42s ease; }
#intro svg { position: absolute; overflow: visible; transform-origin: 50% 48%; } /* centro del box usato da introStart */
#intro text { font-family: var(--f-title); font-weight: 800; font-variation-settings: 'wdth' 100; fill: transparent; stroke: var(--acc); stroke-width: 1.8; }
#intro.draw text { animation: intro-draw 1.25s cubic-bezier(.6,.1,.3,1) forwards, intro-fill .4s ease 1.2s forwards; }
#intro.fly svg { transition: transform .9s cubic-bezier(.65,0,.2,1); }
#intro.out { opacity: 0; }
@keyframes intro-draw { to { stroke-dashoffset: 0; } }
@keyframes intro-fill { to { fill: var(--ink); stroke-width: 0; } }
