/* ==========================================================================
   Progetto: ilayda forum & AI assistant
   Autore: Turgut Keles
   Email: mail@trgtkls.it
   ========================================================================== */

/* Custom styles extracted from PHP templates. */

/* Global UI scale (like browser zoom 110%) */
:root {
  --ui-scale: 1.1;
}
html {
  font-size: calc(100% * var(--ui-scale));
}

body {
  font-family: var(--fh-font-body, "Inter", system-ui, sans-serif);
}


/* Footer «We Love ∞ Autism»: parola in font ad alta leggibilità (inclusivo / leggibile). */
.footer-autism-word {
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: 0.03em;
}

/* Simbolo ∞: gradiente arcobaleno che scorre (neurodiversità). */
.footer-autism-infinity {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    90deg,
    #e40303,
    #ff8c00,
    #ffed00,
    #008026,
    #24408e,
    #732982,
    #e40303,
    #ff8c00,
    #ffed00
  );
  background-size: 300% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: footer-autism-infinity-shift 5s linear infinite;
}

@keyframes footer-autism-infinity-shift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer-autism-infinity {
    animation: none;
    background-size: 100% 100%;
    background-position: 0% 50%;
    background-image: linear-gradient(
      90deg,
      #e40303,
      #ff8c00,
      #ffed00,
      #008026,
      #24408e,
      #732982
    );
  }
}

/* Postbit: riga staff — fill trasparente, solo striscia bianca animata (ID in articolo.php). */
.postbit-staff-tagline-animated {
  font-size: 0.71875rem;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0) 38%,
    #ffffff 50%,
    rgba(255, 255, 255, 0) 62%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 220% 100%;
  background-position: 100% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: postbit-staff-tagline-shine 3.2s ease-in-out infinite;
}

.postbit-staff-tagline-animated--comment {
  font-size: 0.65625rem;
  max-width: 7.25rem;
}

/* Postbit: stelle rank (colori per ruolo + animazione). */
.postbit-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  line-height: 1;
  font-size: 0.8em;
}
.postbit-stars .postbit-star {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
}
.postbit-stars .postbit-star-empty {
  display: inline-block;
  opacity: 0.55;
  filter: brightness(0.85);
}
.postbit-stars .postbit-star-fill {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateZ(0);
  will-change: opacity;
  animation: postbit-star-fill-scan 3.5s linear infinite;
}
.postbit-stars .postbit-star:nth-child(1) .postbit-star-fill { animation-delay: 0s; }
.postbit-stars .postbit-star:nth-child(2) .postbit-star-fill { animation-delay: 0.7s; }
.postbit-stars .postbit-star:nth-child(3) .postbit-star-fill { animation-delay: 1.4s; }
.postbit-stars .postbit-star:nth-child(4) .postbit-star-fill { animation-delay: 2.1s; }
.postbit-stars .postbit-star:nth-child(5) .postbit-star-fill { animation-delay: 2.8s; }

@keyframes postbit-star-fill-scan {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  99%  { opacity: 1; }
  100% { opacity: 0; }
}

.postbit-stars--admin {
  color: #8b0000; /* rosso sangue */
  text-shadow: 0 0 10px rgba(139, 0, 0, 0.35);
}
.postbit-stars--supermod {
  color: #a855f7; /* viola su nero */
  text-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
}
.postbit-stars--mod {
  color: #14532d; /* verde scuro */
  text-shadow: 0 0 10px rgba(20, 83, 45, 0.28);
}
.postbit-stars--default {
  color: #fbbf24; /* fallback ambra */
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.22);
}

@keyframes postbit-staff-tagline-shine {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .postbit-staff-tagline-animated {
    animation: none;
    background-image: none;
    background-size: auto;
    color: rgba(255, 255, 255, 0.55);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.55);
  }
  .postbit-stars .postbit-star {
    animation: none;
  }
  .postbit-stars .postbit-star-fill {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none;
  }
}

/**
 * Scrollbar “moderne”: sottile, pill, tono su tono (Firefox + Chrome/Safari/Edge).
 * Applicare la classe `site-scrollbar` al body e agli overflow-y-auto rilevanti.
 */
.site-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(180, 130, 138, 0.5) transparent;
}

.site-scrollbar::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.site-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.site-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(148, 110, 118, 0.45);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.site-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 154, 158, 0.65);
  background-clip: padding-box;
}

.site-scrollbar::-webkit-scrollbar-corner {
  background: transparent;
}

