
/* ========================================
   TEMPLATES CSS - Prototype Styles
   ======================================== */

/* --- COMMON HERO STYLES --- */
html {
    scroll-padding-top: 0 !important; /* Reset global scroll padding for templates pages to prevent double offset */
}

.page-hero {
    position: relative;
    height: 40vh;
    min-height: 450px; /* Increased from 350px to accommodate longer titles */
    padding-top: 130px; /* Accounts for header height to prevent overlap */
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

/* Override #hero styles from style.css when used with .page-hero */
#hero.page-hero {
    min-height: 350px;
    height: 40vh;
    padding: 130px 0 0 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Overlay */
}

.page-hero__content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 20px;
}

.page-hero__title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.4;
    padding-bottom: 20px; /* Extra space for descenders to prevent cutting off */
}

.page-hero__subtitle {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 300;
}

/* --- TEMPLATE A: CLASSIC (Sidebar) --- */
.classic-layout {
    padding: 60px 0;
}

.classic-sidebar {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    position: sticky;
    top: 100px; /* Sticky below header */
}

/* Added to match santacaterina.html structure */
.classic-sidebar__card {
    margin-bottom: 30px;
}

.classic-sidebar__title {
    font-size: 1.2rem;
    border-bottom: 2px solid var(--alife-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-family: var(--font-heading);
    font-weight: 700;
}

.classic-sidebar__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.classic-sidebar__list li {
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #555;
    display: flex; /* Allow icon alignment if used */
    gap: 10px;
}

.classic-sidebar h3 {
    font-size: 1.2rem;
    border-bottom: 2px solid var(--alife-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.classic-info-list li {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.95rem;
    color: #555;
}

.classic-info-list i {
    color: var(--alife-primary);
    margin-top: 4px;
}

.classic-content h2 {
    color: var(--alife-dark);
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.classic-content h2:first-child {
    margin-top: 0;
}

.classic-content p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    color: #444;
}

.classic-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.classic-gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.classic-gallery img:hover {
    transform: scale(1.03);
}

/* --- TEMPLATE B: VISUAL (Masonry/Immersive) --- */
.visual-hero {
    height: 80vh; /* Taller hero */
}

.visual-intro {
    text-align: center;
    padding: 80px 20px;
    max-width: 900px;
    margin: 0 auto;
}

.visual-intro h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--alife-dark);
}

.visual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0; /* Seamless */
}

.visual-item {
    position: relative;
    height: 500px;
    overflow: hidden;
    group: hover;
}

.visual-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.visual-item:hover img {
    transform: scale(1.1);
}

.visual-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    transform: translateY(20px);
    opacity: 0.9;
    transition: all 0.4s ease;
}

.visual-item:hover .visual-overlay {
    transform: translateY(0);
    opacity: 1;
}

.visual-item h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: white;
}

/* --- TEMPLATE C: MODERN (Scrollytelling) --- */
.modern-nav {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    position: sticky;
    top: 70px;
    z-index: 900;
    text-align: center;
}

/* Quando nav è sticky (dopo scroll), modern-nav si attacca direttamente sotto */
body.nav-is-sticky .modern-nav {
    top: 60px; /* Altezza nav-bar sticky - fallback se JS non imposta il valore */
}

/* Variant con container (criptoportico, etc.) */
.modern-nav__container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-container-padding-desktop);
    text-align: center; /* Centra la lista inline-flex */
}

.modern-nav__list {
    display: inline-flex;
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
    justify-content: center; /* Centra gli elementi */
}

.modern-nav ul {
    display: inline-flex;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.modern-nav a {
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.9rem;
    color: #888;
    padding-bottom: 5px;
}

.modern-nav a:hover, .modern-nav a.active {
    color: var(--alife-primary);
    border-bottom: 2px solid var(--alife-primary);
}

.modern-section {
    padding: 80px 0;
    width: 100%;
    scroll-margin-top: 120px !important; /* Topbar (50px) + Modern-nav (70px) + piccolo margine */
}

.modern-section:nth-child(even) {
    background-color: #f8f9fa;
}

/* Wrapper for content to match topbar width */
.modern-wrapper {
    display: flex;
    align-items: center;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-container-padding-desktop);
    gap: 60px;
}

.modern-section:nth-child(even) .modern-wrapper {
    flex-direction: row-reverse;
}

.modern-text {
    flex: 1;
    padding: 0;
    overflow: visible !important;
}

.modern-image {
    flex: 1;
    height: 400px; /* Reduced height by ~50% (was 80vh) */
}

/* When modern-image IS a gallery-container, ensure proper height */
.modern-image.gallery-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

/* Apply styles only to direct images (not gallery images) */
.modern-image > img,
.modern-image > .portfolio-item > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px; /* Soften edges */
}

.modern-text h2 {
    font-family: 'Montserrat', var(--font-heading); /* Montserrat instead of Syne to fix clipping issue */
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 45px;
    position: relative;
    padding-top: 15px; /* Reduced padding - not needed with Montserrat */
    padding-bottom: 40px;
    line-height: 1.6; /* Normal line-height - Montserrat has proper metrics */
}

.modern-text h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background-color: var(--alife-primary);
}

/* --- INFO GRID SECTION (Added for Modern Template) --- */
.info-grid-section {
    padding: 80px 0;
    background-color: #fff;
}

