/*
Theme Name: Twenty Twenty-Five Child
Template: twentytwentyfive
Author: Alessandro Zaina
Version: 3.5
*/

/* --------------------
   Reset e stili base
-------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    margin-top: 0 !important;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-padding-top: 70px;
}

body {
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    background-color: var(--surface-body) !important;
}

body.admin-bar .custom-header {
    top: 32px;
}

.site-header,
.wp-site-blocks,
.entry-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Base (Mobile - < 480px) - Stile di default */

/* --------------------
   Header
-------------------- */
.custom-header {
    padding-block: 10px;
    border-bottom: 2px solid var(--color-gray-200);
    background-color: var(--surface-header) !important;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo a {
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    transition: color var(--transition-normal);
}

/* --------------------
   Navigation
-------------------- */

.custom-header .menu-toggle {
    display: block;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    cursor: pointer;
    z-index: 1001;
    background-color: var(--color-gray-100);
    color: var(--color-gray-600);
    padding: 8px;
}

.custom-header .menu-toggle svg {
    display: block;
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

/* Stile per il pulsante quando il menu è aperto */
.custom-header .menu-toggle.active {
    border-color: var(--color-primary);
}

.custom-header .menu-toggle.active svg {
    transform: rotate(180deg);
}

/* Nascondiamo il menu di base su mobile */
body .custom-header #main-menu {
    display: none !important;
}

/* Mostriamo il menu quando JS aggiunge la classe .active */
body .custom-header #main-menu.active {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;    
    width: 100%;
    background-color: var(--surface-body);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    border-top: 1px solid var(--color-gray-200);
}

/* Stili per i link dentro il menu mobile */
.custom-header .nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.custom-header .nav-links a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--color-gray-600);
    position: relative;
    border-bottom: 1px solid var(--color-gray-200);
    transition: all var(--transition-normal);
}

.custom-header .nav-links li:last-child a {
    border-bottom: none;
}

.custom-header .nav-links a.active,
.nav-item--current {
    color: var(--color-secondary);
}

.custom-header .nav-links a:hover {
    background-color: var(--color-gray-100);
    color: var(--color-primary);
}

/* Logica della sottolineatura  */
.custom-header .nav-links a::after {
    content: ''; 
    position: absolute; 
    width: 0; 
    height: 2px;
    bottom: -1px; 
    left: 50%; 
    background-color: var(--color-primary);
    transition: width var(--transition-normal); 
    transform: translateX(-50%);
}

.custom-header .nav-links a:hover::after { 
    width: 100%; 
}

.custom-header .nav-links .current-menu-item > a::after,
.custom-header .nav-links a[aria-current="page"]::after { 
    width: 100%; 
}

.custom-header .nav-links .current-menu-item > a,
.custom-header .nav-links a[aria-current="page"] {
    font-weight: 700;
    color: var(--color-primary);
}

/* --------------------
   Breadcrumbs
-------------------- */
.breadcrumbs-wrapper {
    width: 100%;
    margin-top: var(--space-xs); 
}

.breadcrumbs {
    width: 100%;
    padding-block: clamp(5px, 1vw, 12px);
    margin-block: clamp(10px, 2vw, 20px);
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 1rem);
    color: var(--color-gray-500);
}

.breadcrumbs > .container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

.breadcrumbs ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
    padding: 0;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
}

.breadcrumbs li:after {
    content: "›";
    margin-inline-start: 5px;
    color: var(--color-gray-400);
}

.breadcrumbs li:last-child:after {
    content: "";
}

.breadcrumbs a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-normal);
}

.breadcrumbs a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.breadcrumbs .current-item {
    color: var(--color-gray-600);
}

/* --------------------
   Main
-------------------- */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: var(--container-padding);
    box-sizing: border-box; /* Assicura che il padding non si aggiunga alla width */
}

