/* ==========================================================================
   ROBERTA NARDI — SISTEMA COLORI, TIPOGRAFIA E LAYOUT CUSTOM
   Palette: grigio quasi nero / avorio / oro rosato
   Font: serif pulito (Lora)

   LAYOUT: usa il vero sistema flex del template (#wrapper > #main + #sidebar),
   NON la griglia .row/.col-* (che non esiste nel main.css originale).
   Header con altezza esplicita in rem (--header-height), riusata identica
   per l'aggancio della sidebar: i due numeri combaciano per costruzione,
   non per tentativi, e scalano insieme a qualunque zoom.
   ========================================================================== */

/* ==========================================================================
   LIGHTBOX & GALLERY — FIX STYLING SENZA FORZARE DISPLAY
   Override degli stili inline — NO display:flex forzato all'inizio
   ========================================================================== */

/* Overlay: NON forzo display flex se è hidden */
.lightbox-overlay[style*="display:none"] {
  display: none !important;
}

.lightbox-overlay[style*="display:flex"] {
  display: flex !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.92) !important;
  z-index: 99999 !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
}

/* Immagine: centra perfettamente */
.lightbox-overlay img {
  max-width: 90vw !important;
  max-height: 85vh !important;
  object-fit: contain !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6) !important;
}

/* ========== PULSANTE CLOSE — ELIMINA BORDI ROSSI, ORA ORO ========== */
.lightbox-overlay button[onclick*="closeLightbox"] {
  position: absolute !important;
  top: 18px !important;
  right: 24px !important;
  background: none !important;
  border: 2px solid #C9A961 !important;
  color: #C9A961 !important;
  font-size: 1.6rem !important;
  cursor: pointer !important;
  line-height: 1 !important;
  z-index: 10 !important;
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 4px !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.lightbox-overlay button[onclick*="closeLightbox"]:hover {
  background: #C9A961 !important;
  color: #1A1C20 !important;
}

.lightbox-overlay button[onclick*="closeLightbox"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* ========== PULSANTI FRECCE — ELIMINA BORDI ROSSI, ORA ORO ========== */
.lightbox-overlay button[onclick*="moveLightbox"] {
  position: absolute !important;
  background: #C9A961 !important;
  border: 1px solid #C9A961 !important;
  color: #1A1C20 !important;
  font-size: 2rem !important;
  cursor: pointer !important;
  padding: 12px 18px !important;
  border-radius: 4px !important;
  z-index: 10 !important;
  font-weight: bold !important;
  transition: all 0.2s ease !important;
  transform: translateY(-50%) !important;
  top: 50% !important;
  outline: none !important;
  box-shadow: none !important;
}

.lightbox-overlay button[onclick*="moveLightbox"]:hover {
  background: #B89850 !important;
  border-color: #B89850 !important;
}

.lightbox-overlay button[onclick*="moveLightbox"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Freccia sinistra */
.lightbox-overlay button[onclick*="moveLightbox"][onclick*="-1"] {
  left: 16px !important;
  right: auto !important;
}

/* Freccia destra */
.lightbox-overlay button[onclick*="moveLightbox"][onclick*=",1"] {
  right: 16px !important;
  left: auto !important;
}

/* Counter testo — visibile */
.lightbox-overlay div[style*="color:rgba(255"] {
  color: rgba(255, 255, 255, 0.7) !important;
  margin-top: 10px !important;
  font-size: 0.9rem !important;
  z-index: 2 !important;
}

/* Mobile: frecce sotto immagine, alle due estremità */
@media screen and (max-width: 768px) {
  .lightbox-overlay button[onclick*="moveLightbox"] {
    position: absolute !important;
    top: auto !important;
    bottom: 80px !important;
    transform: none !important;
    font-size: 1.5rem !important;
    padding: 8px 14px !important;
  }

  /* Freccia sinistra: estremità sinistra */
  .lightbox-overlay button[onclick*="moveLightbox"][onclick*="-1"] {
    left: 20px !important;
    right: auto !important;
  }

  /* Freccia destra: estremità destra */
  .lightbox-overlay button[onclick*="moveLightbox"][onclick*=",1"] {
    right: 20px !important;
    left: auto !important;
  }
}

/* ==========================================================================
   DECAP CMS — Nascondi la griglia nativa di immagini della media library
   Target le singole card con selettore di classe stabile
   ========================================================================== */

/* Nascondi il padre del contenitore virtuale */
div[style*="overflow: auto"][style*="will-change"] {
  display: none !important;
}

/* Se sopra non funziona, nascondi le card singole */
div[class*="Card"][class*="e2etv5a5"] {
  display: none !important;
}

:root {
  --bg-primary: #1A1C20;       /* grigio quasi nero — sfondo principale */
  --bg-secondary: #22252B;     /* leggermente più chiaro — sidebar, box */
  --bg-tertiary: #14161A;      /* più scuro — header, footer */
  --text-primary: #F5F1E8;     /* avorio — testo principale */
  --text-muted: #B8B2A3;       /* avorio spento — testo secondario */
  --gold: #C9A961;             /* oro rosato — accenti, divisori, bottoni */
  --gold-soft: rgba(201, 169, 97, 0.35);
  --font-serif: "Lora", "Georgia", serif;
  --header-height: 5.5rem;     /* UNICA fonte di verità per l'altezza header */
  --sidebar-width: 24rem;
}

* {
  box-sizing: border-box;
}

/* ---- Tipografia ---- */
body, input, select, textarea {
  font-family: var(--font-serif) !important;
  color: var(--text-muted) !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
}

p, li {
  color: var(--text-muted);
}

body {
  background: var(--bg-primary) !important;
  margin: 0 !important;
}

a {
  color: var(--gold) !important;
  text-decoration: none;
}

a:hover {
  color: var(--text-primary) !important;
}

/* ==========================================================================
   HEADER — barra fissa in alto, altezza esplicita e costante
   ========================================================================== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  background-color: var(--bg-tertiary) !important;
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0 3rem;
  overflow-y: hidden; /* garantisce che l'header non superi mai --header-height */
}

#header h1 {
  margin: 0;
  font-size: 1.9rem;
  white-space: nowrap;
}

#header h1 a {
  color: var(--text-primary) !important;
}