.admin-nav a.active {
  background: #2563eb;
  color: #fff;
}

.admin-nav a.active:hover {
  background: #1d4ed8;
  color: #fff;
}

/* Evita scroll orizzontale su mobile: il contenuto resta dentro il viewport */
main {
  overflow-x: clip;
  max-width: 100%;
}

/* Articolo: HTML da editor/WordPress (immagini larghe, code block, tabelle) */
.article-body .prose {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.article-body .prose img,
.article-body .prose video,
.article-body .prose svg:not(:root),
.article-body .prose canvas,
.article-body .prose iframe,
.article-body .prose embed,
.article-body .prose object {
  max-width: 100%;
  height: auto;
}

.article-body .prose figure,
.article-body .prose .wp-block-image,
.article-body .prose .wp-block-media-text,
.article-body .prose .wp-block-gallery,
.article-body .prose [class*="wp-block-"] {
  max-width: 100%;
  box-sizing: border-box;
}

/* Gutenberg: allinea “wide/full” al contenitore su schermi piccoli */
.article-body .prose .alignwide,
.article-body .prose .alignfull {
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

.article-body .prose table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.article-body .prose td,
.article-body .prose th {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.article-body .wp-block-code,
.article-body .wp-block-preformatted,
.article-body .wp-block-codemirror-blocks-code-block {
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

.article-body .wp-block-code pre,
.article-body .wp-block-preformatted pre {
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

/* 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). */
/* Avviso «Assistente AI attivo» (articolo.php): espandi/comprimi — freccia */
details.ai-support-active-banner summary::-webkit-details-marker {
  display: none;
}
details.ai-support-active-banner .ai-support-chevron {
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}
details.ai-support-active-banner[open] .ai-support-chevron {
  transform: rotate(180deg);
}

.header-bar {
  position: relative;
  /* I dropdown (campanella, prompt ospite) devono uscire sotto la barra senza essere tagliati */
  overflow: visible;
  /* 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: var(--fh-font-body, "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 collassava il box con iframe AdSense prima del layout completo */
  line-height: normal;
}
/* 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;
}
/* evita che l’ultimo bordo dell’iframe AdSense “tocchi” il bordo arrotondato della card */
.ad-slot iframe {
  display: block;
  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;
}

/* Campanella notifiche: attenzione senza audio */
@keyframes notif-bell-shake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  18% {
    transform: rotate(-16deg);
  }
  36% {
    transform: rotate(14deg);
  }
  54% {
    transform: rotate(-11deg);
  }
  72% {
    transform: rotate(8deg);
  }
}

/** Oscillazione continua finché ci sono notifiche non lette */
@keyframes notif-bell-pending {
  0%,
  100% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(-10deg);
  }
  40% {
    transform: rotate(9deg);
  }
  60% {
    transform: rotate(-6deg);
  }
  80% {
    transform: rotate(4deg);
  }
}

#notif-toggle.notif-bell-pending:not(.notif-bell-attention) {
  animation: notif-bell-pending 2.2s ease-in-out infinite;
  color: #fca5a5;
}

#notif-toggle.notif-bell-attention {
  animation: notif-bell-shake 0.82s ease-in-out;
  color: #fca5a5;
}

#notif-toggle.notif-bell-pending.notif-bell-attention {
  animation: notif-bell-shake 0.82s ease-in-out;
}

/* Campanella visitatori (prompt Assistente AI): attira attenzione senza essere invasiva */
@keyframes guest-assist-bell-sway {
  0%,
  100% {
    transform: rotate(0deg);
  }
  12% {
    transform: rotate(-11deg);
  }
  24% {
    transform: rotate(10deg);
  }
  36% {
    transform: rotate(-7deg);
  }
  48% {
    transform: rotate(5deg);
  }
  60% {
    transform: rotate(-3deg);
  }
  72% {
    transform: rotate(0deg);
  }
}

@keyframes guest-assist-bell-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.18);
  }
}

#guest-assist-prompt-toggle.guest-assist-bell-pulse {
  animation: guest-assist-bell-sway 2.8s ease-in-out infinite,
    guest-assist-bell-glow 2.8s ease-in-out infinite;
}

#guest-assist-prompt-toggle.guest-assist-bell-pulse[aria-expanded="true"] {
  animation: none;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  #guest-assist-prompt-toggle.guest-assist-bell-pulse {
    animation: none;
    box-shadow: none;
  }
}