.container-narrow {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* --------------------
   Footer
-------------------- */
.custom-footer {
    background: var(--surface-footer);
    color: var(--color-white);
    padding: 3rem 0;
    margin-top: auto;
}

.footer-container {
    display: grid;
    grid-template-areas:
        "about about"
        "cert cert"
        "links links"
        "social social"
        "copyright copyright";
    grid-template-columns: repeat(2, 1fr);
    gap: var(--footer-gap);
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.about-col { 
    grid-area: about; 
}

.links-col { 
    grid-area: links; 
}

.cert-col { 
    grid-area: cert; 
}

.social-col {
    grid-area: social;
}

.copyright { 
    grid-area: copyright; 
}

/* Footer Columns */
.footer-col {
    display: flex;
    flex-direction: column;
    gap: var(--footer-section-margin);
    text-align: center;
}

.footer-section {
    margin-bottom: var(--footer-section-margin);
}

.footer-col h3 {
    color: var(--color-accent-lighter) !important;
    font-size: var(--footer-heading-size);
    font-weight: 600;
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: var(--footer-section-margin);
}

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 40px;
    height: 2px;
    background: var(--color-accent);
    transform: translateX(-50%);
}

.footer-content {
    line-height: var(--line-height-normal);
}

/* Link Utili (menu Footer) */
.custom-footer .footer-link{
    color: var(--footer-link);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-thickness: .08em;
    text-decoration-skip-ink: auto;
    transition: color .15s ease, text-decoration-color .15s ease;
    display: inline-block;
    position: relative;
}

.custom-footer .footer-link:is(:hover, :focus-visible){
    color: var(--footer-link-hover);
    text-decoration-color: currentColor;
}

.custom-footer .footer-link:active{
    color: var(--footer-link-active);
    opacity: .95; /* micro feedback "pressed" */
}

.custom-footer .footer-link:visited{
    color: var(--footer-link-visited);
}

.footer-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-accent-light);
    transition: width var(--transition-normal);
}

.footer-link:hover::after {
    width: 100%;
}

/* Link della pagina corrente nel footer (se presente) */
.custom-footer .footer-link[aria-current="page"],
.custom-footer .current-menu-item > a.footer-link{
    color: var(--footer-link-active);
    font-weight: 600;
    text-decoration-thickness: .12em;
}

/* Focus davvero visibile (WCAG) */
.custom-footer .footer-link:focus-visible{
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: .25rem; /* evita “box” spigolosi */
}

.footer-link-base {
    transition: color var(--transition-normal);
}

/* Contact links */
.footer-contact .footer-link-base {
    color: var(--color-accent-light);
}

.footer-contact .footer-link-base:hover {
    color: var(--color-accent-lighter);
    text-decoration: underline;
}

.footer-links {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a{
    text-decoration: none;
}

/* Certificazioni */
.certifications {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    justify-items: center;
    width: 100%;
}

.cert-image {
    max-height: 50px; 
    width: auto;
    display: block;
    filter: grayscale(80%) opacity(0.7); 
    transition: all 0.3s ease;
}

.cert-image:hover,
.cert-wrapper:hover .cert-image { /* Applica l'effetto anche se si passa sul wrapper */
    filter: grayscale(0%) opacity(1);
    transform: scale(1.05); 
}

/* Eliminiamo effetti che potrebbero dare problemi su iOS */
@supports (-webkit-touch-callout: none) {
   .cert-image { transition: 
        none;
    }
    .cert-image:hover { 
        transform: none; 
    }
}

.cert-wrapper .cert-image {
    max-width: 100px;
}

/* Certificazioni con tooltip */
.cert-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0.5rem;
    position: relative;
}

.cert-wrapper .tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-gray-700);
    color: white;
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    z-index: 1000;
}

.cert-wrapper:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Freccia del tooltip */
.cert-wrapper .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--color-gray-700) transparent transparent transparent;
}

