/* ============================================================
   BGE PANS/PANDAS — Identità visiva
   ------------------------------------------------------------
   Palette verde: verde scuro per testi/accenti forti (usato con
   parsimonia, mai a piena pagina), verde chiaro per il tono
   principale e gli accenti diffusi. La superficie scura è
   limitata a piccoli elementi (bottoni, badge, footer, linee),
   non più a intere sezioni.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Karla:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* ---- Palette: verde scuro + verde chiaro ---- */
  --night: #1B4332;          /* Verde scuro — testi forti, bottoni, footer, dettagli piccoli */
  --night-soft: #2D6A4F;     /* variante più chiara del verde scuro */
  --dawn: #74C69D;           /* Verde chiaro — accento principale, CTA */
  --dawn-soft: #95D5B2;      /* variante più chiara del verde chiaro, per hover */
  --paper: #F7F6F2;          /* sfondo pagina */
  --mist: #EDF5F0;           /* sezioni alternate, verde chiarissimo */

  --color-primary: var(--night);
  --color-primary-dark: #123325;
  --color-accent: var(--dawn);
  --color-accent-dark: #2D6A4F;
  --color-bg: var(--paper);
  --color-bg-alt: var(--mist);
  --color-text: #22302A;
  --color-text-muted: #5C6E64;
  --color-border: #DDE6DF;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 10px 28px rgba(27, 67, 50, 0.09);
  --shadow-card-hover: 0 16px 36px rgba(27, 67, 50, 0.14);

  --font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;

  --container-width: 1180px;
  --header-height: 68px;

  /* la "linea firma": sfumatura verde scuro -> verde chiaro, usata come regola/sottolineatura */
  --dawn-line: linear-gradient(90deg, var(--night) 0%, var(--dawn) 65%, var(--dawn-soft) 100%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  overflow-x: hidden;
  font-size: 16px;
  animation: page-fade-in 0.4s ease;
}
@keyframes page-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }
img { max-width: 100%; display: block; height: auto; }
a { color: var(--night); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-optical-sizing: auto;
  color: var(--color-primary-dark);
  line-height: 1.15;
  margin: 0 0 0.45em;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 3.4vw + 1.2rem, 3.4rem); font-weight: 600; }
h2 { font-size: clamp(1.5rem, 1.8vw + 1.1rem, 2.1rem); }
h3 { font-size: clamp(1.15rem, 1vw + 0.95rem, 1.35rem); }
p { overflow-wrap: break-word; }

/* eyebrow: etichetta breve sopra un titolo, per identificare la categoria del
   contenuto (Supporto / Formazione / Advocacy...), non un numero di sequenza */
.eyebrow {
  display: inline-block; font-family: var(--font-body); font-weight: 700;
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--color-accent-dark); margin-bottom: 10px;
}

/* la linea dell'alba: regola firma sotto i titoli di sezione */
.dawn-rule { width: 64px; height: 3px; background: var(--dawn-line); border-radius: 3px; margin: 14px 0 0; border: none; }
.dawn-rule.centered { margin-left: auto; margin-right: auto; }

.container { max-width: var(--container-width); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

/* ---------- HEADER / NAV RESPONSIVE ---------- */
.site-header { background: rgba(247, 246, 242, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 200; }
.site-header .header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; max-width: var(--container-width); margin: 0 auto; min-height: var(--header-height);
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-heading); font-weight: 600; color: var(--color-primary-dark); max-width: 60vw;
}
.logo-img { height: 40px; width: 40px; flex-shrink: 0; border-radius: 50%; }
.logo-text { font-size: 0.92rem; line-height: 1.25; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: none; background: none; cursor: pointer; z-index: 210;
}
.nav-toggle span, .nav-toggle::before, .nav-toggle::after {
  content: ''; display: block; width: 24px; height: 2px; background: var(--color-primary-dark); position: relative; transition: 0.2s;
}
.nav-toggle::before { position: absolute; transform: translateY(-8px); }
.nav-toggle::after { position: absolute; transform: translateY(8px); }
.nav-toggle.open span { background: transparent; }
.nav-toggle.open::before { transform: rotate(45deg); }
.nav-toggle.open::after { transform: rotate(-45deg); }

