/* =========================================================================
   pdfpv — anteprima PDF elegante (self-hosted, GDPR-safe)
   Leonardo Network — brigatafolgore.net
   Tutte le regole sono ancorate a .pdfpv per vincere su tema/prose.
   ========================================================================= */

.pdfpv {
  --pdfpv-accent: #7a1f2b;
  --pdfpv-accent-hover: #000000;
  --pdfpv-on-accent: #ffffff;
  --pdfpv-bg: #ffffff;
  --pdfpv-stage: #eef0f3;
  --pdfpv-border: #e2e5ea;
  --pdfpv-text: #1c2126;
  --pdfpv-muted: #6b7280;
  --pdfpv-radius: 14px;
  --pdfpv-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);

  display: block !important;
  max-width: 560px;
  margin: 1.75rem 0 !important;
  padding: 0 !important;
  background: var(--pdfpv-bg) !important;
  border: 1px solid var(--pdfpv-border);
  border-radius: var(--pdfpv-radius);
  box-shadow: var(--pdfpv-shadow);
  overflow: hidden;
  color: var(--pdfpv-text);
  font-family: inherit;
  line-height: 1.4;
}
.pdfpv * { box-sizing: border-box; }
.pdfpv figure, .pdfpv figcaption { margin: 0 !important; padding: 0; background: none; }

.pdfpv .pdfpv__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 26px 22px;
  margin: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .7), transparent 60%),
    var(--pdfpv-stage) !important;
  min-height: 220px;
}

.pdfpv .pdfpv__link {
  display: inline-block !important;
  line-height: 0;
  text-decoration: none !important;
  border-radius: 6px;
  transition: transform .18s ease;
  outline: none;
  background: none !important;
}
.pdfpv .pdfpv__link:hover { transform: translateY(-2px); text-decoration: none !important; }
.pdfpv .pdfpv__link:focus-visible { box-shadow: 0 0 0 3px rgba(122, 31, 43, .35); }

.pdfpv .pdfpv__sheet {
  position: relative;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .10);
}
.pdfpv .pdfpv__sheet::before,
.pdfpv .pdfpv__sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .10);
  z-index: -1;
}
.pdfpv .pdfpv__sheet::before { transform: translate(6px, 6px);   opacity: .55; }
.pdfpv .pdfpv__sheet::after  { transform: translate(11px, 11px); opacity: .30; }
.pdfpv.pdfpv--single .pdfpv__sheet::before,
.pdfpv.pdfpv--single .pdfpv__sheet::after { display: none; }

.pdfpv .pdfpv__canvas { display: block; border-radius: 4px; max-width: 100%; height: auto; }

.pdfpv .pdfpv__pages {
  position: absolute;
  right: 16px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  font-size: 12px; font-weight: 600;
  color: #fff !important;
  background: rgba(20, 24, 30, .78);
  border-radius: 999px;
}
.pdfpv .pdfpv__pages svg { width: 13px; height: 13px; }

