/*
Theme Name: Osona 2024
Description: Plantilla moderna per Osona 2024 amb home full-screen i scroll snapping
Author: Marc Costa
Version: 2.5
*/

/* Reset bàsic */
/* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
    */

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

body, h1, h2, h3, h4, p, a, button, select {
    font-family: 'Gordita', var(--font-family-base);
    line-height: 1.6;
    color: #333;
    /*overflow-x: hidden;*/
}

h1, h2, h3, h4 {
    font-weight: 700;
}

.btn, select {
  font-family: 'Gordita', var(--font-family-base);
  font-size: 16px;
  font-weight: normal;
}

.bg-blue {
    background-color: #e2eff3 !important;
}

.mb-100 {
    margin-bottom: 100px !important;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
#masthead,
.site-header {
    background: #fff;
    border: none;
    /*border-bottom: 1px solid #eee;*/
    /*padding: 1rem 0;*/
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(-100%) !important;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    will-change: transform, opacity;
    opacity: 0 !important;
    visibility: hidden !important;
    height: auto;
    overflow: hidden;
}

/* Header visible quan s'ha fet scroll */
#masthead.header--visible,
.site-header.header--visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Assegurar que el contingut no quedi amagat pel header fixed */
body.admin-bar #masthead,
body.admin-bar .site-header {
    top: 32px; /* WordPress admin bar offset */
}

@media screen and (max-width: 782px) {
    body.admin-bar #masthead,
    body.admin-bar .site-header {
        top: 46px; /* WordPress admin bar offset en móvil */
    }
}

.site-title {
    font-size: 2rem;
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

/* Navigation */
nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

nav a {
    text-decoration: none;
    color: #666;
    font-weight: 500;
}

nav a:hover {
    color: #333;
}

/* Main content */
main {
    padding: 2rem 0;
    min-height: 60vh;
}

/* Articles */
article {
    /*margin-bottom: 2rem;*/
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.entry-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.entry-title a {
    text-decoration: none;
    color: #333;
}

.entry-title a:hover {
    color: #666;
}

.entry-meta {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.entry-content {
    line-height: 1.8;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 2rem 0;
    text-align: center;
    color: #666;
}

/* Utility classes */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Focus styles per accessibilitat */
*:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    nav ul {
        flex-direction: column;
        gap: 1rem;
    }
    
    .site-title {
        font-size: 1.5rem;
    }

    /* Disable scroll snapping on small screens to allow free scrolling and avoid jumping */
    html { scroll-snap-type: none; }
}

/* Suport per preferències d'accessibilitat */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
        scroll-snap-type: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Hero full-screen: punt de scroll-snap inicial */
.hero--fullscreen {
    height: 100vh;
    min-height: 520px;
    display: block;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* Fer que el següent contingut (#content) sigui el punt de destinació del snap */
#content {
    scroll-snap-align: start;
}

/* Desktop override: relax scroll snapping so users can scroll freely through content and reach the footer */
@media (min-width: 1024px) {
    /* Use 'proximity' so snapping is less aggressive on desktop */
    html { scroll-snap-type: y proximity; }

    /* Avoid forcing an uninterruptible snap stop on the hero */
    .hero--fullscreen { scroll-snap-stop: normal; }

    /* Do not make #content a snap target — allow continuous scroll once in content */
    #content { scroll-snap-align: none; }
} 

/* Petits ajustos: assegurar transició suau del header quan apareix */
#masthead.header--visible,
.site-header.header--visible {
    transition: transform 0.28s ease-in-out, opacity 0.2s ease-in-out;
}

/* Print styles */
@media print {
    html {
        scroll-snap-type: none;
    }
}