.main-nav {
  position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: var(--paper); overflow-y: auto; padding: 16px; transform: translateX(100%);
  transition: transform 0.25s ease; z-index: 199;
}
.main-nav.open { transform: translateX(0); }
.main-nav > ul { list-style: none; margin: 0; padding: 0; }
.main-nav li { position: relative; border-bottom: 1px solid var(--color-border); }
.main-nav > ul > li > a { display: block; padding: 14px 8px; color: var(--color-text); font-weight: 600; font-size: 1rem; position: relative; }
.main-nav .submenu { list-style: none; margin: 0; padding: 0 0 8px 16px; display: none; }
.main-nav li.submenu-open > .submenu { display: block; }
.main-nav .submenu a { display: block; padding: 10px 8px; font-size: 0.92rem; color: var(--color-text-muted); }
.submenu-caret { float: right; padding: 14px 8px; cursor: pointer; user-select: none; }

.header-cta { display: flex; align-items: center; gap: 10px; }
.lang-switch { font-size: 0.8rem; color: var(--color-text-muted); display: none; }

.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 0.92rem;
  background: var(--dawn); color: var(--night); border: none; cursor: pointer; text-align: center;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--dawn-soft); text-decoration: none; color: var(--night); transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 20px rgba(116, 198, 157, 0.4); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-outline { background: transparent; border: 2px solid var(--night); color: var(--night); padding: 10px 20px; }
.btn-outline:hover { background: var(--night); color: #fff; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(27, 67, 50, 0.25); }
.btn-sm-cta { padding: 9px 16px; font-size: 0.82rem; }

/* Desktop nav */
@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .main-nav {
    position: static; transform: none; background: none; padding: 0; overflow: visible; flex: 1;
    display: flex; justify-content: center;
  }
  .main-nav > ul { display: flex; gap: 2px; }
  .main-nav li { border-bottom: none; }
  .main-nav > ul > li > a { padding: 10px 12px; border-radius: var(--radius-sm); }
  .main-nav > ul > li > a::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px;
    background: var(--dawn); transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease;
  }
  .main-nav > ul > li:hover > a::after, .main-nav > ul > li > a[aria-current="page"]::after { transform: scaleX(1); }
  .main-nav > ul > li:hover > a, .main-nav > ul > li > a.active { background: var(--color-bg-alt); color: var(--color-primary-dark); text-decoration: none; }
  .main-nav .submenu {
    display: none; position: absolute; top: 100%; left: 0; background: #fff; min-width: 240px; padding: 8px;
    box-shadow: var(--shadow-card); border-radius: var(--radius-sm);
  }
  .main-nav li:hover .submenu { display: block; }
  .main-nav .submenu a { padding: 8px 12px; border-radius: 6px; }
  .main-nav .submenu a:hover { background: var(--color-bg-alt); text-decoration: none; }
  .submenu-caret { display: none; }
  .lang-switch { display: inline; }
}