.pdfpv .pdfpv__hint {
  position: absolute; inset: auto 0 0 0;
  display: flex; justify-content: center;
  padding-bottom: 14px;
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.pdfpv .pdfpv__link:hover .pdfpv__hint,
.pdfpv .pdfpv__link:focus-visible .pdfpv__hint { opacity: 1; }
.pdfpv .pdfpv__hint span {
  font-size: 12px; font-weight: 600; color: #fff !important;
  background: rgba(20, 24, 30, .82); padding: 5px 11px; border-radius: 999px;
}

.pdfpv .pdfpv__bar {
  display: flex !important; align-items: center; gap: 14px;
  padding: 14px 16px !important; margin: 0 !important;
  border-top: 1px solid var(--pdfpv-border);
  background: var(--pdfpv-bg) !important;
  color: var(--pdfpv-text) !important;
}

.pdfpv .pdfpv__icon {
  flex: 0 0 auto; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 9px;
  background: color-mix(in srgb, var(--pdfpv-accent) 12%, #fff);
  color: var(--pdfpv-accent);
}
.pdfpv .pdfpv__icon svg { width: 22px; height: 22px; }

.pdfpv .pdfpv__meta { min-width: 0; flex: 1 1 auto; }
.pdfpv .pdfpv__name {
  display: block; font-weight: 600; font-size: 15px; line-height: 1.25;
  color: var(--pdfpv-text) !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pdfpv .pdfpv__sub {
  display: block; margin-top: 2px; font-size: 12.5px;
  color: var(--pdfpv-muted) !important;
}

.pdfpv .pdfpv__btn {
  flex: 0 0 auto;
  display: inline-flex !important; align-items: center; gap: 8px;
  padding: 10px 18px !important;
  font-size: 13.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  text-decoration: none !important;
  color: var(--pdfpv-on-accent) !important;
  background: var(--pdfpv-accent) !important;
  border: none; border-radius: 10px; cursor: pointer;
  transition: background .16s ease, transform .12s ease;
}
.pdfpv .pdfpv__btn:hover {
  background: var(--pdfpv-accent-hover) !important;
  color: var(--pdfpv-on-accent) !important;
  text-decoration: none !important;
}
.pdfpv .pdfpv__btn:active { transform: translateY(1px); }
.pdfpv .pdfpv__btn:focus-visible { box-shadow: 0 0 0 3px rgba(122, 31, 43, .35); outline: none; }
.pdfpv .pdfpv__btn svg { width: 16px; height: 16px; }

.pdfpv .pdfpv__skeleton {
  display: block; width: 150px; height: 200px; border-radius: 4px;
  background: linear-gradient(100deg, #e7eaee 30%, #f3f5f8 50%, #e7eaee 70%);
  background-size: 200% 100%;
  animation: pdfpv-shimmer 1.2s ease-in-out infinite;
}
@keyframes pdfpv-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 480px) {
  .pdfpv .pdfpv__bar { flex-wrap: wrap; }
  .pdfpv .pdfpv__btn { flex: 1 1 100%; justify-content: center; }
  .pdfpv .pdfpv__stage { min-height: 180px; padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .pdfpv .pdfpv__link, .pdfpv .pdfpv__btn, .pdfpv .pdfpv__hint { transition: none; }
  .pdfpv .pdfpv__skeleton { animation: none; }
}

/* =========================================================================
   Override rinforzati — vincono su regole del tema con !important su
   figure/figcaption (didascalie immagini) dentro .article-content / prose.
   ========================================================================= */
.article-content .pdfpv,
.prose .pdfpv,
.pdfpv {
  background: var(--pdfpv-bg) !important;
}
.article-content .pdfpv .pdfpv__bar,
.prose .pdfpv .pdfpv__bar,
.pdfpv figcaption.pdfpv__bar {
  background: var(--pdfpv-bg) !important;
  color: var(--pdfpv-text) !important;
  border-top: 1px solid var(--pdfpv-border) !important;
  text-align: left !important;
  font-style: normal !important;
  font-size: 14px !important;
}
.article-content .pdfpv .pdfpv__name,
.prose .pdfpv .pdfpv__name,
.pdfpv figcaption.pdfpv__bar .pdfpv__name {
  color: var(--pdfpv-text) !important;
  font-style: normal !important;
}
.article-content .pdfpv .pdfpv__sub,
.prose .pdfpv .pdfpv__sub,
.pdfpv figcaption.pdfpv__bar .pdfpv__sub {
  color: var(--pdfpv-muted) !important;
  font-style: normal !important;
}
.article-content .pdfpv .pdfpv__btn,
.prose .pdfpv .pdfpv__btn,
.pdfpv figcaption.pdfpv__bar .pdfpv__btn {
  color: var(--pdfpv-on-accent) !important;
  background: var(--pdfpv-accent) !important;
}
