/*
 * Nuovo stile PubMe, condiviso da tutte le pagine rifatte (body.v2).
 * Linguaggio a fumetto: contorni spessi, retino, ombre piene, segni della correzione di bozze.
 * Le regole specifiche di ogni pagina stanno nel suo foglio (index.css, pubblica.css…).
 */

.v2 {
    --night: #11110f;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --wrap: 1680px;
    --pop: cubic-bezier(.34, 1.56, .64, 1);
    --smooth: cubic-bezier(.16, 1, .3, 1);
    --dots: radial-gradient(rgba(17, 17, 15, .2) 1.4px, transparent 1.6px) 0 0 / 12px 12px;
}

.v2 main { overflow-x: clip; }

/* Un elemento con l'attributo hidden resta nascosto anche se una regola gli dà un display (es. la conferma d'invio). */
.v2 [hidden] { display: none !important; }

/* La scena dell'apertura arriva fin sotto il menu: qui l'header ha sempre il suo fondo. */
.v2 .site-header { background: rgba(245, 238, 219, .94); backdrop-filter: blur(18px); }

/* ---------- Elementi comuni ---------- */

.label {
    margin: 0;
    color: var(--ink);
    font-family: "DM Mono", monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.label--yellow { color: var(--yellow); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .65em;
    min-height: 54px;
    padding: 0 26px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -.01em;
    text-decoration: none;
    transition: transform .35s var(--pop), background-color .25s, color .25s, box-shadow .35s var(--pop);
}
.btn span { display: inline-block; transition: transform .35s var(--pop); }
.btn:hover { transform: translate(-2px, -2px); }
.btn:hover span { transform: translateX(4px); }
.btn--ink { color: var(--paper); background: var(--ink); box-shadow: 0 0 0 var(--orange); }
.btn--ink:hover { box-shadow: 4px 5px 0 var(--orange); }
.btn--line { color: var(--ink); background: transparent; }
.btn--line:hover { background: var(--yellow); box-shadow: 4px 5px 0 var(--ink); }
.btn--yellow { color: var(--ink); background: var(--yellow); }
.btn--yellow:hover { box-shadow: 4px 5px 0 var(--paper); }

.v2 a:focus-visible,
.v2 button:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }

/* ---------- Segni della correzione di bozze ---------- */

/* I segni della correzione di bozze: un cerchio tracciato a mano e un evidenziatore. */
.mark { position: relative; display: inline-block; isolation: isolate; white-space: nowrap; }
.mark--circle svg {
    position: absolute;
    left: -9%;
    top: -22%;
    width: 118%;
    height: 144%;
    overflow: visible;
    pointer-events: none;
}
.mark--circle path {
    fill: none;
    stroke: var(--orange);
    stroke-width: 4.2;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: mark-draw 1s cubic-bezier(.65, 0, .35, 1) 1.15s forwards;
}
.mark--highlight::before {
    content: "";
    position: absolute;
    z-index: -1;
    left: -.08em;
    right: -.12em;
    top: .38em;
    bottom: .02em;
    background: var(--yellow);
    border-radius: .1em .3em .12em .26em;
    transform: skewX(-8deg) scaleX(0);
    transform-origin: left center;
    animation: mark-sweep .75s cubic-bezier(.65, 0, .35, 1) 1.85s forwards;
}

/* ---------- Libri disegnati ---------- */