/* Busta PM: movimento leggero finché ci sono messaggi non letti */
@keyframes pm-inbox-nudge {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-1px) rotate(-4deg);
  }
  50% {
    transform: translateY(1px) rotate(3deg);
  }
  75% {
    transform: translateY(-0.5px) rotate(-2deg);
  }
}

#pm-link.pm-inbox-pending {
  animation: pm-inbox-nudge 2.4s ease-in-out infinite;
  color: #fca5a5;
}

/* Menu mobile: stessa logica visiva */
@keyframes notif-row-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(248, 113, 113, 0);
  }
  50% {
    box-shadow: inset 3px 0 0 0 rgba(248, 113, 113, 0.55);
  }
}

#notif-link-mobile.notif-row-pending {
  animation: notif-row-pulse 2s ease-in-out infinite;
}

#pm-link-mobile.pm-row-pending {
  animation: notif-row-pulse 2s ease-in-out infinite;
}

/* —— Pannello admin: accessibilità, sidebar, focus —— */
.admin-panel-shell {
  background:
    radial-gradient(960px 560px at -16% -10%, rgba(14, 165, 233, 0.1), transparent 58%),
    radial-gradient(820px 500px at 110% -8%, rgba(249, 115, 22, 0.08), transparent 56%),
    #f5f8fc;
}

.admin-skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 300;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.55rem 1rem;
  clip: auto;
  overflow: visible;
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.25);
  outline: none;
}

.admin-sidebar-shell {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.admin-sidebar-brand {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.86));
}

.admin-brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(14, 116, 144, 0.18);
}

#admin-sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.35) transparent;
}

#admin-sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

#admin-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.24);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#admin-sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 0.42);
}

.admin-main-surface {
  background: transparent;
}

.admin-workspace-card,
.admin-nav-card {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.admin-workspace-card {
  padding: 0.9rem;
}

.admin-workspace-card__user {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.admin-workspace-card__avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  object-fit: cover;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.admin-workspace-card__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  color: #075985;
  font-weight: 800;
}

.admin-workspace-card__eyebrow {
  margin: 0;
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.admin-workspace-card__actions {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.admin-quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #fff;
  color: #334155;
  text-decoration: none;
  font-size: 0.73rem;
  font-weight: 700;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.admin-quick-action:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.35);
  background: #f8fafc;
  color: #0f172a;
}

.admin-quick-action--primary {
  color: #fff;
  border-color: rgba(15, 23, 42, 0.88);
  background: #0f172a;
}

/* Solo la scorciatoia della pagina corrente: nero pieno */
.admin-quick-action--active {
  color: #fff !important;
  border-color: #0f172a !important;
  background: #0f172a !important;
  box-shadow: none;
}

.admin-quick-action--active:hover {
  color: #fff !important;
  background: #020617 !important;
  border-color: #020617 !important;
  transform: translateY(-1px);
}

.admin-workspace-card__meta {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-mini-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  background: #f8fafc;
  padding: 0.32rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
}

.admin-mini-status__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #22c55e;
}

.admin-nav-stack {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.95rem;
}

.admin-nav-card {
  padding: 0.72rem;
}

.admin-nav-card__label {
  margin: 0 0 0.55rem;
  padding: 0 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 800;
}

.admin-nav-link,
.admin-nav-sublink,
.admin-disclosure-summary {
  color: #475569;
}

.admin-nav-link:hover,
.admin-nav-sublink:hover,
.admin-disclosure-summary:hover {
  color: #0f172a;
  background: #f8fafc;
}

.admin-nav-link.is-active,
.admin-nav-sublink.is-active {
  color: #fff;
  background: #0f172a;
  box-shadow: none;
}

.admin-nav-link.is-active svg {
  color: #fff;
}

.admin-nav-bullet {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(125, 211, 252, 0.85);
  box-shadow: 0 0 0 4px rgba(224, 242, 254, 0.9);
}

.admin-disclosure-body {
  margin-top: 0.4rem;
  display: grid;
  gap: 0.35rem;
}

.admin-sidebar-disclosure summary {
  list-style: none;
}

.admin-sidebar-disclosure summary::-webkit-details-marker {
  display: none;
}

.admin-sidebar-disclosure[open] > summary {
  background: #f8fafc;
  color: #0f172a;
}

.admin-sidebar-disclosure[open] .admin-sidebar-chevron {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar-shell {
    backdrop-filter: none;
  }

  .admin-quick-action,
  .admin-nav-link,
  .admin-nav-sublink {
    transition: none !important;
  }
}