#menu {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#menu::-webkit-scrollbar {
  display: none;
}

#menu ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

#menu li {
  margin: 0 !important;
  padding: 0 !important;
  border-top: none !important;
}

#menu a {
  color: var(--text-muted) !important;
  font-size: 0.95rem;
}

#menu a:hover {
  color: var(--gold) !important;
}

/* ==========================================================================
   WRAPPER — flex reale del template: #main (fluido) + #sidebar (larghezza fissa)
   ========================================================================== */
#wrapper {
  display: flex !important;
  flex-direction: row !important; /* il template usa row-reverse: lo forziamo a row per avere sidebar a destra */
  align-items: flex-start !important;
  min-height: calc(100vh - var(--header-height));
  margin-top: var(--header-height); /* spazio per l'header fisso: STESSO valore di --header-height */
}

#main {
  flex: 1 1 auto;
  min-width: 0; /* previene overflow dei figli in flex */
  width: auto !important;
}

#main > .inner {
  padding: 3rem 3rem 4rem 3rem;
  max-width: 60rem;
  margin: 0 auto;
}

/* ==========================================================================
   SIDEBAR — larghezza fissa, agganciata a --header-height, sempre visibile
   ========================================================================== */
#sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  position: sticky;
  top: var(--header-height); /* STESSO valore usato dall'header: combaciano per costruzione */
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background-color: var(--bg-primary) !important;
  border-left: 1px solid rgba(201, 169, 97, 0.15);
}

