/* ==========================================================================
   1. RESET & BASE STYLES
   ========================================================================== */
html {
    overflow-y: scroll; /* Forza la barra di scorrimento per evitare lo scatto dell'header */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f4f4f9;
    color: #1e293b;
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    font-size: 1.05rem;
}

a {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.2s;
}

/* ==========================================================================
	Hover sul titolo diventa amaranto
a:hover {
    color: #6b1724;
}
   ========================================================================== */
   
/* ==========================================================================
   2. HEADER & DESKTOP NAVIGATION
   ========================================================================== */
.header-wrapper {
    position: relative;
    width: 100%;
    height: 165px; 
}

header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    background-color: #0f172a;
    background-size: cover;
    background-position: center;
    color: #ffffff;
    padding: 18px 0 14px 0;
    border-bottom: 4px solid #6b1724;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.brand-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    transition: margin-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
    font-size: 1.9rem;
    font-weight: normal;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: font-size 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subtitle {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 3px;
    max-height: 30px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease;
}

.nav-menu {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 12px;
    transition: padding-top 0.3s ease;
}

.nav-menu ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: #f1f5f9;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 3px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-menu a.active {
    background-color: #6b1724;
    color: #ffffff;
}

.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    padding: 0;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #ffffff;
    border-radius: 2px;
}

header.scrolled {
    padding: 8px 0 8px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

header.scrolled .brand-container {
    margin-bottom: 6px;
}

header.scrolled .logo {
    font-size: 1.45rem;
}

header.scrolled .subtitle {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

header.scrolled .nav-menu {
    padding-top: 6px;
}

/* ==========================================================================
   3. LAYOUT PRINCIPALE & CONTENUTI
   ========================================================================== */
.layout {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.search-box {
    max-width: 1100px;
    margin: 2.5rem auto 0 auto;
    padding: 0 20px;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 1rem;
    font-family: system-ui, -apple-system, sans-serif;
}

.search-button {
    background: #6b1724;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: bold;
}

.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 1.8rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.post-title { font-size: 1.6rem; margin-bottom: 0.5rem; }
.post-subtitle { font-size: 1.05rem; color: #64748b; font-style: italic; margin-bottom: 0.8rem; }
.post-meta { font-family: system-ui, -apple-system, sans-serif; font-size: 0.85rem; color: #64748b; margin-bottom: 1rem; }
.post-category { background: #f1f5f9; padding: 0.2rem 0.5rem; border-radius: 3px; font-weight: bold; color: #0f172a; font-family: system-ui, -apple-system, sans-serif; font-size: 0.8rem; }

.verse-box {
    background: #fdf8f0;
    border-left: 4px solid #b45309;
    padding: 1rem 1.2rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #78350f;
}

.sidebar-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
}

.sidebar-widget h3 {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.05rem;
    border-bottom: 2px solid #6b1724;
    padding-bottom: 0.4rem;
    margin-bottom: 1rem;
    color: #0f172a;
}

.footer {
    background: #0f172a;
    color: #cbd5e1;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    border-top: 4px solid #6b1724;
}

/* ==========================================================================
   4. MEDIA QUERIES (UNICO BLOCCO MOBILE - fino a 768px)
   ========================================================================== */
@media (max-width: 768px) {
    
    .header-wrapper {
        height: auto;
    }

    header, header.scrolled {
        position: relative;
        padding: 12px 0;
    }

    .brand-container {
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Titolo ridotto su una sola riga */
    .logo, header.scrolled .logo {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        line-height: 1.2;
    }

    /* Sottotitolo nascosto su smartphone */
    .subtitle, header.scrolled .subtitle {
        display: none !important;
    }

    /* Hamburger visibile */
    .hamburger-btn {
        display: flex;
        flex-shrink: 0;
    }

    /* Menu dropdown mobile */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #0f172a;
        padding: 15px 20px;
        border-bottom: 4px solid #6b1724;
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
        z-index: 1001;
    }

    .nav-menu.active {
        display: block;
    }

    .nav-menu ul {
        flex-direction: column;
        gap: 8px;
    }

    .nav-menu a {
        display: block;
        text-align: center;
        padding: 10px;
        background: rgba(255, 255, 255, 0.05);
    }

    /* Modulo ricerca e Layout mobile */
    .layout {
        grid-template-columns: 1fr;
        margin-top: 1rem;
    }

    .search-box {
        margin-top: 1.2rem;
        padding: 0 15px;
    }
}