/* Frontend Styling for AI SEO Monograph & Articles */
.ai-seo-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 5px;
  background: linear-gradient(90deg, #f59e0b, #2563eb);
  z-index: 999999;
  transition: width 0.1s ease-out;
}

.ai-seo-article-content {
  font-family: inherit;
  color: inherit;
  line-height: 1.85;
}

.ai-seo-article-content h2 {
  color: inherit;
  font-size: 1.7rem;
  font-weight: 800;
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 0.45rem;
  line-height: 1.3;
}

.ai-seo-article-content h3 {
  color: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 1.85rem;
  margin-bottom: 0.5rem;
}

.ai-seo-article-content p {
  color: inherit;
  margin-bottom: 1.25rem;
}

/* Modalità scura automatica per siti dark o switcher tema */
[data-theme="dark"] .ai-seo-article-content,
body.dark-theme .ai-seo-article-content,
body.dark-mode .ai-seo-article-content,
.dark .ai-seo-article-content {
  color: #f8fafc !important;
}

[data-theme="dark"] .ai-seo-article-content p,
[data-theme="dark"] .ai-seo-article-content li,
[data-theme="dark"] .ai-seo-article-content span:not([class*="badge"]),
[data-theme="dark"] .ai-seo-article-content td,
body.dark-theme .ai-seo-article-content p,
body.dark-mode .ai-seo-article-content p {
  color: #f8fafc !important;
}

[data-theme="dark"] .ai-seo-article-content h2,
[data-theme="dark"] .ai-seo-article-content h3,
body.dark-theme .ai-seo-article-content h2,
body.dark-mode .ai-seo-article-content h2 {
  color: #ffffff !important;
  border-bottom-color: rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] .ai-seo-article-content figcaption,
body.dark-theme .ai-seo-article-content figcaption,
body.dark-mode .ai-seo-article-content figcaption {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .ai-seo-toc,
body.dark-theme .ai-seo-toc,
body.dark-mode .ai-seo-toc {
  background: #151d19 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .ai-seo-article-content table,
body.dark-theme .ai-seo-article-content table {
  background: #151d19 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] .ai-seo-article-content td,
body.dark-theme .ai-seo-article-content td {
  color: #f8fafc !important;
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .ai-seo-article-content tr:nth-child(even) td,
body.dark-theme .ai-seo-article-content tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04) !important;
}

.ai-seo-toc {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
}

.ai-seo-geological-timeline {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: #0f172a;
  border-radius: 14px;
  border: 1px solid #334155;
  color: #ffffff;
}

.ai-seo-article-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2.2rem 0;
  font-size: 0.96rem;
  background: var(--imp-surface, #151d19);
  border: 1px solid var(--imp-border, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.ai-seo-article-content th,
.ai-seo-article-content td {
  padding: 0.9rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--imp-border, rgba(255, 255, 255, 0.08));
}

.ai-seo-article-content th {
  background: var(--imp-surface-2, #1e2823);
  color: var(--imp-primary, #e5a93b);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.ai-seo-article-content tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

.ai-seo-article-content td:first-child {
  font-weight: 700;
  color: var(--imp-primary, #e5a93b);
}

.ai-seo-ebook-promo {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.ai-seo-ebook-promo:hover {
  border-color: #f59e0b;
  transform: translateY(-2px);
}

.ai-seo-featured-figure img,
.ai-seo-inline-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.ai-seo-featured-figure figcaption,
.ai-seo-inline-figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: #64748b;
  font-style: italic;
  text-align: center;
}

.ai-seo-sources-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #10b981;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2.5rem 0;
}

.ai-seo-sources-box h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.15rem;
  color: #0f172a;
}

.ai-seo-sources-box ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.94rem;
  color: #475569;
  line-height: 1.7;
}

.ai-seo-sources-box a {
  color: #2563eb;
  text-decoration: underline;
}

.imp-social-share-strip,
.ai-seo-social-share {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transition: all 0.2s ease;
}

.imp-social-share-strip a:hover,
.ai-seo-social-share a:hover {
  opacity: 0.95;
  transform: translateY(-2px);
}

.ai-seo-related-posts a:hover {
  transform: translateY(-3px);
  border-color: #3b82f6 !important;
}

.ai-seo-youtube-container iframe {
  border-radius: 12px;
}

/* Smooth Scrolling & Anchor Header Offsets */
html {
  scroll-behavior: smooth;
}

.ai-seo-article-content h2,
.ai-seo-article-content h3,
.ai-seo-geological-timeline,
.ai-seo-youtube-container,
.ai-seo-sources-box,
.ai-seo-ebook-promo {
  scroll-margin-top: 90px;
}

/* Centered Action, Community & Share Buttons */
.ai-seo-btn,
.ai-seo-btn-youtube,
.ai-seo-btn-instagram,
.ai-seo-btn-ebook,
.ai-seo-footer-box a,
.ai-seo-ebook-promo a,
.ai-seo-share-buttons a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}

.ai-seo-footer-box a {
  min-height: 48px !important;
  padding: 0.85rem 1.75rem !important;
}

.ai-seo-footer-box a span,
.ai-seo-btn span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

.ai-seo-toc ol {
  list-style-position: inside;
}

.ai-seo-toc li {
  margin-bottom: 0.35rem;
}

.ai-seo-toc a:hover {
  text-decoration: underline !important;
  color: #1d4ed8 !important;
}
