/**
 * Design system — Flipbook 2026 Pro
 * Enveloppe autour du moteur OpenFL / 1stFlip
 */

/* ------------------------------------------------------------------------- */
/* Tokens                                                                     */
/* ------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;

  /* Surfaces */
  --bg-void: #03040a;
  --bg-deep: #070a14;
  --bg-mid: #0c1020;
  --bg-elevated: #111827;
  --surface-glass: rgba(17, 24, 39, 0.65);

  /* Accent (bleu pro) */
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-muted: rgba(56, 189, 248, 0.14);
  --accent-glow: rgba(14, 165, 233, 0.35);

  /* Secondaire (bandeau — identité rouge conservée) */
  --brand-crimson: #b91c1c;
  --brand-crimson-deep: #7f1d1d;
  --openfl-toolbar-strip: linear-gradient(
    105deg,
    var(--brand-crimson-deep) 0%,
    var(--brand-crimson) 42%,
    #dc2626 78%,
    var(--brand-crimson-deep) 100%
  );

  /* Texte */
  --text-bright: #f8fafc;
  --text-muted: rgba(248, 250, 252, 0.5);
  --text-faint: rgba(248, 250, 252, 0.28);

  /* Forme & mouvement */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.2s;
  --dur-mid: 0.45s;
  --dur-slow: 0.85s;
  --dur-ambient: 14s;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 60px var(--accent-glow);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Rails latéraux flipbook */
  --openfl-rail-blur: 16px;
  --openfl-rail-radius: 2px;
  --openfl-rail-border: rgba(248, 250, 252, 0.12);
  --openfl-rail-accent-glow: rgba(56, 189, 248, 0.18);
  /* Icônes flèche (SVG data URI) */
  --openfl-rail-icon-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
  --openfl-rail-icon-r: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
  --openfl-rail-btn-size: 52px;
  --openfl-rail-icon-inner: 24px;
}

/* ------------------------------------------------------------------------- */
/* Base                                                                       */
/* ------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-feature-settings: "ss01" on, "cv01" on;
  color: var(--text-bright);
  background-color: var(--bg-void);
  background-image:
    radial-gradient(ellipse 100% 70% at 50% -30%, var(--accent-muted), transparent 52%),
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(99, 102, 241, 0.09), transparent 45%),
    radial-gradient(ellipse 60% 45% at 0% 100%, rgba(14, 165, 233, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 55%, var(--bg-void) 100%);
  background-attachment: fixed;
}

/* Grille très discrète (profondeur) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(248, 250, 252, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 250, 252, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, black 20%, transparent 72%);
}

#app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

#openfl-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ------------------------------------------------------------------------- */
/* Flipbook — surcharges UI                                                   */
/* ------------------------------------------------------------------------- */

#openfl-menu img[src*="LogoImgUrl"] {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#openfl-menu div:has(> img[src*="LogoImgUrl"]) {
  display: none !important;
}

#openfl-menu > div > div > div:has(img[src^="data:image/png;base64"]) {
  display: none !important;
}

#openfl-menu img[src^="data:image/png;base64"] {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Bandeaux haut et bas — même identité (dégradé cramoisi) */
#openfl-menu > div:first-child > div:first-child > div:first-child,
#openfl-menu > div:first-child > div:nth-child(2) > div:first-child {
  background: var(--openfl-toolbar-strip) !important;
  background-size: 180% 100% !important;
  background-position: 0% 50% !important;
  background-color: transparent !important;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35), 0 4px 24px rgba(127, 29, 29, 0.35) !important;
  animation: openfl-toolbar-sweep var(--dur-ambient) ease-in-out infinite !important;
}

@keyframes openfl-toolbar-sweep {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child {
  background: linear-gradient(
    165deg,
    rgba(30, 41, 59, 0.5) 0%,
    rgba(15, 23, 42, 0.72) 50%,
    rgba(8, 12, 24, 0.88) 100%
  ) !important;
  background-size: 140% 140% !important;
  background-position: 50% 50% !important;
  background-color: transparent !important;
  backdrop-filter: blur(var(--openfl-rail-blur)) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(var(--openfl-rail-blur)) saturate(1.4) !important;
  border-radius: var(--openfl-rail-radius) !important;
  border: 1px solid var(--openfl-rail-border) !important;
  opacity: 0.27 !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: rgba(56, 189, 248, 0.2);
  user-select: none !important;
  box-shadow:
    var(--shadow-md),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 32px var(--openfl-rail-accent-glow) !important;
  transition: box-shadow var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-spring), background-position 0.2s linear !important;
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child {
  animation: openfl-rail-in-left var(--dur-slow) var(--ease-out) both,
    openfl-rail-glow 5.5s var(--ease-out) infinite 0.9s !important;
}

#openfl-menu > div:first-child > div:nth-child(4) > div:first-child {
  animation: openfl-rail-in-right var(--dur-slow) var(--ease-out) both,
    openfl-rail-glow 5.5s var(--ease-out) infinite 1.15s !important;
}

@keyframes openfl-rail-in-left {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 0.27;
    transform: translateX(0);
  }
}

@keyframes openfl-rail-in-right {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 0.27;
    transform: translateX(0);
  }
}

