
:root {
    --brown: #3d2213;
    --brown-2: #5f3820;
    --gold: #c98434;
    --cream: #fcf8f1;
    --soft: #f3ece2;
    --text: #2a2118;
    --muted: #72655a;
    --line: #e7dccf;
    --green: #dcefe3;
    --green-text: #236b47;
    --shadow: 0 14px 35px rgba(59, 31, 15, .12);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text);
    background: radial-gradient(circle at top, #fffdf8, #f5eee5 65%);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-header {
    width: min(1180px, calc(100% - 32px));
    margin: 16px auto 0;
    min-height: 78px;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    box-shadow: 0 10px 25px rgba(0,0,0,.05);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--brown); line-height: 1; }
.brand-icon {
    width: 42px; height: 42px; border: 2px solid var(--brown);
    display: inline-grid; place-items: center; border-radius: 10px; font-size: 20px;
}
.brand small { display: block; font-size: 13px; }
.brand strong { display: block; font-size: 28px; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.nav { display: flex; gap: 28px; font-family: Arial, sans-serif; font-size: 14px; }
.nav a { padding: 12px 0; border-bottom: 3px solid transparent; }
.nav a.active, .nav a:hover { border-color: var(--gold); color: var(--brown); }
.login-button {
    padding: 10px 16px; border-radius: 9px; border: 1px solid var(--brown);
    color: var(--brown); font-family: Arial, sans-serif; font-weight: 700;
}
.login-button:hover { background: var(--brown); color: white; }

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    background: rgba(255,255,255,.78);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
}
.hero {
    min-height: 430px;
    display: flex;
    align-items: center;
    padding: 64px 54px;
    background:
        linear-gradient(90deg, rgba(35,18,8,.78), rgba(35,18,8,.20)),
        url('../uploads/images/home-san-cipriano.jpg') center/cover;
    color: white;
}
.hero h1 { font-size: clamp(42px, 5vw, 64px); margin: 0 0 16px; max-width: 560px; color: white; }
.hero p { font-family: Arial, sans-serif; font-size: 19px; line-height: 1.55; max-width: 500px; }

.split-section, .content-section, .page-title, .list-section, .detail-page { padding: 50px 40px; }
.split-section { display: grid; grid-template-columns: 1fr 1fr; gap: 46px; align-items: center; }
h1,h2,h3 { color: var(--brown); }
h2 { font-size: 30px; margin: 0 0 22px; }
h2::after, .page-title h1::after {
    content: ''; display: block; width: 50px; height: 3px; background: var(--gold); margin-top: 12px;
}
p { font-family: Arial, sans-serif; line-height: 1.7; }
.button {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brown); color: white; border: 0; border-radius: 8px;
    padding: 12px 22px; margin-top: 12px; font-family: Arial, sans-serif; cursor: pointer;
}
.button:hover { background: var(--brown-2); }
.button-light { background: white; color: var(--brown); border: 1px solid var(--line); }
.button-light:hover { background: var(--soft); }
.button-small { padding: 8px 12px; font-size: 13px; margin-top: 0; }
.button-danger { background: #8d2b2b; }
.city-photo img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); aspect-ratio: 4/3; object-fit: cover; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.card {
    position: relative;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(59,31,15,.08);
    transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(59,31,15,.14); }
