/* Base: reset, header, footer, pagine semplici, eco pieno/contorno. */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--tp-ink);
    color: var(--tp-paper);
    font-family: var(--tp-font-testo);
    font-size: var(--tp-fs-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
    margin: 0;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--tp-paper);
    outline-offset: 3px;
}

/* Link «Vai al contenuto»: visibile solo con la tastiera */
.tp-salta {
    position: absolute;
    left: var(--tp-gutter);
    top: -10rem;
    z-index: 100;
    padding: 0.75rem 1rem;
    background: var(--tp-paper);
    color: var(--tp-ink);
    font-weight: 700;
    text-decoration: none;
}

.tp-salta:focus {
    top: 0.75rem;
}

/* ---------- Header ---------- */

.tp-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: var(--tp-header-h);
    padding: 0.75rem var(--tp-gutter);
    background: var(--tp-ink-deep);
    border-bottom: 1px solid var(--tp-line);
}

/* Da loggati l'header fisso sta sotto la barra di WordPress (che sotto i 600 px scorre via) */
.admin-bar .tp-header {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .tp-header {
        top: 46px;
    }
}

@media (max-width: 600px) {
    .admin-bar .tp-header {
        top: 0;
    }
}

.tp-marchio {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

/* Il «50» del logo: SVG come maschera, così il colore lo dà il CSS */
.tp-marchio__50,
.tp-footer__50 {
    display: block;
    aspect-ratio: 133.9 / 95.3;
    background: currentColor;
    -webkit-mask: url("../img/marchio-50.svg") no-repeat center / contain;
    mask: url("../img/marchio-50.svg") no-repeat center / contain;
}

.tp-marchio__50 {
    width: 2.75rem;
}

.tp-marchio__nome {
    font-family: var(--tp-font-display);
    font-size: 0.875rem;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tp-nav__lista {
    display: flex;
    gap: 2rem;
    padding: 0;
    list-style: none;
}

.tp-nav__lista a {
    font-family: var(--tp-font-dati);
    font-size: var(--tp-fs-dati);
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-decoration: none;
}

.tp-nav__lista a:hover,
.tp-nav__lista .current-menu-item > a {
    color: var(--tp-wine-glow);
}

.tp-menu-toggle {
    display: none;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--tp-paper);
    background: transparent;
    color: var(--tp-paper);
    font: inherit;
    font-family: var(--tp-font-dati);
    font-size: 1.25rem;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
}

/* Mobile: il menu si apre col pulsante, solo se il JS c'è (senza JS resta in pagina) */
@media (max-width: 55.99rem) {
    .tp-js .tp-menu-toggle {
        display: block;
    }

    .tp-js .tp-nav {
        display: none;
        position: absolute;
        inset: 100% 0 auto;
        padding: 1.5rem var(--tp-gutter) 2rem;
        background: var(--tp-ink-deep);
        border-bottom: 1px solid var(--tp-line);
    }

    .tp-js.tp-menu-aperto .tp-nav {
        display: block;
    }

    .tp-nav__lista {
        flex-direction: column;
        gap: 1.25rem;
    }

    .tp-header {
        flex-wrap: wrap;
    }
}

/* ---------- Contenuto ---------- */

.tp-main {
    flex: 1;
    width: 100%;
}

.tp-main:focus {
    outline: none;
}

.tp-pagina {
    width: 100%;
    max-width: var(--tp-max);
    margin: 0 auto;
    padding: clamp(2.5rem, 6vw, 6rem) var(--tp-gutter);
}

.tp-pagina__titolo {
    max-width: 20ch;
    margin-bottom: 1.5rem;
    font-family: var(--tp-font-display);
    font-size: var(--tp-fs-h1);
    line-height: 1.05;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.tp-articolo + .tp-articolo {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--tp-line);
}

.tp-articolo__titolo {
    margin-bottom: 1rem;
    font-family: var(--tp-font-display);
    font-size: var(--tp-fs-h2);
    line-height: 1.1;
    text-transform: uppercase;
}

.tp-articolo__titolo a {
    text-decoration: none;
}

.tp-testo {
    max-width: var(--tp-testo-max);
}

.tp-testo > * + * {
    margin-top: 1em;
}

.tp-testo a,
.tp-link {
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.tp-testo a:hover,
.tp-link:hover {
    color: var(--tp-wine-glow);
}

/* Solo per i lettori di schermo */
.tp-nascosto {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------- Sezioni del builder (template-parts/sezioni/) ---------- */

.tp-sezione {
    padding: clamp(3rem, 8vw, 7rem) var(--tp-gutter);
}

.tp-sezione--vino {
    background: var(--tp-wine);
}

.tp-sezione__dentro {
    max-width: var(--tp-max);
    margin: 0 auto;
}

.tp-sezione__titolo {
    max-width: 22ch;
    margin-bottom: 1.5rem;
    font-family: var(--tp-font-display);
    font-size: var(--tp-fs-h2);
    line-height: 1.1;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.tp-sezione__azione {
    margin-top: 2rem;
}

.tp-bottone {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.6rem 1.4rem;
    border: 1px solid var(--tp-paper);
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    transition: background var(--tp-durata) var(--tp-ease), color var(--tp-durata) var(--tp-ease);
}

.tp-bottone:hover,
.tp-bottone:focus-visible {
    background: var(--tp-paper);
    color: var(--tp-ink);
}

/* 404: il numero come nella guida, a solo contorno */
.tp-404__numero {
    font-family: var(--tp-font-display);
    font-size: clamp(6rem, 30vw, 22rem);
    line-height: 0.9;
    color: transparent;
    -webkit-text-stroke: 2px var(--tp-wine-glow);
}

.tp-404 p + p {
    margin-top: 1rem;
}

/* ---------- Eco pieno/contorno (DESIGN §3.2) ---------- */

.tp-hero {
    display: grid;
    place-items: center;
    min-height: calc(100vh - var(--tp-header-h));
    min-height: calc(100svh - var(--tp-header-h));
    padding: var(--tp-gutter);
    overflow: hidden;
}

.tp-eco {
    position: relative;
    display: grid;
    font-family: var(--tp-font-display);
    font-size: clamp(2.5rem, 16vw, 14rem);
    font-weight: 800;
    line-height: 0.95;
    text-transform: uppercase;
}

.tp-eco__pieno,
.tp-eco__contorno {
    grid-area: 1 / 1;
}

.tp-eco__pieno > span,
.tp-eco__contorno > span {
    display: block;
}

.tp-eco__pieno {
    position: relative;
    z-index: 1;
}

.tp-eco__contorno {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--tp-paper);
    transform: translate(0.08em, 0.08em);
}

@media (prefers-reduced-motion: no-preference) {
    .tp-eco__contorno {
        animation: tp-eco-separa 1.2s var(--tp-ease) 0.2s both;
    }

    @keyframes tp-eco-separa {
        from {
            transform: translate(0, 0);
            opacity: 0;
        }
    }
}

/* ---------- Footer ---------- */

.tp-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 2rem var(--tp-gutter);
    border-top: 1px solid var(--tp-line);
    background: var(--tp-ink-deep);
    font-size: var(--tp-fs-small);
    color: var(--tp-paper-dim);
}

.tp-footer__50 {
    width: 2.25rem;
    color: var(--tp-paper);
}

.tp-footer__lista {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    padding: 0;
    list-style: none;
}

.tp-footer__lista a {
    text-decoration: none;
}

.tp-footer__lista a:hover {
    color: var(--tp-paper);
}
