/* =============================================================================
   Perspect Starter — Main Stylesheet
   Mobile-first · CSS custom properties · BEM + Bootstrap
   ============================================================================= */


/* ── Font Face — Graphik (local) ─────────────────────────────────────────────── */

@font-face {
    font-family: 'Graphik';
    src: url('../fonts/Graphik-Light.woff2') format('woff2'),
         url('../fonts/Graphik-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Graphik';
    src: url('../fonts/Graphik-Regular.woff2') format('woff2'),
         url('../fonts/Graphik-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Graphik';
    src: url('../fonts/Graphik-Medium.woff2') format('woff2'),
         url('../fonts/Graphik-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Graphik';
    src: url('../fonts/Graphik-Semibold.woff2') format('woff2'),
         url('../fonts/Graphik-Semibold.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}


/* ── Custom Properties ───────────────────────────────────────────────────────── */

:root {
    /* Colors — identità madre visitlido: bianco/nero/sand, righe leggere. Nessun accent. */
    --color-black:         #000000;
    --color-black-rgb:     0, 0, 0;
    --color-white:         #ffffff;
    --color-white-rgb:     255, 255, 255;
    --color-sand:          #ECEAE6;   /* --sand del madre */
    --color-primary:       #000000;
    --color-primary-rgb:   0, 0, 0;
    --color-secondary:     #444444;
    --color-accent:        #000000;   /* nessun accent: neutralizzato a nero (CTA/link/focus) */
    --color-accent-rgb:    0, 0, 0;
    --color-bg:            #ffffff;
    --color-bg-alt:        var(--color-sand);
    --color-text:          #000000;
    --color-text-muted:    #6c757d;
    --color-border:        #CECECE;   /* righe leggere madre (#CACACA/#CECECE) */

    /* Bootstrap overrides */
    --bs-primary:          var(--color-accent);
    --bs-primary-rgb:      var(--color-accent-rgb);

    /* Typography */
    --font-family-base:    'Graphik', system-ui, -apple-system, sans-serif;
    --font-family-heading: var(--font-family-base);
    --line-height-base:    1.6;

    /* Type scale — il nome riflette il valore px a 1920px */
    --fs-14:  0.875rem;
    --fs-16:  1rem;
    --fs-22:  clamp(1.125rem, 1vw + 0.75rem,   1.375rem);  /* 18→22px */
    --fs-28:  clamp(1.25rem,  1.5vw + 0.75rem, 1.75rem);   /* 20→28px */
    --fs-40:  clamp(1.5rem,   2vw + 1rem,      2.5rem);    /* 24→40px */
    --fs-56:  clamp(2rem,     3vw + 1rem,      3.5rem);    /* 32→56px */
    --fs-80:  clamp(2.5rem,   5vw + 1rem,      5rem);      /* 40→80px */

    /* Spacing — il nome riflette il valore px a 1920px */
    --p-60:   clamp(20px, 3.125vw, 60px);
    --p-90:   clamp(30px, 4.69vw,  90px);
    --p-120:  clamp(60px, 6.25vw,  120px);
    --p-160:  clamp(90px, 8.33vw,  160px);

    /* Gutter container */
    --gutter-off:   max(1.25rem, 3.6458vw);   /* padding laterale esterno (~70px @ 1920px) */
    --gutter-half:  calc(var(--gutter-off) / 2);
    --gutter-in:    max(0.9375rem, 0.8125vw); /* gap interno colonne row */

    /* Focus */
    --focus-rgba: rgba(var(--color-accent-rgb), 0.35);
    --focus-ring: 0 0 0 3px var(--focus-rgba);

    /* Transitions */
    --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base:   0.25s var(--transition-timing);

    /* Header — solo per scroll-padding e spacer, mai min-height su .header */
    --header-height:    72px;
    --header-height-lg: 80px;
}


/* ── Reset minimale ──────────────────────────────────────────────────────────── */
/* Bootstrap reboot copre il grosso. Qui solo ciò che non gestisce. */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
}

p {
    margin-block: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:             var(--font-family-base);
    font-size:               var(--fs-16);
    line-height:             var(--line-height-base);
    color:                   var(--color-text);
    background:              var(--color-bg);
    -webkit-font-smoothing:  antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Nasconde il bordo su img senza src o con src vuoto */
img:not([src]),
img[src=""] {
    visibility: hidden;
}


/* ── Media utilities ─────────────────────────────────────────────────────────── */
/*
 * Pattern: wrapper posizionato + immagine assoluta che riempie il container.
 * Usare un <div class="media"> lascia <figure> libero per la semantica HTML:
 *
 *   Semplice:
 *   <div class="media" style="aspect-ratio: 16/9">
 *       <img class="img-cover" src="..." alt="..." loading="lazy">
 *   </div>
 *
 *   Con caption (semantica corretta):
 *   <figure>
 *       <div class="media" style="aspect-ratio: 16/9">
 *           <img class="img-cover" src="..." alt="..." loading="lazy">
 *       </div>
 *       <figcaption>Didascalia</figcaption>
 *   </figure>
 *
 * .media       — wrapper (position: relative, display: block)
 * .media-bg    — wrapper decorativo: no pointer-events, no select.
 *                Supporta ::after per overlay (solo su <div>, non su <img>)
 * .img-cover   — riempie il wrapper, object-fit: cover   (foto, hero, card)
 * .img-contain — riempie il wrapper, object-fit: contain (loghi, illustrazioni)
 * .img-scale   — riempie il wrapper, object-fit: scale-down (icone, asset misti)
 *
 * NB: Bootstrap ha .object-fit-cover ecc. ma senza il posizionamento assoluto —
 * queste classi coprono il pattern "fill container" completo.
 */

.media {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
}

.media-bg::after {
    user-select: none;
    pointer-events: none;
}

.img-cover,
.img-contain,
.img-scale,
.media-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.img-contain { object-fit: contain; }
.img-scale   { object-fit: scale-down; }

::selection {
    background: rgba(var(--color-accent-rgb), 0.15);
    color: var(--color-primary);
}


/* ── Link base ───────────────────────────────────────────────────────────────── */
/* Neutri di default — colore e stile aggiunto nel contesto (header, footer, .text…) */

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base);
}

/* Rimuove l'outline al click/tap ma lo preserva per navigazione da tastiera — EAA */
a:focus:not(:focus-visible) {
    outline: none;
}


/* ── Accessibility ───────────────────────────────────────────────────────────── */

/* Focus ring — EAA / WCAG 2.4.7 */
:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* Skip link — usa .visually-hidden-focusable di Bootstrap per show-on-focus */
.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    border-radius: 4px;
}

/* Classe WP core (search form, commenti + plugin come Complianz/Gravity Forms
   la emettono). Bootstrap non la fornisce → definirla. Focusabile: torna
   visibile con tastiera. */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    position: absolute !important;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    clip: auto !important;
    clip-path: none;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.5rem 1rem;
    z-index: 9999;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    border-radius: 4px;
}


/* ── Loader ──────────────────────────────────────────────────────────────────── */

.site-loader {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.site-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.site-loader__bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 16px;
}

.site-loader__bars span {
    display: inline-block;
    width: 1px;
    height: 100%;
    background: var(--color-primary);
    animation: stretchdelay 1.2s ease-in-out infinite;
}

.site-loader__bars span:nth-child(2) { animation-delay: -1.1s; }
.site-loader__bars span:nth-child(3) { animation-delay: -1.0s; }
.site-loader__bars span:nth-child(4) { animation-delay: -0.9s; }
.site-loader__bars span:nth-child(5) { animation-delay: -0.8s; }

@keyframes stretchdelay {
    0%, 40%, 100% { transform: scaleY(0.4); }
    20%           { transform: scaleY(1); }
}


/* ── Header ──────────────────────────────────────────────────────────────────── */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.header .navbar           { padding-block: 1rem; }
.header .navbar-brand     { font-weight: 700; }

.header .navbar-nav .nav-link {
    color: var(--color-text);
    font-weight: 500;
    padding-inline: 1rem;
    transition: color var(--transition-base);
}

.header .navbar-nav .nav-link:hover,
.header .navbar-nav .nav-link:focus-visible,
.header .navbar-nav .nav-item.current-menu-item > .nav-link,
.header .navbar-nav .nav-item.current_page_item > .nav-link {
    color: var(--color-accent);
}


/* ── Footer band (mosaico decorativo) ────────────────────────────────────────── */

.footer-band {
    display: flex;
}

.footer-band__cell {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

/* Mobile: mostra le prime 5, nasconde il resto (evita righe monche) */
.footer-band__cell--extra { display: none; }

@media (min-width: 768px) {
    .footer-band__cell--extra { display: block; }
}


/* ── Footer ──────────────────────────────────────────────────────────────────── */

.footer {
    color: var(--color-black);
}

.footer__main {
    background: var(--color-sand);
    padding-block: var(--p-90);
}

.footer__col-title {
    font-size: var(--fs-14);
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.footer__address {
    font-style: normal;
    font-weight: 300;
    line-height: 1.9;
}

.footer__address a { text-decoration: none; }
.footer__address a:hover { text-decoration: underline; }

.footer__social-title {
    margin-top: 2.5rem;
    font-size: var(--fs-14);
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.footer__nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer__nav li + li { border-top: 1px solid var(--color-border); }

.footer__nav li a {
    display: block;
    padding-block: 0.5rem;
    font-size: var(--fs-16);
    font-weight: 300;
    transition: transform var(--transition-base);
}

.footer__nav li a:hover,
.footer__nav li a:focus-visible { transform: translateX(8px); }

/* Social — cerchi neri */

.footer-social__list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-social__link {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-black);
    color: var(--color-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-base);
}

.footer-social__link:hover,
.footer-social__link:focus-visible { background: color-mix(in srgb, var(--color-black) 86%, var(--color-white)); }

.footer-social__link svg { width: 18px; height: 18px; fill: currentColor; }

/* Patrocini — box-figure a dimensione fissa (come madre), logo contenuto */

.footer__patr {
    background: var(--color-white);
    padding-block: 25px;
}

.footer__patr-logo {
    display: block;
    position: relative;
    max-width: 100%;
}

/* Regione Veneto: 238×92 (madre .figure) */
.footer__patr-logo--veneto { width: 238px; aspect-ratio: 238 / 92; }

/* POC / Bureau / ARPAV: 233×100 (madre .fig-poc) */
.footer__patr-logo--poc { width: 233px; aspect-ratio: 233 / 100; }

.footer__patr-logo .img-contain { object-position: left center; }

/* Legal */

.footer__legal {
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    padding-block: 25px;
    font-size: 0.8125rem;
    color: rgba(var(--color-black-rgb), 0.6);
}

.footer__copy { color: rgba(var(--color-black-rgb), 0.6); }

.footer__legal-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 2rem;
}

.footer__legal-menu li a { text-decoration: underline; }
.footer__legal-menu li a:hover,
.footer__legal-menu li a:focus-visible { text-decoration: none; }

/* Language switcher */

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-switcher__label { color: rgba(var(--color-black-rgb), 0.6); }

.lang-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border: 0;
    border-radius: 0;
    background: var(--color-black);
    color: var(--color-white);
    font-size: var(--fs-14);
    font-weight: 400;
}

.lang-switcher__menu.dropdown-menu {
    min-width: auto;
    background: var(--color-black);
    border: 0;
    border-radius: 0;
}

.lang-switcher__menu .dropdown-item { color: rgba(var(--color-white-rgb), 0.7); }
.lang-switcher__menu .dropdown-item:hover,
.lang-switcher__menu .dropdown-item:focus {
    color: var(--color-white);
    background: transparent;
}
.lang-switcher__menu .dropdown-item.is-active { color: var(--color-white); font-weight: 600; }


/* ── Layout — Bootstrap overrides ───────────────────────────────────────────── */

.container-fluid {
    --bs-gutter-x: var(--gutter-off);
}

.row {
    --bs-gutter-x: var(--gutter-in);
}


/* ── Sections ────────────────────────────────────────────────────────────────── */

.section,
[class^="section-"] {
    padding-block: var(--p-90);
}


/* ── Bootstrap .btn — override globali ──────────────────────────────────────── */
/*
 * Mai ricreare bottoni da zero — usare sempre classi Bootstrap native (.btn-primary, .btn-light…).
 * Le varianti progetto si definiscono sovrascrivendo --bs-btn-* sulla classe specifica.
 */

.btn {
    --bs-btn-font-family:      var(--font-family-base);
    --bs-btn-font-size:        var(--fs-16);
    --bs-btn-font-weight:      600;
    --bs-btn-padding-x:        1.875rem;
    --bs-btn-padding-y:        0.765rem;
    --bs-btn-border-radius:    100px;
    --bs-btn-focus-box-shadow: var(--focus-ring);
    letter-spacing: -0.01em;
}


/* ── .text — Prosa ───────────────────────────────────────────────────────────── */
/*
 * Classe riutilizzabile per qualsiasi box testuale (moduli, descrizioni, body...).
 * Usare class="text" sul wrapper del contenuto.
 * Per contenuto editoriale full (page.php) combinare: class="page-content__body text"
 */

.text {
    font-weight: 400;
    font-size: var(--fs-16);
    line-height: 1.6;
}

/* Gerarchia heading relativa al font-size del contesto (.text)
   em è corretto qui: scala automaticamente se .text cambia dimensione */
.text :is(h1, h2)     { font-size: 1.5em; }
.text :is(h3, h4)     { font-size: 1.25em; }
.text :is(h5, h6)     { font-size: 1.1em; }

.text :is(h1, h2, h3, h4, h5, h6) {
    font-weight: 600;
    line-height: 1.3;
}

.text :is(h1, h2, h3, h4, h5, h6):not(:first-child) {
    padding-top: 2em;
}

.text :is(p, ul, ol):not(:first-child) {
    padding-top: 1.2em;
}

.text :is(ul, ol) {
    padding-left: 1em;
}

.text strong {
    font-weight: 600;
}

.text a:not(.btn) {
    color: var(--color-accent);
    text-decoration: underline;
}

.text a:not(.btn):hover {
    text-decoration: none;
}


/* ── Eyebrow & Title — tipografia modulare ───────────────────────────────────── */
/*
 * Classi standalone riutilizzabili nei moduli flessibili e ovunque serva
 * un blocco titolo strutturato. Non BEM — si usano da sole o in combinazione.
 *
 *   <p class="eyebrow">I nostri servizi</p>
 *   <h2 class="title">Cosa facciamo per te</h2>
 */

.eyebrow {
    display: block;
    font-size: var(--fs-14);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 0.75rem;
}

.title {
    font-size: var(--fs-40);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.5rem;
}


/* ── Page wrap — pagine semplici (legal, 404…) ───────────────────────────────── */
/*
 * .page-wrap    — padding verticale di sezione, max-width leggibile, centrato
 * .page-title   — h1 standalone, usabile in page.php, 404.php e simili
 *
 * page.php:  class="page-wrap"  +  class="page-title"  +  class="text"
 * 404.php:   class="page-wrap"  +  class="page-title"
 */

.page-wrap {
    padding-block: var(--p-90);
}

.page-title {
    font-size: var(--fs-56);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

/* .page-content__body mantiene line-height editoriale per testi lunghi */
.page-content__body {
    font-size: var(--fs-16);
    line-height: 1.8;
}


/* ── Module: Hero ────────────────────────────────────────────────────────────── */

.module-hero {
    position: relative;
    min-height: clamp(60vh, 80vh, 90vh);
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--color-primary);
    color: #fff;
}

.module-hero__media {
    position: absolute;
    inset: 0;
    margin: 0;
}

.module-hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.45;
}

.module-hero__overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    padding-block: var(--p-90);
}

.module-hero__title {
    font-size: var(--fs-80);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
    color: inherit;
}

.module-hero__subtitle {
    font-size: var(--fs-22);
    margin-bottom: 2rem;
    color: rgba(255,255,255,0.85);
}

.module-hero__cta {
    padding: 0.75rem 2rem;
    font-weight: 600;
}


/* ── Card Post ───────────────────────────────────────────────────────────────── */

.card-post {
    margin-bottom: 2rem;
}

.card-post__img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.card-post__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-post__title a:hover,
.card-post__title a:focus-visible {
    color: var(--color-accent);
}

.card-post__excerpt p {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}


/* ── 404 ─────────────────────────────────────────────────────────────────────── */
/* Nessuna regola specifica: usa il body text di default + .page-wrap + .page-title */


/* ── Edit post link (admin, solo loggati) ────────────────────────────────────── */

.post-edit-link {
    position: fixed;
    z-index: 9999;
    bottom: 0;
    right: 0;
    padding: 10px 18px;
    background-color: #3c3c3c;
    color: var(--color-white);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-top-left-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.post-edit-link:hover,
.post-edit-link:focus-visible {
    color: var(--color-white);
    background-color: #222;
}
