/* ============================================================
   MatDev — Pages ressources : motion design (main uniquement)
   Navbar + footer non concernés
   ============================================================ */

.seo-main {
  position: relative;
  isolation: isolate;
  overflow: clip;
}

/* --- Ambiance globale du contenu --- */
.seo-main__ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.seo-ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: seoAmbientDrift 22s ease-in-out infinite alternate;
}

.seo-ambient-orb--1 {
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  top: 8%;
  left: -12%;
  background: radial-gradient(circle, rgba(118, 87, 255, 0.55), transparent 70%);
}

.seo-ambient-orb--2 {
  width: min(45vw, 360px);
  height: min(45vw, 360px);
  top: 42%;
  right: -10%;
  background: radial-gradient(circle, rgba(32, 199, 232, 0.45), transparent 70%);
  animation-delay: -8s;
  animation-duration: 26s;
}

.seo-ambient-orb--3 {
  width: min(38vw, 300px);
  height: min(38vw, 300px);
  bottom: 5%;
  left: 30%;
  background: radial-gradient(circle, rgba(232, 197, 71, 0.25), transparent 70%);
  animation-delay: -14s;
  animation-duration: 20s;
}

@keyframes seoAmbientDrift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -18px) scale(1.06); }
  100% { transform: translate(-16px, 12px) scale(0.96); }
}

.seo-main > *:not(.seo-main__ambient) {
  position: relative;
  z-index: 1;
}

/* --- Hero motion renforcé --- */
.seo-main .seo-hero__content,
.seo-main .seo-hero__visual {
  will-change: transform;
}

.seo-main .seo-hero__orb-card {
  transform-style: preserve-3d;
}

.seo-main .seo-hero__orb-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.07) 50%, transparent 58%);
  transform: translateX(-130%);
  animation: seoShineSweep 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes seoShineSweep {
  0%, 72% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

.seo-main .hero-animate {
  opacity: 0;
  transform: translateY(22px);
  animation: seoHeroIn 0.9s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1)) forwards;
  animation-delay: calc(0.08s + var(--hero-i, 1) * 0.1s);
}

@keyframes seoHeroIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Orbes par section --- */
.seo-section__orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.seo-section__orb {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.22;
  animation: seoSectionOrb 14s ease-in-out infinite alternate;
}

.seo-section__orb:first-child {
  top: 10%;
  right: 5%;
  background: rgba(118, 87, 255, 0.5);
}

.seo-section__orb--alt {
  bottom: 8%;
  left: 0;
  background: rgba(32, 199, 232, 0.4);
  animation-delay: -5s;
  animation-duration: 18s;
}

@keyframes seoSectionOrb {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-20px, 16px); }
}

/* --- Prose animée --- */
.seo-prose-wrap {
  position: relative;
  padding: 1.25rem 1.35rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008));
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.seo-prose-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-1, #7657ff), var(--accent-2, #20c7e8), transparent);
  opacity: 0.6;
}

.seo-prose--motion > * {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.65s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 0.65s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1));
}

.seo-prose--motion.is-animated > * {
  opacity: 1;
  transform: translateY(0);
}

.seo-prose--motion.is-animated > *:nth-child(1) { transition-delay: 0ms; }
.seo-prose--motion.is-animated > *:nth-child(2) { transition-delay: 60ms; }
.seo-prose--motion.is-animated > *:nth-child(3) { transition-delay: 120ms; }
.seo-prose--motion.is-animated > *:nth-child(4) { transition-delay: 180ms; }
.seo-prose--motion.is-animated > *:nth-child(5) { transition-delay: 240ms; }
.seo-prose--motion.is-animated > *:nth-child(6) { transition-delay: 300ms; }
.seo-prose--motion.is-animated > *:nth-child(7) { transition-delay: 360ms; }
.seo-prose--motion.is-animated > *:nth-child(8) { transition-delay: 420ms; }

.seo-prose--motion li {
  position: relative;
  padding-left: 0.15rem;
}