#sidebar > .inner {
  padding: 2.5rem 2rem;
}

#sidebar h3 {
  font-size: 1.1rem;
}

/* ---- Box (Chi sono, Cosa faccio, Rassegna Stampa) ---- */
.box {
  background-color: var(--bg-secondary) !important;
  border: 1px solid rgba(201, 169, 97, 0.15);
  border-radius: 4px;
  padding: 2.5rem;
  margin-bottom: 2.5rem;
}

.box header.major {
  margin-bottom: 1.5rem;
}

/* Sovrascrive il divisorio rosso originale (#f56a6a) del template con l'oro */
header.major > :last-child {
  border-bottom: solid 3px var(--gold) !important;
}

/* ---- Griglia servizi "Cosa faccio" (custom, non dipende da classi Editorial) ---- */
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
}

@media screen and (max-width: 60rem) {
  .service-grid {
    grid-template-columns: 1fr;
  }
}

.service-item h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

/* ---- Divisori dorati ---- */
hr {
  border: none;
  border-bottom: 1px solid rgba(201, 169, 97, 0.25);
  margin: 2rem 0;
}

/* ---- Bio sidebar (mini-posts) ---- */
.mini-posts article {
  border: none;
  margin: 0;
  padding: 0;
}

.mini-posts .image {
  display: block;
  margin-bottom: 1.2rem;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(201, 169, 97, 0.25);
}

.mini-posts .image img {
  display: block;
  width: 100%;
  height: auto;
}

.mini-posts article p {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ---- Contatti ---- */
.contact-method {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  font-size: 0.92rem;
}

.contact-method .icon {
  color: var(--gold) !important;
  width: 1.2rem;
  text-align: center;
}

/* ---- Bottoni / CTA con ombra dorata ---- */
.button {
  display: inline-block;
  background-color: transparent !important;
  color: var(--gold) !important;
  border: 1px solid var(--gold) !important;
  padding: 0.6rem 1.4rem;
  border-radius: 3px;
  box-shadow: 0 0 12px var(--gold-soft) !important;
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.button:hover {
  background-color: var(--gold) !important;
  color: var(--bg-primary) !important;
  box-shadow: 0 0 20px var(--gold-soft) !important;
}

/* ---- Footer ---- */
#footer {
  background-color: var(--bg-tertiary) !important;
  text-align: center;
  padding: 2rem;
}

#footer .copyright {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* ==========================================================================
   RASSEGNA STAMPA — card articoli generati dal build script
   ========================================================================== */

.press-list {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.press-item {
  border-left: 3px solid var(--gold);
  padding: 1.2rem 1.5rem;
  background: rgba(201, 169, 97, 0.04);
  border-radius: 0 4px 4px 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.press-item:hover {
  background: rgba(201, 169, 97, 0.09);
  border-color: var(--text-primary);
}

.press-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
}

.press-cat {
  background: var(--gold);
  color: var(--bg-primary);
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.press-fonte {
  color: var(--text-primary);
  font-weight: 600;
}

.press-data {
  color: var(--text-muted);
  font-style: italic;
}

.press-titolo {
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  margin: 0 0 0.5rem 0 !important;
  line-height: 1.4 !important;
}

.press-title-link {
  color: var(--text-primary) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.press-title-link:hover {
  color: var(--gold) !important;
}

.press-abstract {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.8rem 0;
  line-height: 1.6;
}

.press-link.button.small {
  font-size: 0.82rem !important;
  padding: 0.35rem 0.9rem !important;
}

/* ==========================================================================
   BOTTONE HAMBURGER — nascosto su desktop, mostrato solo sotto la soglia mobile
   ========================================================================== */
#menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.32rem;
  width: 2.4rem;
  height: 2.4rem;
  background: transparent;
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

#menu-toggle span {
  display: block;
  width: 1.3rem;
  height: 2px;
  background: var(--gold);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#menu-toggle.is-active span:nth-child(1) {
  transform: translateY(0.42rem) rotate(45deg);
}

#menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

#menu-toggle.is-active span:nth-child(3) {
  transform: translateY(-0.42rem) rotate(-45deg);
}

/* ==========================================================================
   RESPONSIVE — sotto 64rem: header con hamburger, menu a tendina, sidebar
   torna in flusso normale (niente sticky/fixed, niente pannelli fantasma)
   ========================================================================== */
@media screen and (max-width: 80rem) {

  #header {
    padding: 0 1.5rem;
  }

  #menu-toggle {
    display: flex;
  }

  /* Menu: dropdown sotto l'header, chiuso di default */
  #menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--gold);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 999;
  }

  #menu.is-open {
    max-height: 20rem;
  }

  #menu ul {
    flex-direction: column;
    gap: 0;
    padding: 1rem 1.5rem;
  }

  #menu li {
    border-bottom: 1px solid rgba(201, 169, 97, 0.12);
  }

  #menu li:last-child {
    border-bottom: none;
  }

  #menu a {
    display: block;
    padding: 0.9rem 0;
    font-size: 0.95rem;
  }

  /* Wrapper e sidebar: flusso normale, niente più fixed/sticky */
  #wrapper {
    flex-direction: column !important;
  }

  #sidebar {
    width: 100%;
    flex-basis: auto;
    position: static;
    max-height: none;
    overflow: visible;
    border-left: none;
    border-top: 1px solid rgba(201, 169, 97, 0.15);
    box-shadow: none !important;
    z-index: auto !important;
  }

  /* Il template originale imposta .inner a position:absolute (per il suo
     pannello a scomparsa) fino a 1280px — soglia più larga della nostra.
     Va neutralizzato esplicitamente, altrimenti il contenuto esce dal
     flusso e si sovrappone al contenuto principale. */
  #sidebar > .inner {
    position: static !important;
    height: auto !important;
    top: auto !important;
    left: auto !important;
    overflow: visible !important;
  }

  #sidebar > .inner::after {
    display: none !important;
  }

  #main > .inner {
    padding: 2rem 1.5rem 3rem 1.5rem;
  }

  .service-grid {
    gap: 1.5rem;
  }
}

