/*
Theme Name: Ethicals
Author: ivanc
Description: Un tema leggero basato su Underscores e Pico.css
Version: 202604141600
*/

/* =========================================================
   1. LAYOUT BASE
   ========================================================= */

body {
    scroll-padding-top: 80px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

/* Il contenuto principale si espande, il footer resta ancorato al fondo */
main, #primary, .site-main {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
}

body > footer, body > header, body > main {
    padding-block: unset;
}


/* =========================================================
   2. HEADER STICKY
   ========================================================= */

.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--p-background-color);
    border-bottom: 1px solid var(--p-muted-border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media screen and (max-width: 782px) {
    .admin-bar .main-header {
        top: 46px; /* La barra admin è più alta su mobile */
    }
}

/* Allineamento elementi nella nav */
nav ul {
    align-items: center;
}


/* =========================================================
   3. LOGO
   ========================================================= */

.custom-logo-link {
    text-decoration: none;
}

.custom-logo-link img {
    width: auto;
    display: block;
}

.custom-logo {
    margin-right: 1rem;
    display: inline-block;
    vertical-align: middle;
}


/* =========================================================
   4. THEME SWITCH
   ========================================================= */

#theme-toggle[role="switch"] {
    margin-bottom: 0;
    margin-left: 0.5rem;
}

.theme-switch-container label {
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: var(--p-muted-color);
    transition: color 0.3s ease;
}

#theme-label-text {
    min-width: 85px;
    text-align: right;
    display: inline-block;
}


/* =========================================================
   5. HERO BANNER (home)
   ========================================================= */

.hero-banner {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    margin-top: -80px;
    padding-top: 80px;
}

/* Velo scuro sopra l'immagine */
.hero-banner::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-content article {
    background: transparent;
    border: none;
}


/* =========================================================
   6. HERO (pagine interne)
   ========================================================= */

.hero-background {
    height: 350px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    color: white;
}

.hero-overlay {
    background: rgba(0, 0, 0, 0.4);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}


/* =========================================================
   7. CATEGORIE IN EVIDENZA (home — max 6 box)
   ========================================================= */

.featured-categories .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--pico-spacing);
}

.category-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    border-top: 4px solid var(--pico-primary);
    transition: box-shadow 0.3s ease;
}

.category-card:hover {
    box-shadow: var(--pico-card-sectioning-background-color) 0px 10px 20px;
}

.card-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.overlay-header {
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 15px 10px 15px;
    z-index: 10;
    pointer-events: none;
}

.overlay-header h4 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}


/* =========================================================
   8. GRIGLIA NEWS (home e archivi)
   ========================================================= */

.latest-news .grid {
    --pico-grid-spacing-vertical: 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--pico-spacing);
}

@media (max-width: 992px) {
    .latest-news .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .latest-news .grid {
        grid-template-columns: 1fr;
    }
}

.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
    background: #fff;
    overflow: hidden;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.category-tag {
    text-transform: uppercase;
    color: var(--pico-primary);
    font-weight: bold;
    letter-spacing: 1px;
}

.post-title {
    margin-top: 0.5rem;
    font-size: 1.2rem;
    line-height: 1.3;
}

.post-excerpt {
    font-size: 0.9rem;
    flex-grow: 1;
}


/* =========================================================
   9. PAGINE CATEGORIA (archivio)
   ========================================================= */

.category-hero {
    text-align: center;
}

.category-description {
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
}

.post-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: transform 0.2s ease;
}

.post-card:hover {
    transform: translateY(-5px);
}