.info-card {
    background: #f8f9fa;
    padding: 40px 30px;
    border-radius: 8px;
    text-align: center;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.info-card__icon {
    font-size: 2.5rem;
    color: var(--alife-primary);
    margin-bottom: 20px;
}

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--alife-dark);
    font-family: 'Montserrat', sans-serif; /* Montserrat has proper descender metrics */
    line-height: 1.6; /* Increased line-height to prevent descender clipping */
    padding-bottom: 5px; /* Extra space for descenders like 'g', 'y', 'p', 'q' */
}

.info-card p {
    color: #666;
    margin: 0;
}

/* Tablet (768px - 992px) */
@media (max-width: 992px) {
    .modern-wrapper {
        gap: 40px;
        padding: 0 var(--spacing-container-padding-tablet);
    }

    /* Modern-nav sticky - nav-bar circa 55-60px */
    .modern-nav {
        top: 55px;
        z-index: 900;
    }

    .modern-section {
        scroll-margin-top: 110px !important;
    }
}

/* Mobile (sotto 768px) - portrait e landscape */
@media (max-width: 767px) {
    .visual-grid { grid-template-columns: 1fr; }

    .modern-wrapper,
    .modern-section:nth-child(even) .modern-wrapper {
        flex-direction: column;
        text-align: center;
        padding: 0 var(--spacing-container-padding-mobile);
    }

    .modern-text h2::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .modern-image {
        flex: 0 0 auto;
        height: 300px;
        width: 100%;
    }

    /* Mobile Hero Adjustments */
    .page-hero {
        min-height: 400px;
        padding-top: 100px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .page-hero__title {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    .page-hero__subtitle {
        font-size: 1rem;
    }

    /* Modern-nav sticky per mobile - fallback se JS non imposta il top */
    /* Il valore top viene impostato dinamicamente da sticky-header.js */
    .modern-nav {
        top: 55px; /* Fallback - valore reale impostato via JS */
        padding: 8px 0;
        z-index: 900;
    }

    .modern-nav ul,
    .modern-nav__list {
        gap: 15px;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 15px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .modern-nav ul::-webkit-scrollbar,
    .modern-nav__list::-webkit-scrollbar {
        display: none;
    }

    .modern-nav a {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .modern-nav__container {
        padding: 0 10px;
        text-align: center;
    }

    .modern-nav__list {
        justify-content: center;
    }

    .modern-section {
        scroll-margin-top: 95px !important;
    }
}

/* Landscape mobile - navbar ancora più compatta */
@media (max-height: 500px) and (orientation: landscape) {
    .modern-nav {
        top: 40px; /* Fallback - valore reale impostato via JS */
        padding: 5px 0;
        z-index: 900;
    }

    .nav-bar__content {
        padding: 6px 0 !important;
    }

    .nav-bar__hamburger {
        display: flex !important;
    }

    .modern-section {
        scroll-margin-top: 70px !important;
    }
}

/* Landscape mobile alto (es. 360x800) - navbar compatta ma non troppo */
@media (max-width: 767px) and (min-height: 501px) and (max-height: 900px) and (orientation: landscape) {
    .modern-nav {
        top: 50px; /* Fallback - valore reale impostato via JS */
        padding: 6px 0;
        z-index: 900;
    }

    .modern-section {
        scroll-margin-top: 80px !important;
    }
}

/* Share divider — tra </main> e <footer> */
.share-divider {
    background: #f8f9fa;
    border-top: 1px solid #eee;
    padding: 20px 0;
}
.share-divider__inner {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-container-padding-desktop);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.share-divider__label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.share-divider__buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}
.share-divider__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}
.share-divider__btn:hover {
    background: rgb(241, 126, 24);
    color: #fff;
}
@media (max-width: 767px) {
    .share-divider__inner {
        flex-direction: column;
        gap: 10px;
    }
}

/* ── Guida & Cartina — Download Card ── */
.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.download-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.download-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 36px rgba(0,0,0,0.16);
}

.download-card__preview {
    position: relative;
    background: #f5f5f0;
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Link e immagine di anteprima — coprono l'intero preview */
.download-card__preview a {
    display: block;
    width: 100%;
    height: 100%;
}
.download-card__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.download-card__preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #f5f5f0;
}

.download-card__preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f5f0;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #888;
    pointer-events: none;
    z-index: 0;
}
.download-card__preview-loading i {
    font-size: 2.5rem;
    color: #c8a44a;
}

.download-card__preview-overlay {
    display: none;
}

.download-card__badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: #c8a44a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 20px;
}

.download-card__body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.download-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.download-card__desc {
    font-size: 0.9rem;
    color: #555;
    margin: 0;
    flex: 1;
}

.download-card__meta {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: #888;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #c8a44a;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s ease;
    align-self: flex-start;
}
.download-btn:hover {
    background: #a8832e;
    color: #fff;
}

.download-note {
    background: #f8f4ec;
    border-left: 4px solid #c8a44a;
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.88rem;
    color: #555;
    margin-top: 2.5rem;
}
.download-note a {
    color: #a8832e;
}

/* --- GEO Answer Block --- */
.geo-answer-block {
    background: #f9f7f2;
    border-left: 4px solid #c8a44a;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem auto 0;
    max-width: 960px;
    font-family: 'Niramit', sans-serif;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #2d2d2d;
}
.geo-answer-block p {
    margin: 0;
}
@media (max-width: 768px) {
    .geo-answer-block {
        padding: 1rem 1.1rem;
        font-size: 0.97rem;
    }
}