/* ---------- HERO ---------- */
.hero {
  background: var(--mist);
  color: var(--color-text);
  padding: 44px 0 52px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--dawn-line);
}
.hero h1 { color: var(--color-primary-dark); }
.hero p { color: var(--color-text-muted); }
@media (min-width: 768px) { .hero { padding: 60px 0 68px; } }
.hero-emergency-cta { background: var(--night); color: #fff; text-align: center; padding: 12px 16px; font-weight: 700; font-size: 0.9rem; }
.hero-emergency-cta a { color: var(--dawn-soft); text-decoration: underline; }

/* ---------- BANNER TEMPORANEI (comunicazioni programmate) ---------- */
.site-banner {
  text-align: center; padding: 10px 16px; font-size: 0.88rem; font-weight: 600;
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center;
}
.site-banner-info { background: var(--mist); color: var(--color-primary-dark); }
.site-banner-warning { background: var(--dawn-soft); color: var(--night); }
.site-banner-urgent { background: #c0392b; color: #fff; }
.site-banner a { color: inherit; text-decoration: underline; font-weight: 700; }

/* ---------- CARDS ---------- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin: 28px 0; }
@media (min-width: 560px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; } }
.card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
  display: flex; flex-direction: column; border-top: 3px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); border-top: 3px solid var(--dawn); }
.card img { height: 180px; object-fit: cover; width: 100%; }
.card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { margin-bottom: 6px; }
.card-body .role { color: var(--color-accent-dark); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.card-body p { color: var(--color-text-muted); font-size: 0.92rem; flex: 1; }

/* ---------- SECTIONS ---------- */
.section { padding: 40px 0; }
@media (min-width: 768px) { .section { padding: 64px 0; } }
.section-alt { background: var(--color-bg-alt); }
.section-title { text-align: center; margin-bottom: 8px; }
.section-title + .dawn-rule.centered { margin-bottom: 32px; }

/* ---------- ACCORDION FAQ ---------- */
.accordion-item { border-bottom: 1px solid var(--color-border); }
.accordion-question { width: 100%; text-align: left; background: none; border: none; padding: 18px 0; font-size: 1.02rem; font-weight: 700; color: var(--color-primary-dark); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.accordion-question span { color: var(--color-accent-dark); font-size: 1.2rem; }
.accordion-answer { display: none; padding: 0 0 18px; color: var(--color-text-muted); }
.accordion-item.open .accordion-answer { display: block; }

/* ---------- FORMS ---------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.88rem; }
input, select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.95rem; background: #fff; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--dawn); box-shadow: 0 0 0 3px rgba(116, 198, 157, 0.25); outline: none; }
textarea { resize: vertical; min-height: 120px; }
.consent-row { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.consent-row input { width: auto; }

/* ---------- RICERCA ---------- */
.search-box { display: flex; gap: 8px; max-width: 520px; margin: 0 auto 32px; }
.search-box input { flex: 1; }
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.filters-bar select, .filters-bar input { width: auto; min-width: 160px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--color-bg-alt); color: var(--color-primary-dark); font-size: 0.78rem; font-weight: 700; margin-right: 6px; }

/* ---------- EDITOR RICCO (vanilla) ---------- */
.rte-wrapper { border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--color-bg-alt); border-bottom: 1px solid var(--color-border); }
.rte-toolbar button {
  width: auto; padding: 7px 10px; background: #fff; border: 1px solid var(--color-border); border-radius: 6px;
  cursor: pointer; font-size: 0.85rem; margin: 0;
}
.rte-toolbar button:hover, .rte-toolbar button.active { background: var(--color-bg-alt); }
.rte-toolbar select { width: auto; padding: 6px; margin: 0; }
.rte-content { min-height: 260px; padding: 16px; outline: none; }
.rte-content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.rte-content video { max-width: 100%; border-radius: 8px; }
.rte-content blockquote { border-left: 4px solid var(--dawn); margin: 12px 0; padding: 6px 16px; color: var(--color-text-muted); font-style: italic; }
.rte-content h2, .rte-content h3 { margin-top: 0.6em; }
.rte-content a { text-decoration: underline; }

/* ---------- CITAZIONI EDITORIALI ---------- */
blockquote.block-quote {
  font-family: var(--font-heading); font-size: 1.3rem; font-style: italic; color: var(--color-primary-dark);
  border-left: 4px solid var(--dawn); margin: 28px 0; padding: 4px 0 4px 24px; line-height: 1.5;
}

/* ---------- FOOTER ---------- */
.site-footer { background: var(--night); color: #B9C0D4; padding: 48px 0 20px; margin-top: 56px; position: relative; }
.site-footer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--dawn-line); }
.site-footer h4 { font-family: var(--font-heading); }
.site-footer a { color: #EDEFF6; }
.footer-cols { display: grid; grid-template-columns: 1fr; gap: 28px; margin-bottom: 28px; }
@media (min-width: 640px) { .footer-cols { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.footer-col-brand p { color: #B9C0D4; }
.footer-logo { height: 52px; width: 52px; border-radius: 50%; margin-bottom: 14px; }
.footer-social { display: flex; gap: 10px; margin-top: 16px; }
.footer-social-icon {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.08); color: #fff;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s ease, transform 0.2s ease;
}
.footer-social-icon:hover { background: var(--dawn); color: var(--night); transform: translateY(-2px); text-decoration: none; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 16px; font-size: 0.8rem; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 640px) { .footer-bottom { flex-direction: row; flex-wrap: wrap; justify-content: space-between; } }

/* ---------- UTILITY ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
table { width: 100%; }
@media (max-width: 639px) {
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead { display: none; }
  tr { margin-bottom: 12px; border: 1px solid var(--color-border); border-radius: 10px; padding: 8px; }
  td { border: none; padding: 6px 8px; }
  td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--color-text-muted); }
}

/* ---------- ACCESSIBILITÀ ---------- */
.skip-link {
  position: absolute; top: -50px; left: 12px; background: var(--night); color: #fff;
  padding: 12px 20px; border-radius: 0 0 8px 8px; z-index: 1000; transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--dawn); outline-offset: 2px;
}

.main-nav a[aria-current="page"] { color: var(--color-primary-dark); font-weight: 800; text-decoration: underline; text-decoration-color: var(--dawn); }

/* ---------- TORNA SU ---------- */
#back-to-top {
  position: fixed; bottom: 24px; right: 24px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--night); color: #fff; border: none; font-size: 1.2rem; cursor: pointer;
  box-shadow: var(--shadow-card); display: none; z-index: 500; line-height: 1;
}
#back-to-top.visible { display: block; }
#back-to-top:hover { background: var(--dawn); color: var(--night); }