.post-card .post-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Griglia 3 colonne su desktop per gli archivi */
@media (min-width: 992px) {
    main.container .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* =========================================================
   10. SIDEBAR
   ========================================================= */

@media (min-width: 992px) {
    main .grid {
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }
}


/* =========================================================
   11. FOOTER
   ========================================================= */

article > header {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

footer[role="contentinfo"] aside,
footer[role="contentinfo"] div[id^="footer-"] {
    font-size: 0.9rem;
}

footer[role="contentinfo"] h2,
footer[role="contentinfo"] h3,
footer[role="contentinfo"] h6 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

footer[role="contentinfo"] ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.company-footer p {
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
    line-height: 1.4;
    color: var(--p-muted-color);
}


/* =========================================================
   12. BOTTONI E FORM
   ========================================================= */

button.outline.secondary {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Contact Form 7 */
.wpcf7-form input:not([type="submit"]),
.wpcf7-form textarea,
.wpcf7-form select {
    width: 100%;
    margin-bottom: 1rem;
}

.wpcf7-spinner {
    display: none;
}


/* =========================================================
   13. MENU LINGUE (Polylang)
   ========================================================= */

ul.list-lang li.lang-item > a { color: whitesmoke; }
summary.current_lang { color: whitesmoke; }
li.menu-item > a { color: whitesmoke; }



/* =========================================================
   14. PAGINA CONTATTI
   Si applica dentro .contact-page — stila elementi semantici
   standard scritti nell'editor, senza classi manuali.
   ========================================================= */

.contact-page {
    max-width: 780px;
    margin:    0 auto;
    padding:   2rem 0;
}

/* Paragrafo introduttivo (primo <p>) */
.contact-page > p:first-of-type {
    font-size:   1.1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

/* Tag <address>: card con bordo sinistro */
.contact-page address {
    font-style:    normal;
    border-left:   3px solid var(--pico-primary);
    padding:       1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    background:    rgba(128,128,128,0.05);
    margin-bottom: 1.5rem;
    line-height:   1.8;
}

/* Link email: badge visivo */
.contact-page a[href^="mailto:"] {
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
    padding:         5px 12px;
    border-radius:   20px;
    border:          1px solid rgba(128,128,128,0.25);
    background:      rgba(128,128,128,0.06);
    text-decoration: none;
    font-size:       0.9rem;
    transition:      border-color 0.2s, background 0.2s;
    margin:          2px 0;
}

.contact-page a[href^="mailto:"]:hover {
    border-color: var(--pico-primary);
    background:   rgba(128,128,128,0.12);
}

/* Prefisso "✉" prima di ogni mailto */
.contact-page a[href^="mailto:"]::before {
    content:   "✉";
    font-size: 13px;
    opacity:   0.6;
}

/* Link tel */
.contact-page a[href^="tel:"] {
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
    padding:         5px 12px;
    border-radius:   20px;
    border:          1px solid rgba(128,128,128,0.25);
    background:      rgba(128,128,128,0.06);
    text-decoration: none;
    font-size:       0.9rem;
    transition:      border-color 0.2s;
}

.contact-page a[href^="tel:"]:hover {
    border-color: var(--pico-primary);
}

.contact-page a[href^="tel:"]::before {
    content:   "📞";
    font-size: 12px;
}

/* Blocco 5‰ (shortcode) */
.cinque-mille-block {
    display:       flex;
    align-items:   center;
    gap:           1.5rem;
    padding:       1.25rem 1.5rem;
    border-radius: 10px;
    border:        1px solid rgba(128,128,128,0.2);
    background:    rgba(128,128,128,0.05);
    margin:        2rem 0;
}

.cinque-mille-number {
    font-size:   3rem;
    font-weight: 700;
    color:       var(--pico-primary);
    line-height: 1;
    flex-shrink: 0;
}

.cinque-mille-label {
    font-size:   0.95rem;
    margin:      0 0 4px;
    line-height: 1.4;
}

.cinque-mille-cf strong {
    font-family:    monospace;
    font-size:      1.1rem;
    letter-spacing: 0.08em;
}

.cinque-mille-hint {
    font-size: 0.78rem;
    opacity:   0.6;
    margin:    2px 0 0;
}

/* Griglia colonne Gutenberg dentro .contact-page */
.contact-page .wp-block-columns {
    gap: 2rem;
}

@media (max-width: 600px) {
    .cinque-mille-block {
        flex-direction: column;
        text-align:     center;
    }
}


/* =========================================================
   15. HAMBURGER MENU — mobile (< 578px)
   ========================================================= */

/* Bottone hamburger — nascosto su desktop con !important
   perché Pico.css sovrascrive altrimenti il display */
.nav-hamburger {
    display:         none !important;
    flex-direction:  column;
    justify-content: center;
    gap:             5px;
    width:           36px;
    height:          36px;
    padding:         6px;
    background:      transparent;
    border:          none;
    cursor:          pointer;
    flex-shrink:     0;
    margin-left:     auto;
    z-index:         1100;
}

.nav-hamburger span {
    display:          block;
    width:            22px;
    height:           2px;
    background:       currentColor;
    border-radius:    2px;
    transition:       transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
}

/* Animazione X quando aperto */
.nav-hamburger--open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger--open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger--open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


@media (max-width: 578px) {

    /* Mostra il bottone hamburger */
    .nav-hamburger {
        display: flex !important;
        color:   white;
    }

    /* La nav si trasforma in drawer laterale */
    #nav-mobile-menu {
        display:          flex;
        flex-direction:   column;
        align-items:      flex-start;
        gap:              0;
        position:         fixed;
        top:              0;
        right:            0;
        width:            280px;
        height:           100vh;
        background:       #1a1a1a;
        z-index:          1050;
        padding:          70px 0 2rem;
        transform:        translateX(100%);
        transition:       transform 0.3s ease;
        overflow-y:       auto;
        box-shadow:       -4px 0 20px rgba(0,0,0,0.3);
    }

    /* Drawer aperto */
    #nav-mobile-menu.nav-menu--open {
        transform: translateX(0);
    }

    /* Overlay scuro dietro il drawer */
    #nav-mobile-menu.nav-menu--open::before {
        content:    "";
        position:   fixed;
        inset:      0;
        right:      280px;
        background: rgba(0,0,0,0.5);
        z-index:    -1;
    }

    /* Voci di menu nel drawer */
    #nav-mobile-menu > li,
    #nav-mobile-menu li.menu-item {
        width:      100%;
        border-bottom: 1px solid rgba(255,255,255,0.07);
    }

    #nav-mobile-menu > li > a,
    #nav-mobile-menu li.menu-item > a {
        display:     block;
        padding:     14px 24px;
        font-size:   1rem;
        color:       rgba(255,255,255,0.9) !important;
        text-decoration: none;
        transition:  background 0.15s;
    }

    #nav-mobile-menu > li > a:hover,
    #nav-mobile-menu li.menu-item > a:hover {
        background: rgba(255,255,255,0.06);
    }

    /* Bottone Cerca nel drawer */
    .nav-item-search {
        padding: 12px 24px;
        width:   100%;
        box-sizing: border-box;
    }

    .nav-item-search button {
        width: 100%;
    }

    /* Switch tema nel drawer */
    .theme-switch-container {
        padding: 12px 24px;
        width:   100%;
        box-sizing: border-box;
    }

    /* Lingua nel drawer */
    #nav-mobile-menu details.dropdown {
        width: 100%;
    }

    #nav-mobile-menu details.dropdown > summary {
        padding:     14px 24px !important;
        color:       rgba(255,255,255,0.9) !important;
        display:     block;
        font-size:   1rem;
        border-bottom: 1px solid rgba(255,255,255,0.07);
    }

    #nav-mobile-menu details.dropdown ul {
        background: rgba(255,255,255,0.04);
        padding:    0;
    }

    #nav-mobile-menu .list-lang li a {
        display:  block;
        padding:  10px 24px;
        color:    rgba(255,255,255,0.75) !important;
        font-size: 0.9rem;
    }

    /* Nav principale — nasconde la ul desktop, mostra solo logo + hamburger */
    nav.container {
        display:         flex;
        justify-content: space-between;
        align-items:     center;
        overflow:        visible;
    }

    nav.container > ul:first-child {
        flex: 1;
    }
}