/* Dashboard: area feed scrollabile */
.admin-dash-feed-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.35) transparent;
}
.admin-dash-feed-scroll::-webkit-scrollbar {
  width: 7px;
}
.admin-dash-feed-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.28);
  border-radius: 999px;
}
.admin-dash-feed-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.45);
}

/* --------------------------------------------------------------------------
   Home (index): colori categoria da DB — solo variabili CSS nel template PHP
   -------------------------------------------------------------------------- */
.home-timeline-dot--custom {
  background-color: var(--home-dot-bg);
  background-image: none;
}

.home-featured-cat-border--custom,
.home-side-cat-border--custom {
  border-color: var(--home-cat-border);
}

/* Header: onda rossa luminosa sotto la navbar (da header.php) */
body header.header-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(127,29,29,0.00) 0%,
      rgba(190,24,93,0.24) 16%,
      rgba(244,63,94,0.58) 35%,
      rgba(251,113,133,0.98) 50%,
      rgba(244,63,94,0.58) 65%,
      rgba(190,24,93,0.24) 84%,
      rgba(127,29,29,0.00) 100%);
  filter: drop-shadow(0 0 6px rgba(251,113,133,0.45)) drop-shadow(0 0 16px rgba(239,68,68,0.35));
  animation: header-center-wave 2.8s ease-in-out infinite;
  will-change: opacity, filter;
}
body header.header-bar .max-w-6xl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  pointer-events: none;
  opacity: 0.62;
  background:
    radial-gradient(52% 110% at 50% 100%, rgba(251,113,133,0.55), rgba(244,63,94,0.20) 38%, rgba(127,29,29,0.00) 72%);
  mix-blend-mode: screen;
  animation: header-center-wave-soft 2.8s ease-in-out infinite;
  will-change: opacity;
}
/* Card header arrotondata: onda segue il raggio inferiore */
body header.header-bar.fh-island::after {
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
}
#fh-outer.fh-scrolled header.header-bar.fh-island::after {
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}
@keyframes header-center-wave {
  0%, 100% {
    opacity: 0.68;
    filter: drop-shadow(0 0 5px rgba(251,113,133,0.38)) drop-shadow(0 0 12px rgba(239,68,68,0.30));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(251,113,133,0.55)) drop-shadow(0 0 20px rgba(239,68,68,0.45));
  }
}
@keyframes header-center-wave-soft {
  0%, 100% { opacity: 0.48; }
  50% { opacity: 0.82; }
}

