/* ============================================================
   FORMATION.CSS — Améliorations visuelles technologiques
   Respecte le Design System existant (main.css)
   Utilise UNIQUEMENT les variables CSS existantes
   ============================================================ */

/* ============================================================
   1. BACKGROUND TECHNOLOGIQUE SUBTIL
   ============================================================ */

.formation-page {
  position: relative;
}

.formation-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
  background-image: 
    linear-gradient(rgba(10,10,10,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10,10,10,0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, var(--ink) 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, var(--ink) 20%, transparent 80%);
}

@media (prefers-reduced-motion: reduce) {
  .formation-page::before {
    display: none;
  }
}

/* ============================================================
   2. HAIRLINE FLOW ANIMATION (TOP HERO)
   ============================================================ */

.formation-hero {
  position: relative;
  overflow: hidden;
}

.formation-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 1px,
    transparent 1px 80px
  );
  animation: hairlineFlow 8s linear infinite;
  opacity: 0.15;
}

@keyframes hairlineFlow {
  from { background-position: 0 0; }
  to { background-position: 160px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .formation-hero::after {
    animation: none;
  }
}

/* ============================================================
   3. MONO CHIP WITH PULSING DOT (TECH BADGES)
   ============================================================ */

.mono-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  padding: 0.45rem 0.9rem;
  margin-bottom: var(--space-sm);
  transition: border-color var(--trans), box-shadow var(--trans);
}

.mono-chip:hover {
  border-color: var(--gold);
  box-shadow: var(--glow);
}

.mono-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: pulsate 2.2s infinite;
}

@keyframes pulsate {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .mono-chip .dot {
    animation: none;
    opacity: 1;
  }
}

/* ============================================================
   4. ROTATING WORDS (HERO SUBTITLE)
   ============================================================ */

.rotating-words {
  display: inline-block;
  height: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
}

.rot-word {
  display: block;
  opacity: 0;
  animation: rotiss 4.8s infinite;
  color: var(--ink);
}

.rot-word:nth-child(1) { animation-delay: 0s; }
.rot-word:nth-child(2) { animation-delay: 1.6s; }
.rot-word:nth-child(3) { animation-delay: 3.2s; }

@keyframes rotiss {
  0%, 100% { opacity: 0; transform: translateY(8px); }
  8%, 38% { opacity: 1; transform: none; }
  48%, 100% { opacity: 0; transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .rot-word {
    animation: none;
    opacity: 1;
    display: none;
  }
  .rot-word:first-child {
    display: block;
    opacity: 1;
  }
}

/* ============================================================
   5. CARET BLINK (TERMINAL FEEL)
   ============================================================ */

.rot-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--ink);
  margin-left: 2px;
  vertical-align: -0.1em;
  animation: caretblink 1.1s step-end infinite;
}

@keyframes caretblink {
  0%, 45% { opacity: 1 }
  50%, 100% { opacity: 0 }
}

@media (prefers-reduced-motion: reduce) {
  .rot-caret {
    animation: none;
    opacity: 1;
  }
}

/* ============================================================
   6. FORMATION CARDS - TECH HOVER EFFECTS
   ============================================================ */

.formation-card,
.b-card,
.offer-card,
.series-card {
  position: relative;
  overflow: hidden;
  transition: 
    border-color var(--trans-lg),
    box-shadow var(--trans-lg),
    transform var(--trans-lg);
}

.formation-card::before,
.b-card::before,
.offer-card::before,
.series-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--trans-lg) cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
}

.formation-card:hover::before,
.b-card:hover::before,
.offer-card:hover::before,
.series-card:hover::before {
  transform: scaleX(1);
  opacity: 1;
}

.formation-card:hover,
.b-card:hover,
.offer-card:hover,
.series-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(143,113,53,0.08);
}

/* ============================================================
   7. MODULE ITEMS - PROGRESS INDICATOR
   ============================================================ */

.module-item {
  position: relative;
  padding-left: 1.5rem;
}

.module-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-faint));
  border-radius: 1px;
  opacity: 0.5;
}

.module-item:last-child::before {
  height: 50%;
}

.module-header {
  position: relative;
  padding-left: 1rem;
}

.module-header::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--gold-faint);
  transition: all var(--trans);
}

.module-item:hover .module-header::before {
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 8px var(--gold-faint);
}

/* ============================================================
   8. AUDIENCE ITEMS - TECH TAGS
   ============================================================ */

.audience-item {
  position: relative;
  padding: var(--space-lg);
  border: 1px solid var(--line);
  transition: all var(--trans);
}

.audience-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gold);
  transform: translateX(-50%);
  transition: width var(--trans-lg) cubic-bezier(0.22, 1, 0.36, 1);
}