/* ---------- RIVELAZIONE ALLO SCROLL (discreta, un solo momento orchestrato) ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- MODALITÀ SCURA (rispetta la preferenza di sistema) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0E1425;
    --color-bg-alt: #161D33;
    --color-text: #E7E9F2;
    --color-text-muted: #9EA5BD;
    --color-border: #29314A;
    --color-primary-dark: #F2EFE6;
  }
  body { background: var(--color-bg); color: var(--color-text); }
  .site-header { background: rgba(14, 20, 37, 0.92); }
  .card, .rte-wrapper, .rte-content { background: #161D33; }
  input, select, textarea { background: #161D33; color: var(--color-text); border-color: var(--color-border); }
  .logo, .main-nav > ul > li > a { color: var(--color-text); }
}

/* ---------- STAMPA ---------- */
@media print {
  .site-header, .site-footer, #back-to-top, #cookie-banner, .btn, .hero-emergency-cta, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  .section { padding: 12px 0; }
}

/* ---------- BREADCRUMBS ---------- */
.breadcrumbs { font-size: 0.85rem; color: var(--color-text-muted); margin: 16px 0; }
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs .sep { margin: 0 6px; }
.breadcrumbs .current { color: var(--color-primary-dark); font-weight: 600; }

/* ---------- QUOTA DI ARCHIVIAZIONE / LIBRERIA FILE ---------- */
.storage-bar-wrap { margin: 20px 0 28px; }
.storage-bar-label { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; margin-bottom: 6px; color: var(--color-text-muted); }
.storage-bar { height: 10px; background: var(--color-bg-alt); border-radius: 999px; overflow: hidden; }
.storage-bar-fill { height: 100%; background: var(--dawn); border-radius: 999px; transition: width 0.3s ease; }

.chunk-dropzone {
  border: 2px dashed var(--color-border); border-radius: var(--radius-md); padding: 28px 16px; text-align: center;
  cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease;
}
.chunk-dropzone.dragover { border-color: var(--dawn); background: var(--color-bg-alt); }
.chunk-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.chunk-progress-bar { flex: 1; height: 8px; background: var(--color-bg-alt); border-radius: 999px; overflow: hidden; }
.chunk-progress-fill { height: 100%; width: 0; background: var(--dawn); transition: width 0.2s ease; }

.file-library-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.file-library-icon { font-size: 1.5rem; width: 40px; text-align: center; }
.file-library-info { flex: 1; }
.file-library-meta { font-size: 0.8rem; color: var(--color-text-muted); }

/* ---------- MULTIMEDIA: TAB ---------- */
.media-tab { padding: 10px 18px; font-weight: 700; color: var(--color-text-muted); border-bottom: 3px solid transparent; }
.media-tab:hover { text-decoration: none; color: var(--color-primary-dark); }
.media-tab.active { color: var(--color-primary-dark); border-bottom-color: var(--dawn); }