.social-group {
    margin-bottom: 1.5rem; /* Aggiunge spazio tra i due gruppi */
}
.social-group:last-child {
    margin-bottom: 0;
}
.social-group h4 {
  color: var(--color-accent-lighter) !important;
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 1rem;
  position: static;
  padding-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.social-group h4::after { 
    display: none; 
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.social-icons .footer-link-base {
    color: var(--color-gray-400);
}

.social-icons .footer-link{
    color: var(--color-primary);
}

.social-icons i {
    font-size: 24px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-icons .fa{
    font-size: 24px;
}

/* Icona personalizzata per Flickr */
.flickr-icon {
    display: inline-block;
    position: relative;
    width: 24px;
    height: 24px;
}

.flickr-icon:before,
.flickr-icon:after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    top: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

.flickr-icon:before {
    left: 4px;
}

.flickr-icon:after {
    right: 4px;
}

/* Copyright */
.copyright {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-gray-200);
    font-size: var(--font-size-sm);
    
}

.copyright p{
    color: var(--color-gray-50) !important;
}

/* --------------------
   Media Queries
-------------------- */
@media screen and (min-width: 768px) {
    /* Nascondi il pulsante del menu su desktop */
    .custom-header .menu-toggle {
        display: none !important;
    }

    /* Rendi la navigazione sempre visibile e ripristina il layout */
    body .custom-header #main-menu,
    body .custom-header #main-menu.active { /* Applica a entrambi gli stati */
        display: block !important;
        position: static;
        width: auto;
        background: none;
        box-shadow: none;
        border-top: none;
    }

    /* Imposta la direzione orizzontale per i link */
    .custom-header .nav-links {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .custom-header .nav-links a {
        padding: 5px 10px;
        border-bottom: none;
    }

    .footer-container {
        grid-template-areas:
            "about links"
            "cert social"
            "copyright copyright";
        gap: 30px 20px;
    }

    .footer-col {
        text-align: left;
    }

    .footer-col h3::after {
        left: 0;
        transform: none;
    }

    .footer-links {
        align-items: flex-start;
    }

    .social-icons {
        justify-content: flex-start;
    }
}

@media screen and (max-width: 782px) {  /* WP breakpoint admin bar */
  body.admin-bar .custom-header { 
        top: 46px; 
    }
}

@media screen and (min-width: 1024px){
    .footer-container {
        grid-template-areas:
            "about links cert social"
            "copyright copyright copyright copyright";
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: var(--footer-gap);
    }

    .social-col {
        text-align: center;
        justify-self: center; 
    }

    .social-col .social-icons {
        justify-content: center; 
    }

    .social-col h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Media query specifica per iPhone SE e schermi piccoli */
@media screen and (max-width: 375px) {
    /* Riduco leggermente le dimensioni per adattarsi a schermi molto piccoli */
    html {
        font-size: 15px;
    }

    .container, .container-narrow {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Rendere le certificazioni più piccole su schermi molto piccoli */
    .certifications {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .social-icons {
        gap: 0.5rem;
    }
}

/* Punto di media query per rimuovere outline su dispositivi con input preciso */
@media (pointer: fine) {
    .menu-toggle:focus:not(:focus-visible) {
        outline: none;
    }
}

@media (prefers-reduced-motion: reduce){
     .custom-footer .footer-link{ 
        transition: none; 
    }
}
@media (forced-colors: active){
    .custom-footer .footer-link{ 
        text-decoration: underline;
    }

    .custom-footer .footer-link:focus-visible{
        outline: 2px solid; 
        box-shadow: none; 
    }
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    body, .custom-header {
        background-color: var(--surface-body) !important;
    }

    .custom-header .nav-links a { 
        color: var(--color-gray-300); 
    }

    .custom-header .nav-links a:hover,
    .custom-header .nav-links a.active,
    .custom-header .nav-links .current-menu-item > a {
        color: var(--color-accent-light);
    }

    .custom-header .menu-toggle {
        background-color: var(--color-gray-600);
        color: var(--color-gray-100);
    }
}