/* ==========================================================================
   OVERRIDE GLOBALE — Annulla i comportamenti panel/overlay del tema Editorial
   che nascondono la sidebar (e quindi l'immagine) a tutti i breakpoint.
   Il tema gestisce #sidebar come pannello a scomparsa via JS (main.js):
   poiché non lo carichiamo, neutralizziamo le regole CSS che dipendono
   da quel meccanismo (position:fixed, margin-left negativo, box-shadow overlay).
   ========================================================================== */

/* Sotto 1680px: il tema applica margin-left:-24em quando sidebar.inactive */
@media screen and (max-width: 1680px) {
  #sidebar,
  #sidebar.inactive {
    margin-left: 0 !important;
    box-shadow: none !important;
  }
}

/* Sotto 1280px: il tema mette sidebar in position:fixed overlay + display:none
   con is-preload. Entrambi vanno annullati. */
@media screen and (max-width: 1280px) {
  #sidebar {
    position: static !important;
    height: auto !important;
    top: auto !important;
    left: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    margin-left: 0 !important;
  }

  #sidebar.inactive {
    box-shadow: none !important;
    margin-left: 0 !important;
  }

  /* Il tema nasconde la sidebar con display:none su body.is-preload (rimossa
     da main.js al load). Poiché non carichiamo main.js, la sidebar
     rimarrebbe nascosta per sempre senza questo override. */
  body.is-preload #sidebar {
    display: block !important;
  }

  #sidebar > .inner {
    position: static !important;
    height: auto !important;
    top: auto !important;
    left: auto !important;
    overflow: visible !important;
  }

  #sidebar > .inner::after {
    display: none !important;
  }
}