@keyframes openfl-rail-glow {
  0%,
  100% {
    background-position: 48% 46%;
  }
  50% {
    background-position: 52% 54%;
  }
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child:hover,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child:hover {
  border-color: rgba(248, 250, 252, 0.22) !important;
  filter: brightness(1.07) !important;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(56, 189, 248, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 40px rgba(56, 189, 248, 0.28) !important;
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child:active,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child:active {
  filter: brightness(0.95) !important;
}

/* Bouton circulaire + icône flèche (précédent / suivant) */
#openfl-menu > div:first-child > div:nth-child(3) > div:first-child::before,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--openfl-rail-btn-size);
  height: var(--openfl-rail-btn-size);
  margin: calc(var(--openfl-rail-btn-size) / -2) 0 0 calc(var(--openfl-rail-btn-size) / -2);
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    160deg,
    rgba(56, 189, 248, 0.22) 0%,
    rgba(15, 23, 42, 0.92) 55%,
    rgba(8, 12, 24, 0.95) 100%
  );
  border: 1px solid rgba(248, 250, 252, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 16px rgba(0, 0, 0, 0.4);
  transform: scale(1);
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child::after,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--openfl-rail-btn-size);
  height: var(--openfl-rail-btn-size);
  margin: calc(var(--openfl-rail-btn-size) / -2) 0 0 calc(var(--openfl-rail-btn-size) / -2);
  background: no-repeat center / var(--openfl-rail-icon-inner) var(--openfl-rail-icon-inner);
  opacity: 0.95;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  transform: scale(1);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring);
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child::after {
  background-image: var(--openfl-rail-icon-l);
}

#openfl-menu > div:first-child > div:nth-child(4) > div:first-child::after {
  background-image: var(--openfl-rail-icon-r);
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child:hover::before,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child:hover::before {
  transform: scale(1.08);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 22px rgba(14, 165, 233, 0.25);
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child:hover::after,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child:hover::after {
  opacity: 1;
  transform: scale(1.1);
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child:active::before,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child:active::before {
  transform: scale(0.94);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

#openfl-menu > div:first-child > div:nth-child(3) > div:first-child:active::after,
#openfl-menu > div:first-child > div:nth-child(4) > div:first-child:active::after {
  transform: scale(0.92);
  opacity: 1;
}

/* ------------------------------------------------------------------------- */
/* Préchargement 2026 Pro                                                     */
/* ------------------------------------------------------------------------- */

#stage-preloader {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(15, 23, 42, 0.5), transparent 65%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-void) 100%);
  transition: opacity var(--dur-mid) var(--ease-out), visibility var(--dur-mid) var(--ease-out);
}

#stage-preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: clamp(1.75rem, 5vw, 2.5rem) clamp(2rem, 6vw, 3rem);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border: 1px solid rgba(248, 250, 252, 0.08);
  box-shadow: var(--shadow-md), var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: preloader-enter 0.85s var(--ease-out) both;
}

@keyframes preloader-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.preloader-mark {
  position: absolute;
  inset: -2px;
  display: block;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.45),
    rgba(14, 165, 233, 0.08) 40%,
    transparent 65%
  );
  opacity: 0.5;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  padding: 1px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
}

.preloader-brand {
  position: relative;
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  z-index: 1;
}

.preloader-year {
  background: linear-gradient(125deg, #f8fafc 12%, var(--accent) 55%, var(--accent-strong) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.preloader-sub {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
  padding: 0.35rem 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--text-bright);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.2), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.15);
}

.preloader-tagline {
  position: relative;
  z-index: 1;
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.preloader-bar {
  position: relative;
  z-index: 1;
  width: min(220px, 52vw);
  height: 3px;
  margin-top: 1.35rem;
  border-radius: var(--radius-full);
  background: rgba(248, 250, 252, 0.06);
  overflow: hidden;
}

.preloader-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent), #a5f3fc);
  animation: preloader-slide 1.05s var(--ease-out) infinite;
}

@keyframes preloader-slide {
  0% {
    transform: translateX(-105%);
  }
  100% {
    transform: translateX(290%);
  }
}

/* ------------------------------------------------------------------------- */
/* Noscript                                                                   */
/* ------------------------------------------------------------------------- */

noscript {
  display: block;
  padding: 1.5rem 1.75rem;
  max-width: 26rem;
  margin: 2rem auto;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text-bright);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(248, 250, 252, 0.1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

/* ------------------------------------------------------------------------- */
/* Accessibilité                                                              */
/* ------------------------------------------------------------------------- */

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

  .preloader-bar::after {
    animation: none;
    width: 72%;
    opacity: 0.65;
  }

  #openfl-menu > div:first-child > div:first-child > div:first-child,
  #openfl-menu > div:first-child > div:nth-child(2) > div:first-child {
    animation: none !important;
    background-size: 100% 100% !important;
  }

  #openfl-menu > div:first-child > div:nth-child(3) > div:first-child,
  #openfl-menu > div:first-child > div:nth-child(4) > div:first-child {
    animation: none !important;
    transition: none !important;
  }

  #openfl-menu > div:first-child > div:nth-child(3) > div:first-child::before,
  #openfl-menu > div:first-child > div:nth-child(4) > div:first-child::before,
  #openfl-menu > div:first-child > div:nth-child(3) > div:first-child::after,
  #openfl-menu > div:first-child > div:nth-child(4) > div:first-child::after {
    transition: none !important;
  }
}