.audience-item:hover::after {
  width: 80%;
}

.audience-item h4 {
  position: relative;
  padding-bottom: var(--space-xs);
}

.audience-item h4::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--trans);
}

.audience-item:hover h4::after {
  transform: scaleX(1);
}

/* ============================================================
   8. FOCUS VISIBLE - TECH STYLE
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--gold-faint);
}

.btn:focus-visible,
.nav-links a:focus-visible,
.formation-link:focus-visible,
.b-title a:focus-visible,
.formation-title a:focus-visible,
.nav-cta:focus-visible,
.contact-form input:focus-visible,
.contact-form select:focus-visible,
.contact-form textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--gold-faint);
}

/* ============================================================
   9. SCROLLBAR TECH STYLE
   ============================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--paper);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--line), var(--gold));
  border-radius: 0;
  border: none;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--gold), var(--ink));
}

::-webkit-scrollbar-corner {
  background: var(--paper);
}

/* Firefox */
html {
  scrollbar-color: var(--gold) var(--paper);
  scrollbar-width: thin;
}

/* ============================================================
   10. SELECTION TECH STYLE
   ============================================================ */

::selection {
  background: var(--ink);
  color: var(--paper);
}

::-moz-selection {
  background: var(--ink);
  color: var(--paper);
}

/* ============================================================
   11. BUTTON - TECH HOVER STATE
   ============================================================ */

.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:hover::after {
  transform: translateX(100%);
}

.btn:active {
  transform: scale(0.98);
}

/* ============================================================
   12. FORM INPUTS - TECH FOCUS
   ============================================================ */

.contact-form input,
.contact-form select,
.contact-form textarea,
.drawer-form input {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  transition: all var(--trans);
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus,
.drawer-form input:focus {
  border-color: var(--gold);
  box-shadow: 
    0 0 0 3px var(--gold-faint),
    inset 0 1px 2px rgba(10,10,10,0.05);
  background: var(--paper);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--ink-faint);
  transition: opacity var(--trans);
}

.contact-form input:focus::placeholder,
.contact-form textarea:focus::placeholder {
  opacity: 0.5;
}

/* Floating label effect */
.form-group {
  position: relative;
}

.form-group label {
  transition: all var(--trans);
  transform-origin: left top;
}

.form-group input:focus + label,
.form-group textarea:focus + label,
.form-group select:focus + label {
  color: var(--gold);
  transform: translateY(-1.5rem) scale(0.85);
}

/* ============================================================
   13. NAV - TECH SCROLL INDICATOR
   ============================================================ */

.nav {
  background: rgba(252, 250, 247, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.3;
}

/* Scroll progress indicator */
.nav::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--gold);
  transition: width 0.1s linear;
  z-index: 101;
}

.nav.scrolled::before {
  width: 100%;
}

/* ============================================================
   14. BACK TO TOP - TECH STYLE
   ============================================================ */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.4rem;
  text-decoration: none;
  background: var(--paper);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--trans-lg);
  z-index: 98;
}

.back-to-top.visible {
  opacity: 0.6;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  opacity: 1;
  border-color: var(--ink);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .back-to-top {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    bottom: 1.5rem;
    right: 1rem;
  }
}

/* ============================================================
   15. LOADING STATES - TECH
   ============================================================ */

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: var(--space-sm);
  vertical-align: middle;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
    border-top-color: var(--ink);
  }
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  color: var(--ink-soft);
  gap: var(--space-md);
}

/* Skeleton loading */
.skeleton-line {
  height: 1.2rem;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    var(--paper-alt) 25%,
    var(--line-soft) 50%,
    var(--paper-alt) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.6s ease infinite;
  margin-bottom: var(--space-xs);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
    background: var(--line-soft);
  }
}

/* ============================================================
   16. FAQ - TECH ACCORDION
   ============================================================ */

.faq-accordion .faq-item {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  transition: all var(--trans);
  background: var(--paper);
}

.faq-accordion .faq-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--fs-md);
  color: var(--ink);
  transition: background var(--trans);
}

.faq-accordion .faq-item summary:hover {
  background: var(--paper-alt);
}

.faq-accordion .faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-accordion .faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  color: var(--gold);
  font-weight: 300;
  transition: transform var(--trans);
}

.faq-accordion .faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-accordion .faq-item[open] {
  border-color: var(--gold);
  box-shadow: var(--glow);
}

.faq-accordion .faq-item .faq-answer {
  padding: 0 var(--space-xl) var(--space-lg);
  border-top: 1px solid var(--line-soft);
  animation: faqOpen 0.3s ease;
}

@keyframes faqOpen {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-accordion .faq-item .faq-answer {
    animation: none;
  }
}

