/* ================================================
   news-detail.css — pagina articolo / evento
   Dipende da: base.css
================================================ */

/* ── Accent per tipo pagina ── */
:root {
    --accent:       #ff7000;
    --accent-light: #fff4eb;
    --accent-dark:  #c45500;
    --radius:       14px;
}
.page--evento {
    --accent:       #1d6fa5;
    --accent-light: #e8f4fd;
    --accent-dark:  #145580;
}

/* ── Navbar override (pagina dettaglio usa Tailwind bg-yellow-400) ── */
section.fixed.bg-yellow-400 { background-color: #ff7000 !important; }
.page--evento section.fixed.bg-yellow-400 { background-color: #1d6fa5 !important; }

main { position: relative; z-index: 1; }

/* ================================================
   SKELETON
================================================ */
.skeleton-block {
    background: linear-gradient(90deg, #f0e8d8 25%, #fde9c4 50%, #f0e8d8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 10px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ================================================
   HERO IMAGE
   object-fit: contain → mostra la foto per intero senza crop.
   Sfondo bianco riempie le aree vuote quando le proporzioni non
   coincidono con il contenitore (es. foto verticale in box orizzontale).
================================================ */
.hero-wrap {
    width: 100%;
    height: 480px;
    background-color: #fff;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius);
    position: relative;
}
.hero-wrap--no-img { display: none; }
#hero-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #fff;
    display: block;
}

/* ================================================
   ARTICLE CARD
================================================ */
.article-card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Meta bar */
.meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem 0;
    border-bottom: 1px solid #f0e8d8;
    padding-bottom: 0.875rem;
}

.meta-type {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-light);
    border: 1.5px solid var(--accent);
    border-radius: 6px;
    padding: 2px 10px;
}

.meta-date, .meta-author {
    font-size: 0.82rem;
    color: #6b7280;
}
.meta-author { font-weight: 600; color: #374151; }
.meta-author::before { content: '— '; }

.meta-share {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#shareBtn {
    background: none; border: none; cursor: pointer;
    color: #9ca3af; padding: 0.25rem;
    transition: color 0.2s;
}
#shareBtn:hover { color: var(--accent); }

#copyMessage {
    font-size: 0.8rem; color: #6b7280;
    opacity: 0; transition: opacity 0.3s; white-space: nowrap;
}

/* Title */
#article-title {
    font-size: clamp(1.5rem, 4vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    color: #111827;
    padding: 1.25rem 1.5rem 0.5rem;
}

/* Tags */
#tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 1.5rem 1rem;
}
.tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 9999px;
}
.tag--cat    { background: #dbeafe; color: #1e40af; }
.tag--luogo  { background: #dcfce7; color: #166534; }
.tag--comune { background: #fef9c3; color: #713f12; }

/* Body testo */
#article-body {
    padding: 0.5rem 1.5rem 1.5rem;
    font-size: 1.05rem;
    line-height: 1.85;
    color: #374151;
}
#article-body p + p { margin-top: 1.2rem; }

/* ================================================
   EVENTO INFO BOX
================================================ */
#evento-info {
    margin: 0 1.5rem 1.5rem;
    background: var(--accent-light);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.25rem 1.5rem;
}
.evento-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.evento-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.evento-info-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
    border-radius: 8px;
    color: #fff;
}
.evento-info-icon svg { width: 16px; height: 16px; }
.evento-info-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #6b7280; margin: 0; }
.evento-info-val { font-size: 0.9rem; font-weight: 600; color: #111827; margin: 0; }

/* ================================================
   GALLERIA FOTO
================================================ */
#foto-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.5rem 1.5rem;
}
.gallery-thumb {
    width: 100px; height: 70px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}
.gallery-thumb:hover, .gallery-thumb--active {
    transform: scale(1.05);
    border-color: var(--accent);
}

/* Lightbox */
.lightbox-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.88);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.lightbox-img { max-width: 90vw; max-height: 85vh; border-radius: 10px; }
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    font-size: 1.5rem; cursor: pointer; border-radius: 50%;
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.3); }
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev  { left: 1rem; }
.lightbox-next  { right: 1rem; }

/* ================================================
   BLOCCO PUBBLICITÀ
================================================ */

/*
 * Approccio padding-top al posto di aspect-ratio + position:absolute.
 * Questo è il metodo più compatibile tra browser e non richiede che
 * i figli assoluti abbiano un antenato con dimensioni esplicite.
 *
 * Il wrapper interno .article-ad-inner si espande al 100% x 100%
 * del padding creato, e img/video riempiono quello.
 */