/* Profilo: anello PM e superfici dashboard (da profilo.php) */
.profile-dash .pd-ring-bg { stroke: #4b5563; opacity: 0.55; }
.profile-dash .pd-ring-fg { stroke: #dc2626; transition: stroke-dasharray 0.45s ease; }
.pd-hub-surface {
  background-image:
    radial-gradient(ellipse 90% 55% at 12% -10%, rgba(139, 77, 82, 0.22), transparent 52%),
    radial-gradient(ellipse 70% 45% at 92% 105%, rgba(168, 85, 247, 0.14), transparent 50%),
    linear-gradient(155deg, rgba(15, 23, 42, 0.92) 0%, rgba(3, 7, 18, 0.97) 55%, rgba(17, 24, 39, 0.88) 100%),
    repeating-linear-gradient(-12deg, transparent, transparent 31px, rgba(255,255,255,0.03) 31px, rgba(255,255,255,0.03) 32px);
}
.pd-timeline-spine {
  background: linear-gradient(180deg, rgba(139, 77, 82, 0.55) 0%, rgba(168, 85, 247, 0.45) 45%, rgba(236, 72, 153, 0.35) 100%);
}

/* Editor articolo: titoli/label su pagina chiara. Non includere p/span globali: Editor.js (contenteditable)
   e checkbox usano molti span; #0f172a su sfondo scuro li rende invisibili — vedi editorjs-dark.css. */
.article-editor-shell label,
.article-editor-shell h1,
.article-editor-shell h2 {
  color: #0f172a;
}
.article-editor-shell input[type="checkbox"] + span {
  color: #1e293b;
}
.article-editor-shell a {
  color: #334155;
}
.article-editor-shell a:hover {
  color: #0f172a;
}

/* ── PM Editor ──────────────────────────────────────────────────── */
.pm-editor { position: relative; }

.pm-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .4rem .55rem;
  background: #0d0d0d;
  border: 1px solid #374151;
  border-bottom: none;
  border-radius: .75rem .75rem 0 0;
}
.pm-editor textarea {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}
.pm-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.75rem;
  padding: 0 .45rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: .4rem;
  color: #d1d5db;
  font-size: .78rem;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  line-height: 1;
  white-space: nowrap;
}
.pm-tb-btn:hover {
  background: #374151;
  border-color: #6b7280;
  color: #f9fafb;
}
.pm-tb-emoji { gap: .3rem; padding: 0 .6rem; }
.pm-tb-sep {
  display: inline-block;
  width: 1px;
  height: 1.25rem;
  background: #374151;
  margin: 0 .1rem;
  align-self: center;
}
.pm-tb-counter {
  margin-left: auto;
  font-size: .68rem;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Picker */
.pm-ep {
  position: absolute;
  bottom: calc(100% + .5rem);
  left: 0;
  z-index: 400;
  width: min(22rem, calc(100vw - 2rem));
  background: #111827;
  border: 1px solid #374151;
  border-radius: .875rem;
  box-shadow: 0 20px 50px -8px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pm-ep.hidden { display: none; }
.pm-ep-search-wrap {
  padding: .5rem .6rem .35rem;
  border-bottom: 1px solid #1f2937;
}
.pm-ep-search {
  width: 100%;
  background: #0d0d0d;
  border: 1px solid #374151;
  border-radius: .5rem;
  color: #f3f4f6;
  font-size: .75rem;
  padding: .35rem .65rem;
  outline: none;
}
.pm-ep-search:focus { border-color: #ef4444; }
.pm-ep-tabs {
  display: flex;
  padding: .3rem .4rem .25rem;
  border-bottom: 1px solid #1f2937;
  overflow-x: auto;
  scrollbar-width: none;
}
.pm-ep-tabs::-webkit-scrollbar { display: none; }
.pm-ep-tab {
  flex-shrink: 0;
  padding: .25rem .35rem;
  font-size: 1rem;
  background: none;
  border: 1px solid transparent;
  border-radius: .4rem;
  cursor: pointer;
  transition: background .1s;
  line-height: 1;
}
.pm-ep-tab:hover { background: #1f2937; }
.pm-ep-tab.active { background: #1f2937; border-color: #374151; }
.pm-ep-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .1rem;
  padding: .45rem .5rem .5rem;
  max-height: 11rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}
.pm-ep-em {
  font-size: 1.2rem;
  padding: .2rem .22rem;
  background: none;
  border: 1px solid transparent;
  border-radius: .4rem;
  cursor: pointer;
  line-height: 1;
  transition: background .1s;
}
.pm-ep-em:hover { background: #1f2937; border-color: #374151; }
.pm-ep-empty { color: #6b7280; font-size: .75rem; padding: .5rem; }

/* ── PM link mini-modal ─────────────────────────────────────────── */
.pm-link-modal {
  position: absolute;
  z-index: 500;
  width: min(20rem, calc(100vw - 2rem));
  background: #111827;
  border: 1px solid #374151;
  border-radius: .875rem;
  box-shadow: 0 20px 50px -8px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.04);
  overflow: hidden;
}
.pm-lm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .85rem .5rem;
  border-bottom: 1px solid #1f2937;
}
.pm-lm-title {
  font-size: .78rem;
  font-weight: 600;
  color: #f3f4f6;
}
.pm-lm-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: .85rem;
  cursor: pointer;
  line-height: 1;
  padding: .1rem .3rem;
  border-radius: .3rem;
  transition: color .1s, background .1s;
}
.pm-lm-close:hover { color: #f3f4f6; background: #374151; }
.pm-lm-body {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: .75rem .85rem .65rem;
}
.pm-lm-label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pm-lm-input {
  background: #0d0d0d;
  border: 1px solid #374151;
  border-radius: .5rem;
  color: #f3f4f6;
  font-size: .8rem;
  padding: .4rem .65rem;
  outline: none;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  width: 100%;
}
.pm-lm-input:focus { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.15); }
.pm-lm-foot {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .55rem .85rem .65rem;
  border-top: 1px solid #1f2937;
}
.pm-lm-cancel {
  padding: .35rem .9rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: .5rem;
  color: #9ca3af;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.pm-lm-cancel:hover { background: #374151; color: #f3f4f6; }
.pm-lm-confirm {
  padding: .35rem .9rem;
  background: #dc2626;
  border: 1px solid #b91c1c;
  border-radius: .5rem;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s;
}
.pm-lm-confirm:hover { background: #ef4444; }

/* ── PM body rendering ──────────────────────────────────────────── */
.pm-body strong { font-weight: 700; color: #f9fafb; }
.pm-body em { font-style: italic; color: #e5e7eb; }
.pm-body del { text-decoration: line-through; color: #9ca3af; }
.pm-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8em;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: .3rem;
  padding: .1em .4em;
  color: #fca5a5;
}
.pm-blockquote {
  display: block;
  border-left: 3px solid #ef4444;
  margin: .2em 0;
  padding: .25em .75em;
  background: rgba(239,68,68,.06);
  color: #d1d5db;
  font-style: italic;
  border-radius: 0 .35rem .35rem 0;
}
.pm-link {
  color: #f87171;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.pm-link:hover { color: #fca5a5; }

/* Cache notice: forza sfondo opaco indipendentemente dalle classi Tailwind */
#site-cache-notice {
  isolation: isolate;
}
#site-cache-notice > div:last-child {
  background-color: #030712 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Testo abbreviato meta articolo: visibile solo su mobile, nascosto da sm (640px) in su */
@media (min-width: 640px) {
  .meta-abbr { display: none !important; }
}

/* ── Assistente AI: bordo avatar animato arcobaleno ── */
@property --ai-av-hue {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes ai-av-spin { to { --ai-av-hue: 360deg; } }
.ai-avatar-ring {
  --ai-av-hue: 0deg;
  background: conic-gradient(from var(--ai-av-hue), #60a5fa, #a78bfa, #f472b6, #fb923c, #facc15, #4ade80, #60a5fa) !important;
  animation: ai-av-spin 4s linear infinite;
  box-shadow: none !important;
  filter: drop-shadow(0 0 7px rgba(139,92,246,0.5));
}
@media (prefers-reduced-motion: reduce) {
  .ai-avatar-ring { animation: none; background: conic-gradient(from 0deg, #60a5fa, #a78bfa, #f472b6, #fb923c, #facc15, #4ade80, #60a5fa) !important; }
}

/* ── Link interni automatici (inject_internal_links) ─────────────────── */
.seo-ilink {
  color: #a78bfa;
  text-decoration: underline;
  text-decoration-color: rgba(167,139,250,.4);
  text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s;
}
.seo-ilink:hover {
  color: #c4b5fd;
  text-decoration-color: rgba(196,181,253,.7);
}

/* ── Articolo: icone condivisione social — solo glyph, senza riquadro ─ */
.article-share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  color: rgba(203, 213, 225, 0.82);
  background: none;
  border: none;
  border-radius: 0.25rem;
  transition: color 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}
.article-share-link:hover {
  color: #f8fafc;
}
.article-share-link:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.55);
  outline-offset: 2px;
}
.article-share-link svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

/* Linea sopra «Commenti»: tratto sinistro palette Google (blu, rosso, giallo, verde) */
.article-commenti-top-rule {
  border-top: none;
  background-image: linear-gradient(
      90deg,
      #4285f4 0%,
      #4285f4 20%,
      #ea4335 20%,
      #ea4335 40%,
      #fbbc05 40%,
      #fbbc05 60%,
      #34a853 60%,
      #34a853 68%,
      rgba(52, 168, 83, 0.55) 82%,
      rgba(52, 168, 83, 0) 100%
    ),
    linear-gradient(#1f2937, #1f2937);
  background-size: min(12.5rem, calc(100% - 1rem)) 1px, 100% 1px;
  background-position: 0 0, 0 0;
  background-repeat: no-repeat;
}

/* Ping test — box riepilogo (tema scuro / default) */
#ping-test-summary.ping-test-summary--ok {
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(6, 78, 59, 0.32);
}
#ping-test-summary.ping-test-summary--warn {
  border: 1px solid rgba(245, 158, 11, 0.42);
  background: rgba(120, 53, 15, 0.28);
}
#ping-test-summary .ping-test-sum-title {
  margin: 0;
}
#ping-test-summary.ping-test-summary--ok .ping-test-sum-title {
  color: rgb(110 231 183);
}
#ping-test-summary.ping-test-summary--warn .ping-test-sum-title {
  color: rgb(253 230 138);
}
#ping-test-summary .ping-test-sum-meta {
  margin: 0;
  color: rgb(156 163 175);
}
#ping-test-summary .ping-test-sum-meta code {
  color: rgb(209 213 219);
  font-size: 0.95em;
}

