/* Estils generals per als articles (Custom Post Type 'articles') */
.single-articles,
.section-content {
    max-width: 880px;
    margin: 2.5rem auto 0 auto;
    /*padding: 0 1rem;*/
}

.single-articles .entry-header {
    margin-bottom: 1.5rem;
}

.single-articles .entry-header {
    position: relative;
    width: 100vw;
    left: 50%;
    margin-left: -50vw;
    right: 50%;
    margin-right: -50vw;
}

.author-avatar-svg {
    width: 75%;
    margin: auto;
}
.author-avatar-desktop { display: block; }
.author-avatar-mobile { display: none; }
.author-avatar-mobile img { max-width: 100%; height: auto; display: block; }

.single-articles .entry-title {
    font-family: 'Gordita', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    font-size: 2rem;
    line-height: 1.15;
    margin: 0 0 0.5rem 0;
}

.single-articles .cut-title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    line-height: 1.2;
}


.single-articles .entry-meta {
    color: var(--muted, #6c757d);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.single-articles .post-thumbnail {
    margin: 1rem 0;
}

.single-articles .entry-content {
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text-color, #222);
}

/* =========================
   AFEGIT: Regles sol·licitades
   ========================= */

/* Tipografia general per als articles */
.single-articles,
.single-articles * {
    font-family: 'Gordita', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

/* Variables per al sistem de columnes (12 cols) utilitzades per fer offsets */
.single-articles {
    --article-max-width: 880px;
    /* ha d'estar sincronitzat amb .single-articles max-width */
    --col: calc(var(--article-max-width) / 12);
}

/* Títol principal: 40px, Black, color #2f798f */
.single-articles .entry-title {
    font-size: 40px;
    font-weight: 900;
    /* Black */
    color: #2f798f;
    line-height: 1.05;
}

/* Autor: Regular 20px */
.single-articles .entry-meta .byline,
.single-articles .entry-meta .author,
.single-articles .entry-meta {
    font-size: 20px;
    font-weight: 400;
    /* Regular */
    color: var(--muted, #6c757d);
}

/* Anotacions: estil específic amb bordes discontinues superior i inferior */
.single-articles .annotation,
.single-articles .anotacio,
.single-articles .note-annotation {
    font-weight: 900;
    /* Black */
    font-size: 30px;
    line-height: 36px;
    padding: 50px 0;
    margin: 50px 0;
    color: #2f798f;
    border-top: 2px dotted #2f798f;
    border-bottom: 2px dotted #2f798f;
    text-align: center;
}

.single-articles .annotation {
    max-width: 75%;
    margin-left: auto;
    margin-right: auto;
}

/* Imatges parallax amb descripció inferior alineada a la dreta */
.single-articles .parallax-image {
    position: relative;
    overflow: hidden;
}

.single-articles .parallax-image img {
    width: 100%;
    height: auto;
    display: block;
    /* object-fit i transform per simular lleu parallax si cal */
}

/* Parallax specific: contenidor amb alçada definida i imatge absolutada per moure-la
   .parallax-img s'ha d'afegir a l'element <img> (ja es fa des de la plantilla PHP)
*/
.single-articles .parallax-image {
    /* Full-bleed: fer que la imatge surti del contenidor i ocupi l'amplada de la finestra */
    position: relative;
    width: 100vw;
    left: 50%;
    margin-left: -50vw;
    right: 50%;
    margin-right: -50vw;
    height: 100vh;
    /* ajustar segons disseny */
    overflow: hidden;
    z-index: 0;
}


/* Imatge de base per al parallax: ancorada a dalt */
.single-articles .parallax-image img.parallax-img {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    /* punt de partida: des de dalt */
    width: 100%;
    min-height: 115%;
    /* pots ajustar 110–120 segons el gust */
    object-fit: cover;
    will-change: transform;
}


/* Caption offset a la dreta: si vols que el text de la caption comenci 1.5 columnes a la dreta del centre */
.single-articles .parallax-image .parallax-caption--right-offset {
    position: absolute;
    bottom: 18px;
    /* començar a 50vw (centre de la finestra) + 1.5 columnes a la dreta */
    left: calc(50vw + calc(var(--col) * 1.5));
    max-width: calc(var(--article-max-width) / 3);
    text-align: right;
    color: var(--muted, #666);
    font-size: 16px;
    line-height: 1.25;
    padding: 0 1rem;
}

/* Fallback: caption fora del figure segueix sent alineada a la dreta dins del flux */
.single-articles .parallax-caption {
    /* Full-bleed: fer que la imatge surti del contenidor i ocupi l'amplada de la finestra */
    position: relative;
    width: 100vw;
    left: 50%;
    margin-left: -50vw;
    right: 50%;
    margin-right: -50vw;
}

.single-articles .parallax-caption-text {
    text-align: right;
    width: 75%;
    margin: auto;
}

/* Evitar overflow horitzontal per elements full-bleed en contenidors amb padding */
body {
    overflow-x: hidden;
}

.single-articles .parallax-caption-text {
    text-align: right;
    font-size: 16px;
    /* descripció regular 16px */
    color: var(--muted, #666);
    margin-top: 0.5rem;
}

.single-articles .parallax-caption-text .author {
    display: block;
    font-weight: 700;
    /* bold per l'autor */
    font-size: 16px;
    /*margin-top: 12px;*/
}

/* Títol de gràfiques: Black 21px #3395af */
.single-articles .graph-title {
    font-weight: 900;
    font-size: 21px;
    color: #3395af;
    margin-bottom: 0;
}

.single-articles .font-graph {
    font-size: 14px;
    color: #666;
}

/* Subtítol gràfiques: Negre 20px */
.single-articles .graph-subtitle {
    font-weight: 900;
    font-size: 20px;
    color: #000;
}

.single-articles .graph-subtitle-light {
    font-weight: 400;
    font-size: 1.05rem;
}

/* Popup informatiu: Regular 16px */
.single-articles .info-popup,
.single-articles .popup-info {
    font-size: 16px;
    font-weight: 400;
}

/* Section amb bg blau (rgba #3395af 15%) i text medium 21px #3395af */
.single-articles .blue-section {
    background-color: #e2eff3;
    padding: 1.25rem;
    border-radius: 6px;
}

.single-articles .blue-section * {
    color: #3395af;
    font-weight: 600;
}

.single-articles .blue-section p {
    font-size: 21px;
}

.single-articles .blue-section .credits {
    font-size: 16px;
    font-weight: 400;
}

.single-articles .blue-section .section-title {
    font-size: 21px;
    font-weight: 900;
    /* black */
}

/* Accessibilitat i petites remarcacions */
.single-articles .entry-content p {
    margin-bottom: 1rem;
}

.single-articles .img-border-rounded {
    border-radius: 12px;

}
/* Responsive */
@media (min-width: 992px) {
    .single-articles {
        padding: 0;
    }
}


/* grafics  */
.grafic-offset {
    /* Full-bleed: fer que la imatge surti del contenidor i ocupi l'amplada de la finestra */
    position: relative;
    width: 100vw;
    left: 50%;
    margin-left: -50vw;
    right: 50%;
    margin-right: -50vw;
}

.grafic-offset .grafic-content {
    width: 75%;
    margin: auto;
}

/* mapa iframe */
.map-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    z-index: 10;
    opacity: 1;
    /* visible per defecte */
    transition: opacity 0.25s ease;
    pointer-events: auto;
    /* interactuable quan visible */
    text-shadow: 2px 2px 2px #000;
}

.map-overlay.hidden {
    opacity: 0;
    /* fade-out */
    pointer-events: none;
    /* no bloqueja clics quan està oculta */
}

.map-hint {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.55);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}

.map-hint.visible {
    opacity: 1;
}

.map-esc {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 15;
}

.map-esc.visible {
    opacity: 1;
    pointer-events: auto;
}

#ozo-maxim-mitjanes-horaries-chart {
    height: calc(100% - 60px) !important;
}

.chart-parche {
    bottom: 60px;
    right: 0;
    height: 150px;
    width: 100%;
}

.nombre-dies-ozo-chart-container {
    padding: 0 100px;
    max-width: 500px;
}

.origen-particules-suspensio-chart-container {
    width: 80vw;
    max-width: 800px;
}

#origen-particules-suspensio-chart {
    width: 100% !important;
    height: auto;
}

/* ús estils

Afegir una anotació: <div class="annotation">Text de l'anotació</div>
Parallax image: <div class="parallax-image"><img src="..."><div class="parallax-caption">Descripció<br><span class="author">Autor</span></div></div>
Gràfica: <h3 class="graph-title">Títol</h3><p class="graph-subtitle">Subtítol</p>
Popup: <div class="info-popup">Missatge informatiu</div>
Blue section: <section class="blue-section"><h3 class="section-title">Títol secció</h3></section>

*/

/* Article navigation (prev / divider / next) */
.article-nav {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.article-nav a.article-nav-prev,
.article-nav a.article-nav-next {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    flex: 0 0 auto;
}

.article-nav .title-small {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.article-nav-divider {
    flex: 1 1 auto;
    height: 2px;
    margin: 0 1rem;
    border-top: none;
    /* Elimina el border original */
    background-image: linear-gradient(to right, rgba(102, 154, 182, 0.5) 50%, transparent 50%);
    background-position: top;
    background-repeat: repeat-x;
    background-size: 20px 2px;

}

.article-nav img {
    display: block;
}

.article-nav-arrow-rotated {
    transform: rotate(180deg);
}

/* Anchor sanitization: ensure anchors have a fixed height and vertical alignment */
.article-nav a {
    align-items: center;
    padding: 10px 0;
    min-height: 62px;
}

/* Icon circle */
/*.article-nav-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(51,149,175,0.05);
    flex: 0 0 48px;
}*/
.article-nav-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.article-nav .article-nav-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-nav .article-nav-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}

.img-graph-max {
    width: 100%;
    height: auto;
    max-width: 1080px;
}

@media (max-width: 767px) {
    .article-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    /*.section-content {
        padding: 0 1rem;
    }*/

    .article-nav-divider {
        width: 100%;
        height: 2px;
        border-top: none;
        /* Elimina el border original */
        background-image: linear-gradient(to right, rgba(102, 154, 182, 0.5) 50%, transparent 50%);
        background-position: top;
        background-repeat: repeat-x;
        background-size: 20px 2px;
        /* La separació entre traços és 36px */

        margin: 0;
    }

    .article-nav a.article-nav-prev,
    .article-nav a.article-nav-next {
        justify-content: flex-start;
    }

    .single-articles .annotation,
    .single-articles .anotacio,
    .single-articles .note-annotation {
        font-size: 18px;
        line-height: 20px;
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;

    }

    .single-articles .entry-title {
        font-size: 26px;
    }

    /* Mobile: swap author avatar */
    .author-avatar-desktop { display: none !important; }
    .author-avatar-mobile { display: block; width: 100%; }
    .author-avatar-mobile img { width: 100%; height: auto; display: block; }

    /* Mobile adjustments for parallax images: smaller height and centered image to ensure full coverage */
    .single-articles .parallax-image {
        height: 50vh;
    }

    .single-articles .parallax-image img.parallax-img {
        top: 50%;
        transform: translateY(-50%);
        min-height: 120%;
        object-position: center;
        -webkit-transform: translateY(-50%);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    /* New: convert parallax images to fixed background on non-iOS mobiles
       - We set background on the container and hide the <img>
       - Background-attachment: fixed provides a native, performant parallax-like effect
       - For iOS (which handles fixed poorly) the JS will avoid this and keep the transform parallax
    */
    .single-articles .parallax-image.parallax-bg-fixed {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: fixed;
        height: 50vh;
    }

    /* Curved layout: apply bg-fixed on the curved container (JS targets .curved-bottom) */
    .single-articles .curved-bottom.parallax-bg-fixed {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: fixed;
    }

    /* iOS (iPhone): Safari gestiona malament background-attachment: fixed.
       Manté la mateixa imatge i layout, però amb attachment estable.
       Detectem iOS via feature query webkit.
    */
    @supports (-webkit-touch-callout: none) {
        .single-articles .parallax-image.parallax-bg-fixed,
        .single-articles .curved-bottom.parallax-bg-fixed {
            background-attachment: scroll;
        }
    }

    /* Inside curved, avoid full-bleed offsets on mobile */
    .single-articles .curved-bottom .parallax-image {
        width: 100%;
        left: auto;
        right: auto;
        margin-left: 0;
        margin-right: 0;
        height: 100%;
    }

    .single-articles .parallax-image.parallax-bg-fixed img {
        display: none !important;
    }

    .un-paisatge-de-pessebre .nombre-dies-ozo-chart-container {
        padding: 0;
    }

    .single-articles.un-paisatge-de-pessebre .grafic-offset {
        max-width: 100%;
    }
    
    .single-articles.un-paisatge-de-pessebre .grafic-offset .grafic-content{
        width: 100%;
        margin: auto 0;
    }

    .single-articles.un-paisatge-de-pessebre .grafic-offset {
        margin-left: 0;
        margin-right: 0;
        left: 0;
        right: 0;
    }

    .single-articles.un-paisatge-de-pessebre .full-section {
        left: -1rem;
        right: 0;
        margin-left: 0;
        margin-right: 0;
    }

}