.article-ad {
    width: 100%;
    position: relative;
    padding-top: 35%;           /* 350/1000 = 35% — mantiene il rapporto */
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    background: #e5e7eb;
}

/* Il link <a> deve coprire tutto il container */
.article-ad > a {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.article-ad img,
.article-ad video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ================================================
   COMMENTI
================================================ */
.commenti-section {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.commenti-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.commenti-title::before {
    content: '';
    display: block; width: 4px; height: 1.15rem;
    background: var(--accent); border-radius: 2px;
}

.commenti-empty {
    color: #9ca3af; font-style: italic; font-size: 0.9rem;
    padding: 0.5rem 0;
}

.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
    animation: slideUp 0.3s ease both;
}
.comment-item:last-child { border-bottom: none; }

@keyframes slideUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* Nuovo commento inserito senza reload — animazione da sopra */
.comment-item--new {
    animation: slideDown 0.35s ease both;
    background: color-mix(in srgb, var(--accent-light) 40%, transparent);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.25rem;
}
@keyframes slideDown { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:none} }

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}
.comment-author {
    font-weight: 700; font-size: 0.88rem; color: #111827;
}
.comment-date {
    font-size: 0.75rem; color: #9ca3af;
}
/* Bottone like — sostituisce il vecchio .comment-likes statico */
.comment-like-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #9ca3af;               /* grigio di default */
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    border-radius: 9999px;
    padding: 2px 10px;
    cursor: pointer;
    transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.15s;
    line-height: 1.4;
}

.comment-like-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--accent);
}

/* Stato: ha già dei like (ma non ancora cliccato dall'utente) */
.comment-like-btn.has-likes {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--accent);
}

/* Stato: l'utente ha appena cliccato like */
.comment-like-btn.liked {
    color: #dc2626;
    background: #fee2e2;
    border-color: #fca5a5;
    transform: scale(1.08);
}

/* Animazione durante la chiamata API */
.comment-like-btn.liking .like-icon {
    animation: heartbeat 0.4s ease infinite alternate;
}

@keyframes heartbeat {
    from { transform: scale(1); }
    to   { transform: scale(1.3); }
}

.comment-like-btn:disabled {
    cursor: default;
}
.comment-body {
    font-size: 0.92rem; line-height: 1.65;
    color: #374151; margin: 0;
}

/* Form commento */
.comment-form-wrap {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f3f4f6;
}
.comment-form-title {
    font-size: 0.9rem; font-weight: 700; color: #374151; margin-bottom: 0.75rem;
}

#comment-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.92rem; color: #111827;
    resize: vertical; min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}
#comment-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
    background: #fff;
}

#comment-submit {
    margin-top: 0.75rem;
    padding: 0.55rem 1.5rem;
    background: var(--accent); color: #fff;
    font-weight: 700; font-size: 0.88rem;
    border: none; border-radius: 9999px; cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
#comment-submit:hover  { background: var(--accent-dark); }
#comment-submit:active { transform: scale(0.97); }
#comment-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.comment-status {
    margin-top: 0.5rem; font-size: 0.82rem; display: block; min-height: 1.2em;
}
.comment-status--ok  { color: #16a34a; }
.comment-status--err { color: #dc2626; }

/* ================================================
   BACK LINK
================================================ */
.back-link {
    display: inline-flex; align-items: center; gap: 0.4rem;
    color: var(--accent); font-size: 0.9rem; font-weight: 600;
    text-decoration: none; margin-bottom: 1.25rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent-dark); }

/* ================================================
   FATAL ERROR
================================================ */
#fatal-error {
    background: #fee2e2; color: #991b1b;
    border: 1px solid #fecaca; border-radius: var(--radius);
    padding: 1.5rem; font-weight: 600; text-align: center;
    margin: 2rem 0;
}

/* ================================================
   RESPONSIVE
================================================ */
@media (max-width: 640px) {
    #logo-navbar-lnc {
        height: 30px !important;
    }
    .hero-wrap { height: 260px; }
    #article-title { font-size: 1.35rem; padding: 1rem 1rem 0.4rem; }
    #article-body { padding: 0.5rem 1rem 1.25rem; font-size: 0.96rem; }
    .meta-bar { padding: 0.75rem 1rem 0.75rem; }
    #tags-wrap, #foto-gallery { padding-left: 1rem; padding-right: 1rem; }
    #evento-info { margin: 0 1rem 1.25rem; }
    .evento-info-grid { grid-template-columns: 1fr; }
    .commenti-section { padding: 1rem; }
}