/* Custom styles extracted from PHP templates. */

body {
  font-family: "Inter", system-ui, sans-serif;
}

.admin-nav a.active {
  background: #2563eb;
  color: #fff;
}

.admin-nav a.active:hover {
  background: #1d4ed8;
  color: #fff;
}

/* Article body spacing/readability */
.article-body .prose > :is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, pre, figure, table):first-of-type {
  margin-top: 0 !important;
}
.article-body .prose p {
  margin: 0 0 1rem;
  line-height: 1.8;
}
.article-body .prose p + p {
  margin-top: 0.25rem;
}
.article-body .prose ul,
.article-body .prose ol,
.article-body .prose blockquote,
.article-body .prose pre,
.article-body .prose figure,
.article-body .prose table {
  margin: 1rem 0;
}
.article-body .prose ul {
  list-style: disc;
  padding-left: 1.4rem;
}
.article-body .prose ol {
  list-style: decimal;
  padding-left: 1.4rem;
}
.article-body .prose li {
  margin: 0.25rem 0;
}
.article-body .prose br + br {
  content: "";
  display: block;
  margin-top: 0.7rem;
}

/* Navbar: niente pseudo-elemento sotto il bordo (prima causava righe/ombre visibili in alto a sinistra).
   Il gradiente è già nell'inline style PHP (background-image). */
.header-bar {
  position: relative;
  /* Evita artefatti di subpixel tra bordo e ombra su alcuni browser */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Code blocks */
.article-body {
  min-width: 0;
}
.prose pre {
  position: relative;
  background-color: #111827;
  color: #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.9rem 1rem 0.75rem 1rem;
  border: 1px solid #1f2937;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
  width: 100%;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}
.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  display: block;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.wp-block-codemirror-blocks-code-block,
.wp-block-code {
  max-width: 100%;
  box-sizing: border-box;
}
.wp-block-codemirror-blocks-code-block pre,
.wp-block-code pre {
  width: 100%;
  overflow-x: auto;
  white-space: pre;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}
.prose pre .code-copy-btn {
  position: absolute;
  top: 0.3rem;
  right: 0.5rem;
  padding: 0.1rem 0.6rem;
  border-radius: 9999px;
  background-color: #b91c1c;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.prose pre .code-copy-btn:hover {
  background-color: #dc2626;
}

/* Article headings */
.prose h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}
.prose h3 {
  font-size: 1.25rem;
  line-height: 1.4;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Quick article modal */
#scrivi-articolo-modal {
  font-family: "Inter", system-ui, sans-serif;
}
#scrivi-articolo-modal .modal-panel {
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
#scrivi-articolo-modal:not(.hidden) .modal-panel {
  transform: scale(1);
  opacity: 1;
}
#scrivi-articolo-modal .modal-backdrop {
  backdrop-filter: blur(8px);
}
.quick-feat-zone {
  border: 2px dashed rgba(248, 113, 113, 0.35);
  border-radius: 6px;
  transition: border-color 0.2s, background 0.2s;
}
.quick-feat-zone:hover,
.quick-feat-zone.dragover {
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(248, 113, 113, 0.05);
}
.quick-feat-preview {
  max-height: 40px;
  max-width: 72px;
  object-fit: contain;
  border-radius: 4px;
}

/* --- Pubblicità sidebar articolo (sotto postbit autore) --- */
.ad-slot {
  line-height: 0;
}
/* Link che contiene solo un’immagine: tutta la larghezza dello slot */
.ad-slot a:has(> img) {
  display: block;
  width: 100%;
  max-width: 100%;
}
/* Immagine (anche verticale): larghezza = tutta la colonna, altezza proporzionale */
.ad-slot img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  vertical-align: top;
}

/*
 * Banner che “copre” tutto un riquadro ad altezza fissa (object-fit: cover).
 * Usa nel HTML: <a class="ad-banner-fill" href="..." rel="sponsored noopener" target="_blank"><img src="..." alt=""></a>
 * Rapporto 2:5 ≈ tipico skyscraper stretto; cambia in site-custom se preferisci (es. 9/16).
 */
a.ad-banner-fill,
div.ad-banner-fill {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 5;
  max-height: min(70vh, 520px);
  overflow: hidden;
  line-height: 0;
}
.ad-banner-fill img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
