/* ============================================
   BLOG POST — Ultra Design System Aligned
   Uses native Ultra tokens: --accent-cyan, --accent-purple,
   --text-primary, --text-secondary, --glow-blue
   No custom --blog-* variables.
   ============================================ */

/* --- Hero override for blog post titles --- */
.blog-post-page .hero-title {
  text-transform: none;
  letter-spacing: 0;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
}

.blog-post-page .hero-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.25rem);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Layout --- */
.blog-layout {
  align-items: flex-start;
}

#blog-container {
  position: relative;
  z-index: 2;
}

/* --- Breadcrumb override --- */
.blog-post-page .breadcrumb-nav {
  display: block !important;
  position: relative;
  top: auto;
  margin: 78px 0 0.75rem;
  padding: 0.35rem 0;
  z-index: 2;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (max-width: 992px) {
  .blog-post-page .breadcrumb-nav {
    margin-top: 70px;
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
  }
}

/* --- Article typography (blog-content s'applique au lead et aux section bodies) --- */
.blog-content {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  width: 100%;
  max-width: none;
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
}

@media (min-width: 992px) {
  .blog-content {
    font-size: 1.05rem;
    line-height: 1.75;
  }
}

.blog-content p {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.blog-content .lead {
  font-size: clamp(1.04rem, 2vw, 1.22rem);
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-cyan);
  padding-left: 0.85rem;
  margin-bottom: 1.35rem;
}

.blog-content h3 {
  color: var(--text-primary);
  font-weight: 700;
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
}

.blog-content ul,
.blog-content ol {
  margin-bottom: 1.2rem;
  padding-left: 1.4rem;
}

.blog-content li {
  margin-bottom: 0.55rem;
  color: var(--text-primary);
}

.blog-content ul li::marker {
  color: var(--accent-cyan);
}

/* --- Blog alerts --- */
.blog-alert {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin: 1.2rem 0;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.blog-alert-icon {
  font-size: 1.2rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.blog-alert.info {
  border-left: 3px solid var(--accent-cyan);
}

.blog-alert.success {
  border-left: 3px solid var(--accent-green, #4ade80);
}

.blog-alert.warning {
  border-left: 3px solid var(--accent-orange, #ff6b35);
}

/* --- Tables --- */
.blog-post-page .table-responsive {
  margin: 1.25rem 0;
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.table-ultra {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.table-ultra th,
.table-ultra td {
  padding: 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
}

.table-ultra th {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-cyan);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 0.78rem;
}

/* --- Author bio --- */
.author-bio {
  padding: 1.2rem;
  margin-top: 1.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.95rem;
}

@media (min-width: 768px) {
  .author-bio {
    flex-direction: row;
    text-align: left;
    gap: 1.2rem;
    padding: 1.4rem;
  }
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-cyan);
}

/* --- Reading progress --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 9999;
}

.reading-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-cyan, #00d4ff), var(--accent-purple, #d946ef));
  box-shadow: 0 0 14px var(--glow-blue, rgba(0, 212, 255, 0.5));
}

/* --- TOC Sidebar --- */
.toc-sidebar {
  position: relative;
  top: 0;
  padding: 1.05rem;
  max-height: calc(100vh - 116px);
  overflow: hidden;
}

@media (min-width: 992px) {
  .blog-sidebar-col {
    position: sticky;
    top: 104px;
    align-self: flex-start;
    height: fit-content;
  }
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 52vh;
  overflow: auto;
  padding-right: 0.18rem;
  counter-reset: sec;
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.26) transparent;
}

.toc-nav::-webkit-scrollbar {
  width: 5px;
}

.toc-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.26);
  border-radius: 999px;
}

.toc-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  transition: all 0.22s ease;
  line-height: 1.34;
}

.toc-link::before {
  counter-increment: sec;
  content: counter(sec);
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-top: 0.12rem;
}

.toc-link:hover,
.toc-link.active {
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.34);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.14), rgba(0, 212, 255, 0.03));
  transform: translateX(2px);
}

.toc-link.active::before,
.toc-link:hover::before {
  color: var(--accent-cyan);
}

.toc-link:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.34);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.14), rgba(0, 212, 255, 0.03));
}

.toc-share {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.toc-share-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.75);
  transition: all 0.24s ease;
}

.toc-share-btn:hover {
  color: #fff;
  border-color: rgba(0, 212, 255, 0.55);
  background: rgba(0, 212, 255, 0.22);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.25);
  transform: translateY(-1px);
}

/* --- Section cards (une glass-card par H2) --- */
.blog-section-card {
  padding: 1.6rem 1.8rem;
  overflow: hidden;
}

.blog-section-card:hover {
  transform: none;
  box-shadow: none;
}

.blog-section-card::before {
  display: none;
}

.blog-section-card h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  scroll-margin-top: 128px;
}

.blog-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.22), rgba(217, 70, 239, 0.12));
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* --- Lead (intro avant le premier H2) --- */
.blog-lead {
  padding: clamp(1rem, 2.5vw, 1.6rem);
}

/* --- Section body typography --- */
.blog-section-body {
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.7;
}

@media (min-width: 992px) {
  .blog-section-body {
    font-size: 1.05rem;
    line-height: 1.75;
  }
}

/* --- Inline code --- */
.blog-content code {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.17rem 0.4rem;
  border-radius: 7px;
  color: var(--accent-cyan);
  font-family: "Fira Code", monospace;
  font-size: 0.88em;
}

/* --- Reveal animations --- */
[data-reveal] {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.66s ease, transform 0.66s ease;
}

.js .blog-post-page [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
}

.js .blog-post-page [data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- prefers-reduced-motion : désactive les animations pour les utilisateurs sensibles --- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  .js .blog-post-page [data-reveal],
  .js .blog-post-page [data-reveal].revealed {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* --- Utility --- */
.border-left-accent {
  border-left: 4px solid var(--accent-cyan);
}

/* --- Mobile responsive --- */
@media (max-width: 991.98px) {
  .blog-article-content {
    border-radius: 16px;
  }

  .blog-article-content > .blog-content {
    padding: 0.85rem;
    font-size: 1rem;
    line-height: 1.66;
  }

  .blog-article-content > .blog-content h2 {
    font-size: 1.5rem;
    line-height: 1.15;
  }
}