.seo-prose--motion li::marker {
  color: var(--accent-1-light, #a78bfa);
}

/* --- Glow cards (suit la souris via JS) --- */
[data-glow-card] {
  position: relative;
  overflow: hidden;
}

[data-glow-card] .seo-callout__glow,
[data-glow-card] .seo-toc__glow,
[data-glow-card] .seo-cta-final__glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(118, 87, 255, 0.35), transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}

[data-glow-card]:hover .seo-callout__glow,
[data-glow-card]:hover .seo-toc__glow,
[data-glow-card]:hover .seo-cta-final__glow,
[data-glow-card].is-glow-active .seo-callout__glow,
[data-glow-card].is-glow-active .seo-toc__glow,
[data-glow-card].is-glow-active .seo-cta-final__glow {
  opacity: 1;
}

/* --- TOC premium --- */
.seo-toc {
  position: relative;
  overflow: hidden;
}

.seo-toc__list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  border-radius: 6px;
  transition:
    color 0.25s ease,
    transform 0.3s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1)),
    padding-left 0.3s ease;
}

.seo-toc__list a::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(118, 87, 255, 0.35);
  transform: scale(0);
  transition: transform 0.3s ease, background 0.3s ease;
}

.seo-toc__list a.is-active::before,
.seo-toc__list a:hover::before {
  transform: scale(1);
  background: var(--accent-2, #20c7e8);
}

.seo-toc__list a.is-active {
  color: #fff;
  padding-left: 0.25rem;
}

/* --- Process : ligne de connexion --- */
.seo-section--process .seo-process {
  position: relative;
}

.seo-section--process .seo-process::before {
  content: '';
  position: absolute;
  left: 2.5rem;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-1, #7657ff), var(--accent-2, #20c7e8));
  opacity: 0.25;
  border-radius: 2px;
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 1.2s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1));
}

.seo-section--process .seo-process.reveal-stagger.is-visible::before {
  transform: scaleY(1);
}

.seo-process__num {
  position: relative;
  z-index: 1;
  animation: seoNumPulse 3s ease-in-out infinite;
}

@keyframes seoNumPulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(118, 87, 255, 0.35); }
  50% { box-shadow: 0 6px 24px rgba(32, 199, 232, 0.45); }
}

/* --- Benefits icon --- */
.seo-benefits__icon {
  animation: seoBenefitIcon 4s ease-in-out infinite;
}

@keyframes seoBenefitIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* --- Table rows stagger --- */
.seo-table__body > tr {
  opacity: 0;
  transform: translateX(-12px);
  transition:
    opacity 0.5s ease,
    transform 0.5s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1)),
    background 0.25s ease;
}

.seo-table__body.is-visible > tr {
  opacity: 1;
  transform: translateX(0);
}

.seo-table__body.is-visible > tr:nth-child(1) { transition-delay: 0ms; }
.seo-table__body.is-visible > tr:nth-child(2) { transition-delay: 70ms; }
.seo-table__body.is-visible > tr:nth-child(3) { transition-delay: 140ms; }
.seo-table__body.is-visible > tr:nth-child(4) { transition-delay: 210ms; }
.seo-table__body.is-visible > tr:nth-child(5) { transition-delay: 280ms; }
.seo-table__body.is-visible > tr:nth-child(6) { transition-delay: 350ms; }
.seo-table__body.is-visible > tr:nth-child(7) { transition-delay: 420ms; }
.seo-table__body.is-visible > tr:nth-child(8) { transition-delay: 490ms; }

/* --- Related links (cartes) --- */
.seo-related__link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  color: var(--text-muted, rgba(255, 255, 255, 0.78));
  text-decoration: none;
  transform-style: preserve-3d;
  transition:
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.35s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1));
}

.seo-related__icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: rgba(118, 87, 255, 0.15);
  border: 1px solid rgba(118, 87, 255, 0.25);
  transition: transform 0.35s ease, background 0.35s ease;
}