/* ---------- MULTIMEDIA: GRIGLIA VIDEO (stile YouTube) ---------- */
.video-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 560px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }
.video-thumb {
  display: flex; flex-direction: column; text-align: left; background: #fff; border: none; padding: 0;
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.video-thumb:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.video-thumb-img {
  aspect-ratio: 16/9; background: var(--night) center/cover no-repeat; display: flex; align-items: center; justify-content: center; position: relative;
}
.video-play {
  width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.92); color: var(--night);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; padding-left: 3px;
}
.video-thumb-title { padding: 12px 14px 2px; font-weight: 700; font-size: 0.95rem; color: var(--color-text); }
.video-thumb-album { padding: 0 14px 12px; font-size: 0.78rem; color: var(--color-text-muted); }

/* ---------- MULTIMEDIA: GRIGLIA FOTO (masonry con colonne CSS) ---------- */
.photo-masonry { column-count: 2; column-gap: 14px; }
@media (min-width: 640px) { .photo-masonry { column-count: 3; } }
@media (min-width: 960px) { .photo-masonry { column-count: 4; } }
.photo-thumb { display: block; width: 100%; padding: 0; border: none; background: none; cursor: pointer; margin-bottom: 14px; break-inside: avoid; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-card); }
.photo-thumb img { width: 100%; display: block; transition: transform 0.3s ease; }
.photo-thumb:hover img { transform: scale(1.04); }

/* ---------- MULTIMEDIA: TEATRO/LIGHTBOX (un solo "player", niente cambio pagina) ---------- */
.media-theater {
  position: fixed; inset: 0; background: rgba(18, 51, 37, 0.92); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto;
  animation: theater-fade-in 0.25s ease;
}
/* Fondamentale: senza questa riga, "display: flex" qui sopra vince sempre
   sull'attributo HTML "hidden" (le regole CSS dell'autore hanno sempre la
   priorità sul comportamento nativo del browser per [hidden]). Senza questa
   regola il teatro video e la lightbox foto restano visibili e sovrapposti
   in permanenza, anche quando dovrebbero essere nascosti. */
.media-theater[hidden] { display: none !important; }
@keyframes theater-fade-in { from { opacity: 0; } to { opacity: 1; } }
.media-theater-inner { background: #fff; border-radius: var(--radius-lg); padding: 28px; max-width: 760px; width: 100%; position: relative; margin: auto; animation: theater-slide-up 0.3s ease; }
@keyframes theater-slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .media-theater, .media-theater-inner { animation: none; } }
.media-theater-close {
  position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--dawn); color: var(--night); border: none; font-size: 1rem; cursor: pointer; font-weight: 700;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(16,27,51,0.7); color: #fff; border: none;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; z-index: 5;
}
.lightbox-prev { left: -8px; } .lightbox-next { right: -8px; }
@media (max-width: 640px) { .lightbox-nav { display: none; } }

.reaction-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.reaction-btn { width: auto; background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 0.92rem; }
.reaction-btn:hover { border-color: var(--dawn); }
.reaction-btn.reacted { background: var(--dawn); border-color: var(--dawn); }
.reaction-count { font-weight: 700; color: var(--color-text-muted); }

.comments-section { margin-top: 24px; border-top: 1px solid var(--color-border); padding-top: 16px; }

/* ---------- COMMENTI STILE CHAT: bolla a destra + avatar a iniziali ---------- */
.comment-item {
  display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 10px;
  padding: 10px 0; animation: comment-in 0.3s ease;
}
@keyframes comment-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.comment-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--night); color: #fff; font-weight: 700; font-size: 0.85rem; font-family: var(--font-heading);
}
.comment-bubble {
  background: var(--color-bg-alt); border-radius: 14px 14px 2px 14px; padding: 10px 14px; max-width: 78%;
}
.comment-bubble strong { display: block; font-size: 0.82rem; color: var(--color-accent-dark); margin-bottom: 2px; }
.comment-bubble p { margin: 0; color: var(--color-text); font-size: 0.92rem; }