/* ============================================================
   17. TICKER - TECH NEWS BAR
   ============================================================ */

.ticker {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: var(--space-sm) 0;
  margin: var(--space-xl) 0;
  background: var(--paper-alt);
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  gap: 0;
  animation: tickerX 40s linear infinite;
  will-change: transform;
}

@keyframes tickerX {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-track span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-right: 2.4rem;
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation: none;
  }
  .ticker {
    overflow-x: auto;
  }
}

/* ============================================================
   18. HAIRLINE FLOW (DECORATIVE SEPARATOR)
   ============================================================ */

.hairline-flow {
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 1px,
    transparent 1px 55px
  );
  animation: hairlineFlow 6s linear infinite;
  border: none;
  margin: var(--space-md) 0;
}

@keyframes hairlineFlow {
  from { background-position: 0 0; }
  to { background-position: 55px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hairline-flow {
    animation: none;
  }
}

/* ============================================================
   19. PROGRESS BAR - TECH
   ============================================================ */

.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--line-soft);
  overflow: hidden;
  border-radius: 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--ink));
  transition: width var(--trans-lg) cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 0;
}

.progress-label {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--fs-xs);
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
  display: block;
}

/* ============================================================
   20. PRINT STYLES
   ============================================================ */

@media print {
  .formation-page::before,
  .formation-hero::after,
  .mono-chip .dot,
  .rot-word,
  .rot-caret,
  .ticker-track,
  .hairline-flow,
  .back-to-top,
  .nav::after,
  .nav::before {
    display: none !important;
  }
  
  .formation-card,
  .b-card,
  .offer-card,
  .series-card {
    box-shadow: none;
    transform: none;
  }
  
  .formation-card::before,
  .b-card::before,
  .offer-card::before,
  .series-card::before {
    display: none;
  }
}

/* ============================================================
   21. REDUCED MOTION - GLOBAL
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .formation-page::before,
  .formation-hero::after,
  .mono-chip .dot,
  .rot-word,
  .rot-caret,
  .ticker-track,
  .hairline-flow,
  .skeleton-line,
  .loading-spinner,
  .faq-accordion .faq-item .faq-answer {
    animation: none !important;
  }
  
  .ticker {
    overflow-x: auto;
  }
}

/* ============================================================
   22. HOVER NONE / TOUCH DEVICES
   ============================================================ */

@media (hover: none) and (pointer: coarse) {
  .formation-card:hover,
  .b-card:hover,
  .offer-card:hover,
  .series-card:hover,
  .audience-item:hover {
    transform: none;
    box-shadow: none;
  }
  
  .formation-card::before,
  .b-card::before,
  .offer-card::before,
  .series-card::before {
    display: none;
  }
  
  .audience-item::after {
    display: none;
  }
  
  .audience-item h4::after {
    display: none;
  }
  
  .module-item:hover .module-header::before {
    background: var(--gold);
    box-shadow: 0 0 0 4px var(--paper), 0 0 0 8px var(--gold-faint);
  }
}

/* ============================================================
   23. HIGH CONTRAST MODE
   ============================================================ */

@media (prefers-contrast: high) {
  :root {
    --line: #000;
    --line-soft: #ebe7e2;
    --gold: #000;
    --ink-soft: #333;
  }
  
  .btn {
    border-width: 2px;
  }
  
  .btn:focus-visible {
    outline-width: 3px;
  }
}

/* ============================================================
   24. DARK MODE SUPPORT (PREPARATION)
   ============================================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #fcfaf7;
    --paper-alt: #f5f2ed;
    --ink: #0a0a0a;
    --ink-soft: #5c5c5c;
    --ink-faint: #9a98a8;
    --gold: #0a0a0a;
    --gold-hover: #3d3d3d;
    --gold-faint: rgba(212, 196, 160, 0.1);
    --paper-alt: #f5f2ed;
    --line: #e5e0d8;
    --line-soft: #ebe7e2;
  }
  
  .btn--primary {
    background: var(--ink-strong);
    color: var(--paper);
  }
  
  .btn--primary:hover {
    background: var(--gold-hover);
  }
}

/* ============================================================
   25. UTILITY CLASSES
   ============================================================ */

.text-gradient {
  background: linear-gradient(90deg, var(--ink), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.glow-on-hover:hover {
  box-shadow: var(--glow);
}

.tech-border {
  position: relative;
}

.tech-border::before {
  content: "";
  position: absolute;
  top:-1px;right:-1px;bottom:-1px;left:-1px;inset:-1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity var(--trans);
  z-index: -1;
}

.tech-border:hover::before {
  opacity: 1;
}

.mono-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.zero-radius {
  border-radius: 0 !important;
}

.sharp-corners {
  border-radius: 1px !important;
}