.dbook {
    position: absolute;
    display: flex;
    align-items: flex-end;
    width: 124px;
    height: 184px;
    padding: 14px 12px 16px 22px;
    color: var(--ink);
    background: var(--dots), var(--book, var(--orange));
    border: 3px solid var(--ink);
    border-radius: 3px 9px 9px 3px;
    box-shadow: 7px 8px 0 var(--ink);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: .95;
}
.dbook::before { content: ""; position: absolute; left: 8px; top: -3px; bottom: -3px; width: 3px; background: var(--ink); }
.dbook b { position: relative; padding: 5px 7px 6px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 4px; color: var(--ink); }
.dbook--paper { --book: var(--paper); }
.dbook--yellow { --book: var(--yellow); }
.dbook--ink { --book: #2b2a27; }
.dbook--orange { --book: var(--orange); }


/* ---------- Scena a strati ---------- */

/* Illustrazione a fumetti in 3D: strati SVG a profondità diverse (--d) che scene.js inclina seguendo il puntatore. */
.scene {
    --tx: 0;
    --ty: 0;
    position: relative;
    z-index: 1;
    width: min(100%, 720px);
    aspect-ratio: 1;
    justify-self: center;
    perspective: 1100px;
    animation: hx-scene 1.3s var(--smooth) .2s both;
}
.scene__stage {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: rotateX(calc(var(--ty) * -9deg)) rotateY(calc(var(--tx) * 12deg));
}
.scene__layer {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: translate3d(calc(var(--tx) * var(--d) * 30px), calc(var(--ty) * var(--d) * 22px), calc(var(--d) * 110px));
}
.scene__layer > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sc-bob { transform-box: fill-box; animation: sc-bob 4.2s ease-in-out infinite; }
.sc-bob--b { animation-duration: 5.1s; animation-delay: -1.3s; }
.sc-bob--c { animation-duration: 4.6s; animation-delay: -2.2s; }
.sc-bob--d { animation-duration: 5.4s; animation-delay: -.6s; }
.sc-bob--e { animation-duration: 3.9s; animation-delay: -1.8s; }
.sc-bob--f { animation-duration: 4.8s; animation-delay: -3s; }
.sc-twinkle { transform-box: fill-box; transform-origin: center; animation: sc-twinkle 2.6s ease-in-out infinite; }
.sc-twinkle--2 { animation-delay: -.7s; }
.sc-twinkle--3 { animation-delay: -1.4s; }
.sc-twinkle--4 { animation-delay: -2s; }
.sc-pop { transform-box: fill-box; transform-origin: 50% 100%; animation: sc-pop .9s var(--pop) both; }
.sc-pop--a { animation-delay: 1.1s; }
.sc-pop--b { animation-delay: 1.35s; transform-origin: 50% 50%; }

@keyframes hx-scene { from { opacity: 0; transform: translateY(50px) scale(.94); } }
@keyframes sc-bob { 50% { transform: translateY(-9px); } }
@keyframes sc-twinkle { 50% { transform: scale(.55) rotate(25deg); opacity: .7; } }
@keyframes sc-pop { from { transform: scale(0); opacity: 0; } }

/* ---------- Segno ondulato ---------- */

/* Sottolineatura ondulata tracciata a penna da sinistra. Il colore si cambia con --wave-color. */
.mark--wave::after {
    content: "";
    position: absolute;
    z-index: -1;
    left: -.02em;
    right: -.02em;
    bottom: -.16em;
    height: .2em;
    background: var(--wave-color, var(--orange));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6Q8 1 14 6T26 6T38 6T50 6T62 6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6Q8 1 14 6T26 6T38 6T50 6T62 6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    clip-path: inset(0 100% 0 0);
    animation: mark-wave .8s cubic-bezier(.65, 0, .35, 1) 1.6s forwards;
}
@keyframes mark-wave { to { clip-path: inset(0 0 0 0); } }

/* Nei titoli che entrano scorrendo, i segni si disegnano quando il titolo compare, non al caricamento. */
.reveal .mark--circle path { animation-delay: .55s; }
.reveal .mark--highlight::before,
.reveal .mark--wave::after { animation-delay: .7s; }
.js .reveal:not(.is-visible) .mark--circle path,
.js .reveal:not(.is-visible) .mark--highlight::before,
.js .reveal:not(.is-visible) .mark--wave::after { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
    .scene, .sc-bob, .sc-twinkle, .sc-pop { animation: none; }
    .mark--circle path { animation: none; stroke-dashoffset: 0; }
    .mark--highlight::before { animation: none; transform: skewX(-8deg) scaleX(1); }
    .mark--wave::after { animation: none; clip-path: none; }
}

@keyframes hx-fade { from { opacity: 0; transform: translateY(16px); } }
@keyframes mark-draw { to { stroke-dashoffset: 0; } }
@keyframes mark-sweep { to { transform: skewX(-8deg) scaleX(1); } }
@keyframes sc-spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