.seo-related__link:hover .seo-related__icon,
.seo-related__link:focus-visible .seo-related__icon {
  transform: translateX(4px);
  background: rgba(32, 199, 232, 0.2);
}

.seo-related__label {
  font-weight: 600;
  font-size: 0.9375rem;
}

.seo-related a::before {
  display: none;
}

/* --- Callout animé --- */
.seo-callout {
  transition:
    transform 0.45s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1)),
    box-shadow 0.45s ease;
}

.seo-callout:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(118, 87, 255, 0.15);
}

.seo-callout::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(118, 87, 255, 0.5), transparent 40%, rgba(32, 199, 232, 0.4));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.seo-callout:hover::after {
  opacity: 1;
}

/* --- CTA final pulsant --- */
.seo-cta-final__inner {
  overflow: hidden;
}

.seo-cta-final__inner::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(118, 87, 255, 0.12), transparent, rgba(32, 199, 232, 0.1), transparent);
  animation: seoCtaSpin 12s linear infinite;
  pointer-events: none;
}

@keyframes seoCtaSpin {
  to { transform: rotate(360deg); }
}

.seo-cta-final__title {
  background: linear-gradient(135deg, #fff 0%, var(--accent-1-light, #a78bfa) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- FAQ améliorée --- */
.seo-faq__item {
  transform: translateY(0);
  transition:
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.35s var(--ease-emphasized, cubic-bezier(0.16, 1, 0.3, 1));
}

.seo-faq__item[open] {
  transform: translateY(-2px);
}

.seo-faq__answer {
  overflow: hidden;
}

/* --- Stagger étendu (jusqu'à 16 éléments) --- */
.seo-page .reveal-stagger.is-visible > *:nth-child(9) { transition-delay: 560ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(10) { transition-delay: 630ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(11) { transition-delay: 700ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(12) { transition-delay: 770ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(13) { transition-delay: 840ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(14) { transition-delay: 910ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(15) { transition-delay: 980ms; }
.seo-page .reveal-stagger.is-visible > *:nth-child(16) { transition-delay: 1050ms; }

/* --- Section header titre gradient au reveal --- */
.seo-main .seo-section.is-visible .seo-section__title {
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.88) 55%, var(--accent-1-light, #a78bfa) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Pricing featured pulse --- */
.seo-pricing-card--featured {
  animation: seoFeaturedPulse 4s ease-in-out infinite;
}

@keyframes seoFeaturedPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(118, 87, 255, 0.15), 0 16px 40px rgba(118, 87, 255, 0.12); }
  50% { box-shadow: 0 0 0 1px rgba(118, 87, 255, 0.35), 0 20px 50px rgba(118, 87, 255, 0.22); }
}

/* --- Before / after flèche --- */
.seo-before-after {
  position: relative;
}

@media (min-width: 768px) {
  .seo-before-after::after {
    content: '→';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(243, 217, 111, 0.95), rgba(32, 199, 232, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #14100a;
    font-weight: 800;
    font-size: 1.15rem;
    box-shadow: 0 8px 24px rgba(232, 197, 71, 0.35);
    animation: seoArrowPulse 2.5s ease-in-out infinite;
    z-index: 2;
  }
}

@keyframes seoArrowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-45%, -50%) scale(1.08); }
}

/* --- Hub : même motion layer --- */
.seo-page--hub .seo-main__ambient,
.seo-page--hub .seo-hero--hub {
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  .seo-ambient-orb,
  .seo-section__orb,
  .seo-main .seo-hero__orb-card::after,
  .seo-main .hero-animate,
  .seo-process__num,
  .seo-benefits__icon,
  .seo-cta-final__inner::before,
  .seo-pricing-card--featured,
  .seo-before-after::after {
    animation: none !important;
  }

  .seo-prose--motion > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .seo-table__body > tr {
    opacity: 1 !important;
    transform: none !important;
  }
}