.card-overlay { position: absolute; inset: 0; z-index: 2; }
.card-image { height: 170px; position: relative; overflow: hidden; background: #efe3d0; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 18px; }
.card h3 { margin: 10px 0 8px; font-size: 19px; }
.card p { margin: 8px 0; font-size: 14px; }
.date { color: var(--muted); font-size: 12px !important; }
.status {
    display: inline-block; padding: 5px 8px; border-radius: 5px;
    font-family: Arial, sans-serif; font-size: 11px; font-weight: bold; letter-spacing: .04em; background: #eee;
}
.status.in-corso { background: var(--green); color: var(--green-text); }
.status.passato { background: #efefef; color: #555; }
.status.prossimo { background: #fff2dc; color: #9a5a12; }
.pdf-badge {
    position: absolute; right: 10px; bottom: 10px; z-index: 3;
    background: white; border-radius: 8px; padding: 7px 8px;
    font-family: Arial, sans-serif; font-size: 11px; font-weight: bold; box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.text-link { display: inline-block; margin-top: 8px; font-family: Arial, sans-serif; color: var(--brown); font-weight: bold; }

.page-title { text-align: center; padding-top: 62px; padding-bottom: 32px; }
.page-title h1 { font-size: 48px; margin: 0 0 12px; }
.page-title h1::after { margin-left: auto; margin-right: auto; }
.page-title p { max-width: 680px; margin: 0 auto 26px; }
.tabs { display: flex; justify-content: center; gap: 18px; font-family: Arial, sans-serif; }
.tabs a { padding: 12px 22px; border-radius: 8px; }
.tabs a.active { background: var(--brown); color: white; }

.event-list { display: grid; gap: 16px; max-width: 900px; margin: 0 auto; }
.event-list .card {
    display: grid !important;
    grid-template-columns: 230px 1fr !important;
    min-height: 160px;
}
.event-list .card-image {
    height: 100% !important;
    min-height: 170px !important;
}
.event-list .card-body { padding: 20px 22px; }
.compact .card-image { height: 210px; }
.compact .card-body { padding: 14px; }
.compact .card h3 { font-size: 17px; }
.empty {
    padding: 22px; border: 1px dashed var(--line); border-radius: 10px; background: white; color: var(--muted);
}

.detail-back-row { margin-bottom: 18px; }
.back-link { font-family: Arial, sans-serif; color: var(--brown); font-weight: bold; }
.detail-card {
    display: grid; grid-template-columns: minmax(320px, .9fr) 1fr; gap: 30px;
    padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.detail-image-wrap { border-radius: 14px; overflow: hidden; background: #eee2cf; }
.detail-image { width: 100%; height: 100%; min-height: 360px; object-fit: cover; }
.detail-content h1 { font-size: 40px; margin: 14px 0 10px; }
.detail-date { color: var(--muted); font-size: 14px; }
.detail-description { font-size: 16px; margin-top: 16px; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

.site-footer {
    width: min(1180px, calc(100% - 32px)); margin: 0 auto 18px;
    background: var(--brown); color: white; border-radius: 0 0 14px 14px;
    min-height: 74px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; font-family: Arial, sans-serif;
}
.site-footer .brand, .site-footer .brand-icon { color: white; border-color: white; }
.mini .brand-icon { width: 32px; height: 32px; font-size: 16px; }

.admin-page { background: var(--cream); font-family: Arial, sans-serif; }
.admin-box, .admin-container {
    width: min(1080px, calc(100% - 32px)); margin: 40px auto; background: white;
    border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.admin-box { max-width: 420px; }
.admin-top { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.admin-links { display: flex; gap: 16px; flex-wrap: wrap; }
.admin-form { display: grid; gap: 12px; margin-top: 24px; padding: 24px; border-radius: 12px; background: var(--cream); }
.admin-form input, .admin-form select, .admin-form textarea, .admin-box input {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: inherit;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.checks { display: grid; align-content: center; gap: 10px; }
.check-line { display: flex; align-items: center; gap: 8px; }
.check-line input { width: auto; }
.alert, .success { padding: 13px 16px; border-radius: 8px; }
.alert { background: #ffe9e9; color: #9d1d1d; }
.success { background: #e7f8ec; color: #186b35; }
.admin-list { margin-top: 32px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
.admin-actions { min-width: 150px; }
.admin-actions .button { margin: 0 6px 6px 0; }

@media (max-width: 900px) {
    .event-list .card, .detail-card { grid-template-columns: 1fr !important; }
    .detail-image { min-height: 280px; }
}
@media (max-width: 820px) {
    .site-header { padding: 18px; flex-direction: column; gap: 18px; align-items: stretch; }
    .brand strong { font-size: 22px; }
    .header-actions { flex-direction: column; align-items: stretch; gap: 14px; }
    .nav { width: 100%; justify-content: space-around; gap: 10px; }
    .login-button { width: 100%; text-align: center; }
    .hero { min-height: 320px; padding: 34px 22px; }
    .hero h1 { font-size: 40px; }
    .split-section, .content-section, .page-title, .list-section, .detail-page { padding: 34px 20px; }
    .split-section, .grid-3, .grid-4, .form-row { grid-template-columns: 1fr; }
    .card-image, .compact .card-image { height: 190px; }
    .site-footer { flex-direction: column; gap: 14px; padding: 24px; text-align: center; }
    .admin-top { flex-direction: column; align-items: flex-start; }
}

.admin-note { margin: 0; color: var(--muted); font-size: 14px; }

/* Correzioni volantini */
.card-flyer .card-image {
    height: 280px;
    padding: 12px;
    background: linear-gradient(180deg, #f4efe6, #efe2d0);
}
.card-flyer .card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
    border-radius: 10px;
    background: #fff;
}
.compact .card-flyer .card-image {
    height: 300px;
}
.event-list .card-flyer {
    grid-template-columns: 240px 1fr !important;
}
.event-list .card-flyer .card-image {
    height: 100% !important;
    min-height: 250px !important;
}
.detail-card.flyer-detail .detail-image-wrap {
    background: linear-gradient(180deg, #f4efe6, #efe2d0);
    padding: 16px;
}
.detail-card.flyer-detail .detail-image {
    object-fit: contain;
    background: #fff;
    border-radius: 12px;
}
@media (max-width: 820px) {
    .card-flyer .card-image,
    .compact .card-flyer .card-image {
        height: 260px;
    }
}

/* Fix definitivo immagini card: no tagli e no bordi laterali */
.event-list .card.card-event {
    grid-template-columns: 280px 1fr !important;
    align-items: start;
}
.event-list .card.card-event .card-image {
    height: auto !important;
    min-height: 0 !important;
    background: #fff;
    padding: 0;
}
.event-list .card.card-event .card-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 3;
    object-fit: cover;
    object-position: center center;
}

.card-flyer .card-image {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: #fff !important;
}
.card-flyer .card-image img {
    width: 100% !important;
    height: auto !important;
    object-fit: fill !important;
    object-position: center top !important;
    border-radius: 0 !important;
    background: transparent !important;
}
.compact .card-flyer .card-image,
.event-list .card-flyer .card-image {
    height: auto !important;
    min-height: 0 !important;
}

@media (max-width: 900px) {
    .event-list .card.card-event {
        grid-template-columns: 1fr !important;
    }
    .event-list .card.card-event .card-image img {
        aspect-ratio: auto;
    }
}


/* Stemma ufficiale navbar/footer */
.brand-logo {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.brand-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.site-footer .brand-logo {
    width: 34px;
    height: 34px;
}
.site-footer .brand-logo img {
    filter: none;
}
.brand-icon {
    display: none;
}


/* Riduzione stemma navbar */
.brand-logo {
    width: 36px !important;
    height: 36px !important;
}

.site-footer .brand-logo {
    width: 26px !important;
    height: 26px !important;
}


/* Footer nuovo senza logo */
.site-footer {
    display: none !important;
}

.site-footer-new {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 18px;
    background: linear-gradient(135deg, #2c170d, #4a2a18);
    color: #fff;
    border-radius: 0 0 14px 14px;
    font-family: Arial, sans-serif;
    box-shadow: 0 -8px 24px rgba(59, 31, 15, .08);
}

.footer-inner {
    padding: 28px 34px 24px;
    display: grid;
    gap: 22px;
}

.footer-brand-block {
    display: grid;
    gap: 6px;
}

.footer-brand-block strong {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 24px;
    letter-spacing: .02em;
}

.footer-brand-block span {
    color: rgba(255,255,255,.74);
    line-height: 1.6;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding-top: 4px;
}

.footer-links a {
    color: rgba(255,255,255,.86);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    padding-bottom: 5px;
}

.footer-links a:hover {
    color: #fff;
    border-color: var(--gold);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.16);
    padding-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: rgba(255,255,255,.70);
    font-size: 14px;
}

.footer-signature {
    width: 220px;
    max-width: 45%;
    height: auto;
    object-fit: contain;
    display: block;
}

@media (max-width: 820px) {
    .footer-inner {
        padding: 26px 22px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-signature {
        max-width: 100%;
        width: 210px;
    }
}


/* Firma footer abbinata ai colori del sito */
.footer-signature {
    width: 190px !important;
    max-width: 42% !important;
    filter: none !important;
    opacity: .95;
}


/* Firma footer vettoriale nitida */
.footer-signature {
    width: 240px !important;
    max-width: 48% !important;
    height: auto;
    image-rendering: auto;
    opacity: 1;
}
@media (max-width: 820px) {
    .footer-signature {
        width: 230px !important;
        max-width: 100% !important;
    }
}

/* Footer credits con logo sopra la firma */
.footer-copy {
    flex: 1 1 auto;
}
.footer-credits {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}
.footer-logo-badge {
    background: linear-gradient(180deg, #f7f0e4, #eadcc8);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    padding: 8px 18px;
    box-shadow: 0 8px 20px rgba(0,0,0,.14);
}
.footer-logo-text {
    display: block;
    width: 120px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
.footer-signature {
    width: 240px !important;
    max-width: 100% !important;
    height: auto;
    image-rendering: auto;
    opacity: 1;
}
@media (max-width: 820px) {
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    .footer-credits {
        align-items: flex-start;
    }
    .footer-logo-badge {
        padding: 7px 16px;
    }
    .footer-logo-text {
        width: 108px;
    }
    .footer-signature {
        width: 230px !important;
    }
}


/* Logo e firma sopra la linea del footer */
.footer-credits-top {
    align-items: flex-start !important;
    margin-top: 2px;
}

.footer-bottom {
    justify-content: flex-start !important;
}

.footer-copy {
    width: 100%;
}

@media (min-width: 821px) {
    .footer-credits-top {
        align-items: flex-start !important;
    }
}


/* Footer compatto definitivo */
.site-footer-new {
    background: linear-gradient(135deg, #2c170d, #4a2a18) !important;
}

.footer-compact {
    padding: 22px 30px 16px !important;
    gap: 14px !important;
}

.footer-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.footer-left {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.footer-left strong {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 22px;
    letter-spacing: .02em;
    color: #fff;
}

.footer-left span {
    color: rgba(255,255,255,.72);
    font-size: 14px;
    line-height: 1.45;
}

.footer-compact .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 4px;
}

.footer-compact .footer-links a {
    font-size: 13px;
    color: rgba(255,255,255,.86);
    padding-bottom: 4px;
}

.footer-credits-compact {
    display: flex !important;
    flex-direction: column;
    align-items: center !important;
    justify-content: center;
    gap: 6px;
    min-width: 210px;
}

.footer-credits-compact .footer-logo-badge {
    padding: 5px 14px !important;
    border-radius: 11px !important;
    background: linear-gradient(180deg, #f7f0e4, #eadcc8) !important;
    box-shadow: 0 6px 14px rgba(0,0,0,.13) !important;
}

.footer-credits-compact .footer-logo-text {
    width: 82px !important;
    height: auto;
}

.footer-credits-compact .footer-signature {
    width: 170px !important;
    max-width: 170px !important;
    height: auto;
}

.footer-compact .footer-bottom {
    border-top: 1px solid rgba(255,255,255,.15);
    padding-top: 12px !important;
    display: flex;
    justify-content: center !important;
    align-items: center;
    color: rgba(255,255,255,.68);
    font-size: 13px;
}

.footer-compact .footer-copy {
    width: auto !important;
    text-align: center;
}

@media (max-width: 820px) {
    .footer-compact {
        padding: 22px 20px 16px !important;
    }

    .footer-main-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .footer-credits-compact {
        align-items: flex-start !important;
        min-width: 0;
    }

    .footer-credits-compact .footer-logo-text {
        width: 78px !important;
    }

    .footer-credits-compact .footer-signature {
        width: 165px !important;
        max-width: 165px !important;
    }

    .footer-compact .footer-bottom {
        justify-content: flex-start !important;
    }

    .footer-compact .footer-copy {
        text-align: left;
    }
}


/* Click card PDF */
.card .pdf-badge {
    pointer-events: none;
}


/* Home: sempre fino a 4 eventi */
.section-intro {
    margin-top: -10px;
    margin-bottom: 24px;
    color: var(--muted);
}

.home-events-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-events-grid .card-image {
    height: 155px;
}

.home-events-grid .card-body {
    padding: 15px;
}

.home-events-grid .card h3 {
    font-size: 17px;
}

.home-events-grid .card p {
    font-size: 13px;
}

@media (max-width: 1050px) {
    .home-events-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-events-grid .card-image {
        height: 180px;
    }
}

@media (max-width: 620px) {
    .home-events-grid {
        grid-template-columns: 1fr;
    }
}


/* Avviso 5 per mille in sovraimpressione */
.five-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(34, 18, 9, .58);
    backdrop-filter: blur(4px);
}

.five-overlay.is-hidden {
    display: none;
}

.five-modal {
    position: relative;
    width: min(620px, 100%);
    max-height: min(86vh, 760px);
    overflow-y: auto;
    background: linear-gradient(180deg, #fffaf1, #f3e8d8);
    border: 1px solid rgba(201, 132, 52, .45);
    border-radius: 18px;
    padding: 34px 34px 30px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    color: var(--text);
}

.five-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--brown);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.five-close:hover {
    background: var(--brown-2);
}

.five-kicker {
    display: inline-block;
    background: var(--gold);
    color: #fff;
    border-radius: 999px;
    padding: 7px 13px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 12px;
}

.five-modal h2 {
    margin: 0;
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1.05;
}

.five-modal h2::after {
    display: none;
}

.five-modal h3 {
    margin: 6px 0 18px;
    color: var(--gold);
    font-size: 28px;
}

.five-modal p {
    margin: 12px 0;
    font-size: 15px;
    line-height: 1.65;
}

.five-lead {
    font-size: 18px !important;
    font-weight: 700;
    color: var(--brown);
}

.five-code {
    margin: 18px 0;
    padding: 18px 20px;
    background: #fff;
    border: 2px dashed var(--gold);
    border-radius: 14px;
    text-align: center;
    font-family: Arial, sans-serif;
    font-size: clamp(28px, 6vw, 42px);
    font-weight: 800;
    letter-spacing: .06em;
    color: var(--brown);
}

.five-small {
    color: var(--muted);
    font-size: 14px !important;
}

.five-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.five-actions .button {
    margin-top: 0;
}

@media (max-width: 640px) {
    .five-modal {
        padding: 30px 20px 24px;
    }

    .five-actions {
        display: grid;
    }

    .five-actions .button {
        width: 100%;
    }
}


/* Responsive generale extra: computer, tablet, telefono */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

img, video, iframe {
    max-width: 100%;
}

.container,
.site-header,
.site-footer-new,
.hero,
.split-section,
.content-section {
    max-width: 1180px;
}

@media (max-width: 1180px) {
    .site-header,
    .site-footer-new,
    .hero,
    .split-section,
    .content-section {
        width: min(100% - 24px, 1180px) !important;
    }
}

@media (max-width: 900px) {
    .site-header {
        flex-wrap: wrap;
        gap: 14px;
    }

    .main-nav {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .split-section {
        grid-template-columns: 1fr !important;
    }

    .hero {
        min-height: 360px;
    }

    .hero h1 {
        font-size: clamp(36px, 9vw, 58px);
    }

    .grid,
    .grid-3,
    .grid-4,
    .home-events-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 620px) {
    .site-header,
    .site-footer-new,
    .hero,
    .split-section,
    .content-section {
        width: calc(100% - 18px) !important;
    }

    .brand {
        min-width: 0;
    }

    .brand-text strong {
        font-size: 17px;
    }

    .brand-text span {
        font-size: 12px;
    }

    .main-nav {
        gap: 8px;
    }

    .main-nav a {
        font-size: 13px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .hero {
        min-height: 330px;
        padding: 34px 18px;
    }

    .hero p {
        font-size: 17px;
    }

    .split-section,
    .content-section {
        padding: 26px 18px !important;
    }

    .grid,
    .grid-3,
    .grid-4,
    .home-events-grid {
        grid-template-columns: 1fr !important;
    }

    .card,
    .event-list .card.card-event {
        grid-template-columns: 1fr !important;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .five-overlay {
        padding: 12px;
    }

    .five-modal {
        max-height: 88vh;
    }
}


/* Login admin nascosto */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 10%, rgba(216,171,99,.22), transparent 30%),
        linear-gradient(135deg, #2c170d, #4a2a18);
}

.login-wrap {
    width: min(420px, calc(100% - 28px));
}

.login-box {
    background: #fffaf1;
    border: 1px solid rgba(216,171,99,.45);
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}

.login-box h1 {
    margin-top: 0;
}

.login-box label {
    display: block;
    margin-top: 14px;
    font-weight: 700;
}

.login-box input {
    width: 100%;
}

.login-help {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}







/* Admin dashboard - modifica/elimina card */
.admin-list {
    padding-top: 30px;
}

.admin-list-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 22px;
}

.admin-card-list {
    display: grid;
    gap: 18px;
}

.admin-card-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 22px;
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(100, 68, 44, .14);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(63, 43, 32, .08);
    transition: transform .18s ease, box-shadow .18s ease;
}

.admin-card-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(63, 43, 32, .12);
}

.admin-card-thumb {
    width: 160px;
    height: 105px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #efe4d5, #d9c3a5);
    border: 1px solid rgba(100, 68, 44, .10);
}

.admin-card-thumb img,
.current-file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-card-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: #6f5848;
    font-weight: 700;
    font-size: .9rem;
}

.admin-card-info {
    min-width: 0;
}

.admin-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.admin-badge.evento {
    background: #e7f4ec;
    color: #246b42;
}

.admin-badge.volantino {
    background: #f4eadb;
    color: #7a4a20;
}

.admin-date {
    color: #8a6b54;
    font-size: .9rem;
}

.admin-card-info strong {
    display: block;
    color: #2f1c12;
    font-size: 1.16rem;
    line-height: 1.25;
    margin-bottom: 7px;
}

.admin-card-info p {
    margin: 0;
    color: #5f4a3a;
    line-height: 1.55;
}

.admin-card-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button.danger {
    background: #9e2f2f;
    color: #fff;
    border: 0;
}

.button.danger:hover {
    background: #7d2424;
}

.button.secondary {
    background: #efe4d5;
    color: #3f2b20;
    border: 1px solid rgba(63, 43, 32, .12);
}

.button.secondary:hover {
    background: #e2d2bf;
}

.current-file-preview {
    display: grid;
    gap: 8px;
    margin: 8px 0 14px;
}

.current-file-preview span {
    font-weight: 700;
    color: #5f4a3a;
}

.current-file-preview img {
    max-width: 260px;
    height: 150px;
    border-radius: 16px;
    border: 1px solid rgba(100, 68, 44, .14);
}

.checkbox-line {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 8px 0 14px;
    font-weight: 600;
}

.checkbox-line input {
    width: auto !important;
}

.admin-form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 900px) {
    .admin-card-row {
        grid-template-columns: 130px 1fr;
    }

    .admin-card-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .admin-card-thumb {
        width: 130px;
        height: 96px;
    }
}

@media (max-width: 560px) {
    .admin-card-row {
        grid-template-columns: 1fr;
    }

    .admin-card-thumb {
        width: 100%;
        height: 180px;
    }

    .admin-card-actions,
    .admin-card-actions form,
    .admin-card-actions .button {
        width: 100%;
    }
}





/* Popup immagine sopra tutta la pagina */
.card-image-popup {
    cursor: zoom-in;
}

.image-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: var(--brown);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    cursor: zoom-in;
    box-shadow: 0 8px 18px rgba(0,0,0,.20);
    display: grid;
    place-items: center;
    transition: transform .15s ease, background .15s ease;
}

.image-fullscreen-btn:hover {
    transform: scale(1.07);
    background: #fff;
}

body.popup-image-open {
    overflow: hidden;
}

.image-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(18, 10, 5, .88);
    backdrop-filter: blur(7px);
}

.image-popup-overlay.open {
    display: flex;
}

.image-popup-box {
    position: relative;
    width: min(1180px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    padding: 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 30px 90px rgba(0,0,0,.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: popupImageIn .18s ease-out;
}

@keyframes popupImageIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.image-popup-box img {
    max-width: 100%;
    max-height: calc(100vh - 150px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 18px;
    background: #f6efe7;
}

.image-popup-title {
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f6efe7;
    color: #2c170d;
    font-family: Arial, sans-serif;
    font-weight: 700;
    text-align: center;
}

.image-popup-close {
    position: absolute;
    top: -18px;
    right: -18px;
    z-index: 2;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 999px;
    background: var(--brown);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(0,0,0,.32);
}

.image-popup-close:hover {
    background: var(--brown-2);
}

@media (max-width: 700px) {
    .image-popup-overlay {
        padding: 12px;
    }

    .image-popup-box {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        padding: 12px;
        border-radius: 18px;
    }

    .image-popup-box img {
        max-height: calc(100vh - 120px);
        border-radius: 14px;
    }

    .image-popup-close {
        top: 8px;
        right: 8px;
        width: 42px;
        height: 42px;
        font-size: 30px;
    }

    .image-popup-title {
        font-size: 13px;
    }
}


/* Card: apertura immagine o PDF */
.card-overlay-button {
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.image-fullscreen-btn-blank {
    padding: 0;
}
