/* Simple fantasy-themed styles */
body {
  font-family: "Georgia", serif;
  background: linear-gradient(180deg, #0b1020 0%, #111318 100%);
  color: #e6e1d9;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.2rem;
}

/* Correzione header container */
.site-header .container {
  display: block;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

.site-header {
  background: url('/assets/images/texture-header.jpg') repeat;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  padding: 1rem 0;
}

.site-title a {
  color: #f6e7c1;
  text-decoration: none;
  font-size: 1.8rem;
  letter-spacing: 1px;
}

/* Barra di navigazione corretta */
.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0 0;
  gap: 0.8rem;
  justify-content: center;
}

.main-nav li {
  /* nessuna larghezza fissa */
}

.main-nav a {
  color: #d9c9a6;
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  display: inline-block;
  white-space: nowrap;
}

.main-nav a:hover {
  background: rgba(246,231,193,0.08);
  color: #fff;
}

.site-footer {
  border-top: 1px solid rgba(255,255,255,0.04);
  padding: 1rem 0;
  text-align: center;
  color: #bfb6a1;
}

/* Article headings */
h1, h2, h3 {
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  color: #f6e7c1;
}

a { color: #e6c996; }

/* === LAYOUT CON SIDEBAR === */
.layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-direction: row; /* sidebar a sinistra */
}

/* Sidebar-wrapper prende 30% */
.sidebar-wrapper {
  width: 30%;
}

/* Sidebar dentro sidebar-wrapper */
.sidebar {
  width: 100%;
}

/* Contenuto: 70% */
.page-content {
  width: 70%;
}

/* Stile news fantasy */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-list li {
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.news-list a {
  font-weight: bold;
  color: #e6c996;
  text-decoration: none;
}

.news-list a:hover {
  color: #fff;
}

.news-list small {
  display: block;
  opacity: 0.7;
  font-size: 0.75rem;
}

/* === VERSIONE MOBILE (sotto 768px) === */
@media (max-width: 767px) {
  .layout {
    flex-direction: column;
  }

  .sidebar-wrapper {
    display: none; /* nasconde di default */
    box-sizing: border-box; /* Include padding e bordo nella larghezza */
    max-width: 100vw; /* Non sfora oltre la viewport */
    overflow-x: hidden; /* Nasconde eventuale overflow orizzontale */
    margin-top: 1rem;
    border: 1px solid rgba(246, 231, 193, 0.3);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(255, 240, 210, 0.05);
    box-shadow: 0 0 10px rgba(246, 231, 193, 0.1);
    width: 100%; /* sidebar aperta tutta larghezza in mobile */
  }

  .toggle-news-btn {
    display: block;
    width: 100%;
    background: rgba(246, 231, 193, 0.1);
    border: 1px solid rgba(246, 231, 193, 0.3);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: #e6c996;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 0.8rem;
    text-align: left;
  }

  .sidebar,
  .page-content {
    width: 100% !important;
  }
}

/* Su desktop mostrale entrambe affiancate come prima */
@media (min-width: 768px) {
  .toggle-news-btn {
    display: none;
  }

  .sidebar-wrapper {
    display: block !important; /* sidebar sempre visibile */
    width: 30%;
  }
}

/* Immagini nel contenuto, responsive e centrate */
.content img, /* se hai un container con classe content */
.post-content img, /* o classe post-content */
article img, /* o direttamente img dentro articoli */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
  box-sizing: border-box;
}

/* --- PDF STANDARD DESKTOP --- */
.pdf-wrapper {
  width: 130%;
  height: 80vh;
  max-height: 900px;
  margin: 0 auto 20px auto;
  overflow: hidden;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}


/* --- MOBILE FIX COMPLETO --- */
@media (max-width: 768px) {

  /* impedisce qualsiasi scroll laterale */
  html, body {
    overflow-x: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* i contenitori che causano margini */
  .container-sistemi,
  .sistemi-content,
  .site,
  .container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* wrapper del pdf */
  .pdf-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  /* iframe PDF fullscreen, senza centraggi */
  .pdf-frame {
    width: 100% !important;
    height: 85vh !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
  }
}

.citazione {
  border-left: 4px solid #e7c818;
  padding: 0.8em 1.2em;
  margin: 1.5em 0;
  font-style: italic;
  color: #f5aa0a;
  background: #3f3f3f;
}
.citazione footer {
  margin-top: 0.5em;
  text-align: right;
  font-weight: bold;
}
