/* ==========================================================================
   CMKS — feuille de style propre au centre.
   Tailwind couvre la mise en page ; ce fichier porte l'identité visuelle :
   typographie, textures « aqua », animations et composants signature.
   ========================================================================== */

:root {
  --brand-50:  #EFFAFE;
  --brand-100: #D7F2FC;
  --brand-200: #B0E6F9;
  --brand-300: #7FD3F0;
  --brand-400: #47BEE4;
  --brand-500: #15A8D6;
  --brand-600: #0A86B4;
  --brand-700: #0B6B91;
  --brand-800: #0E5775;
  --brand-900: #113F55;
  --brand-950: #07293A;
  --accent-400: #F79440;
  --accent-500: #E99841;
  --accent-600: #D4761B;
  --ink:       #07293A;
  --ink-soft:  #0E3A50;
  --ink-mute:  #4A6B7C;
  --surface:   #F6FBFD;

  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow-aqua:   0 24px 60px -24px rgba(10, 134, 180, 0.38);
  --shadow-card:   0 1px 2px rgba(7, 41, 58, 0.04), 0 12px 32px -16px rgba(7, 41, 58, 0.14);
}

/* ------------------------------------------------------------ typographie */

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-display {
  font-family: 'Bricolage Grotesque', 'Plus Jakarta Sans', sans-serif;
  font-optical-sizing: auto;
  letter-spacing: -0.028em;
  font-weight: 700;
}

.display-xl { font-size: clamp(2.6rem, 7.2vw, 5.6rem); line-height: 0.96; letter-spacing: -0.04em; }
.display-lg { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.04; letter-spacing: -0.034em; }
.display-md { font-size: clamp(1.6rem, 3vw, 2.2rem);   line-height: 1.12; letter-spacing: -0.028em; }

.eyebrow {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
}

.tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* Le dégradé de marque, repris du logo (aqua vers orange en pointe). */
.text-gradient {
  background: linear-gradient(104deg, var(--brand-600) 0%, var(--brand-400) 46%, var(--accent-500) 108%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --------------------------------------------------------------- textures */

/* Trame de points discrète, évoque le quadrillage des salles de rééducation. */
.texture-dots {
  background-image: radial-gradient(circle at 1px 1px, rgba(10, 134, 180, 0.17) 1px, transparent 0);
  background-size: 22px 22px;
}
.texture-dots-dark {
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.12) 1px, transparent 0);
  background-size: 24px 24px;
}

/* Halos colorés, animés très lentement. */
.mesh::before,
.mesh::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(70px);
  pointer-events: none; z-index: 0;
}
.mesh::before {
  width: 46vw; height: 46vw; left: -14vw; top: -18vw;
  background: radial-gradient(circle, rgba(21, 168, 214, 0.34), transparent 68%);
  animation: drift 26s var(--ease-out-soft) infinite alternate;
}
.mesh::after {
  width: 38vw; height: 38vw; right: -12vw; bottom: -16vw;
  background: radial-gradient(circle, rgba(233, 152, 65, 0.26), transparent 66%);
  animation: drift 32s var(--ease-out-soft) infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(5vw, 4vw, 0) scale(1.14); }
}

/* Anneau inspiré du cercle du logo. */
.ring-motif {
  position: absolute; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(21, 168, 214, 0.22);
}
.ring-motif::after {
  content: ''; position: absolute; inset: 14%; border-radius: 50%;
  border: 1px dashed rgba(21, 168, 214, 0.16);
  animation: spin-slow 48s linear infinite;
}
@keyframes spin-slow { to { transform: rotate(360deg); } }

/* Vague de séparation entre deux sections. */
.wave-divider { display: block; width: 100%; height: clamp(44px, 6vw, 96px); }

/* ------------------------------------------------------------ composants */

.card {
  background: #fff; border: 1px solid rgba(7, 41, 58, 0.07);
  border-radius: 1.25rem; box-shadow: var(--shadow-card);
}

.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(165%) blur(14px);
  -webkit-backdrop-filter: saturate(165%) blur(14px);
}
.glass-dark {
  background: rgba(7, 41, 58, 0.68);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
}

/* Bouton principal : léger relief et onde au clic. */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-weight: 650; border-radius: 0.85rem;
  transition: transform 0.28s var(--ease-spring), box-shadow 0.28s var(--ease-out-soft),
              background-color 0.2s linear, color 0.2s linear;
  will-change: transform;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500) 62%, var(--brand-400));
  color: #fff; box-shadow: 0 10px 24px -12px rgba(10, 134, 180, 0.8);
}
.btn-primary:hover { box-shadow: 0 18px 38px -14px rgba(10, 134, 180, 0.85); transform: translateY(-2px); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent-600), var(--accent-500) 60%, var(--accent-400));
  color: #fff; box-shadow: 0 10px 24px -12px rgba(212, 118, 27, 0.75);
}
.btn-accent:hover { box-shadow: 0 18px 38px -14px rgba(212, 118, 27, 0.8); transform: translateY(-2px); }
.btn-ghost { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.btn-ghost:hover { background: rgba(255,255,255,0.2); transform: translateY(-2px); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); transform: translateY(-2px); }

.ripple {
  position: absolute; border-radius: 50%; transform: scale(0); opacity: 0.45;
  background: rgba(255, 255, 255, 0.65); pointer-events: none; z-index: -1;
  animation: ripple 0.62s var(--ease-out-soft) forwards;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* Lien souligné progressivement. */
.link-underline {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 0.38s var(--ease-out-soft);
}
.link-underline:hover { background-size: 100% 1.5px; }

/* --------------------------------------------------------- révélations */

[data-reveal] {
  opacity: 0; transform: translate3d(0, 22px, 0);
  transition: opacity 0.72s var(--ease-out-soft), transform 0.72s var(--ease-out-soft);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal="left"]  { transform: translate3d(-26px, 0, 0); }
[data-reveal="right"] { transform: translate3d(26px, 0, 0); }
[data-reveal="zoom"]  { transform: scale(0.94); }
[data-reveal].is-in   { opacity: 1; transform: none; }

/* Découpe du texte ligne par ligne pour les titres. */
/* Le masque laisse respirer les jambages : l'interlignage serré des grands
   titres ferait sinon rogner le haut et le bas des glyphes. */
.line-mask {
  overflow: hidden; display: block;
  padding: 0.1em 0.04em 0.18em; margin: -0.1em -0.04em -0.18em;
}
.line-mask > span {
  display: block; transform: translateY(110%);
  transition: transform 0.9s var(--ease-out-soft);
  transition-delay: var(--reveal-delay, 0ms);
}
.is-in .line-mask > span, .line-mask.is-in > span { transform: translateY(0); }

/* ------------------------------------------------------------- rotateur */

span.rotator { display: inline-grid; vertical-align: bottom; }
span.rotator > span {
  grid-area: 1 / 1; opacity: 0; transform: translateY(0.45em) rotateX(-55deg);
  transition: opacity 0.5s var(--ease-out-soft), transform 0.6s var(--ease-out-soft);
}
span.rotator > span.is-active { opacity: 1; transform: none; }

/* --------------------------------------------------------------- défilé */

.marquee { display: flex; width: max-content; animation: marquee 42s linear infinite; }
.marquee:hover { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ----------------------------------------------------------- flottement */

.float-slow { animation: floaty 7.5s ease-in-out infinite; }
.float-mid  { animation: floaty 6s   ease-in-out infinite 0.6s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-13px); }
}

/* ---------------------------------------------------------- progression */

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2.5px; z-index: 70; width: 0;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  box-shadow: 0 0 12px rgba(21, 168, 214, 0.6);
}

/* Barre de progression d'un indicateur. */
.meter { height: 8px; border-radius: 999px; background: rgba(7, 41, 58, 0.07); overflow: hidden; }
.meter > i {
  display: block; height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
  transition: width 1.1s var(--ease-out-soft);
}
.meter.is-accent > i { background: linear-gradient(90deg, var(--accent-600), var(--accent-400)); }
.meter.is-violet > i { background: linear-gradient(90deg, #6D4AE0, #9C7BF5); }
.meter.is-emerald > i { background: linear-gradient(90deg, #0E9F6E, #34D399); }

/* Anneau de progression (SVG). */
.ring-progress circle.track { stroke: rgba(7, 41, 58, 0.09); }
.ring-progress circle.value {
  stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 1.2s var(--ease-out-soft);
}

/* --------------------------------------------------------------- accordéon */

.accordion-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.42s var(--ease-out-soft); }
.accordion-panel > div { overflow: hidden; }
.accordion-item.is-open .accordion-panel { grid-template-rows: 1fr; }
.accordion-item.is-open .accordion-chevron { transform: rotate(180deg); }
.accordion-chevron { transition: transform 0.32s var(--ease-out-soft); }

/* ----------------------------------------------------------------- image */

.img-zoom { overflow: hidden; }
.img-zoom img { transition: transform 1.1s var(--ease-out-soft), filter 0.6s linear; }
.img-zoom:hover img { transform: scale(1.07); }

.tilt { transition: transform 0.45s var(--ease-out-soft); transform-style: preserve-3d; }

/* Chargement progressif des photos distantes. */
img[data-loading] { background: linear-gradient(100deg, #E6F4FA 20%, #F4FBFE 40%, #E6F4FA 60%); background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
img.is-loaded { animation: none; background: none; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* --------------------------------------------------------- application */

.app-nav-item {
  position: relative; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.62rem 0.9rem; border-radius: 0.8rem; font-weight: 600; font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.72);
  transition: color 0.2s linear, background-color 0.22s linear;
}
.app-nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.app-nav-item.is-active { color: #fff; background: linear-gradient(100deg, rgba(21, 168, 214, 0.34), rgba(21, 168, 214, 0.08)); }
.app-nav-item.is-active::before {
  content: ''; position: absolute; left: -0.9rem; top: 50%; width: 3px; height: 1.5rem;
  transform: translateY(-50%); border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-300), var(--accent-500));
}

.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after {
  content: ''; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px;
  border-radius: 50%; background: currentColor; opacity: 0.07;
  transition: transform 0.6s var(--ease-out-soft);
}
.kpi-card:hover::after { transform: scale(1.3) translate(-8px, -8px); }

/* Tableaux de l'application. */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface); color: var(--ink-mute);
  font-size: 0.7rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.7rem 1rem; text-align: left; white-space: nowrap;
  border-bottom: 1px solid rgba(7, 41, 58, 0.08);
}
.tbl tbody td { padding: 0.78rem 1rem; border-bottom: 1px solid rgba(7, 41, 58, 0.055); font-size: 0.875rem; vertical-align: middle; }
.tbl tbody tr { transition: background-color 0.16s linear; }
.tbl tbody tr:hover { background: var(--brand-50); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* Trame horaire de l'agenda. */
.agenda-grid { display: grid; grid-template-columns: 4.5rem 1fr; }
.agenda-slot { border-top: 1px dashed rgba(7, 41, 58, 0.1); min-height: 3.4rem; }
.agenda-now { position: relative; }
.agenda-now::before {
  content: ''; position: absolute; left: 0; right: 0; top: var(--now-top, 0);
  height: 2px; background: var(--accent-500); z-index: 3;
  box-shadow: 0 0 10px rgba(233, 152, 65, 0.7);
}
.agenda-now::after {
  content: ''; position: absolute; left: -4px; top: calc(var(--now-top, 0) - 3px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-500); z-index: 4;
}

/* Palette de commandes. */
.cmdk-backdrop { background: rgba(7, 41, 58, 0.46); backdrop-filter: blur(5px); }
.cmdk-item.is-cursor { background: var(--brand-50); }

/* Notifications. */
.toast {
  animation: toast-in 0.5s var(--ease-spring) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.toast.is-out { animation: toast-out 0.4s var(--ease-out-soft) forwards; }
@keyframes toast-out {
  to { opacity: 0; transform: translateX(26px) scale(0.96); }
}

/* Pastille d'activité. */
.pulse-dot { position: relative; }
.pulse-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor; animation: pulse-ring 2.1s var(--ease-out-soft) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%  { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Tracé animé des courbes SVG. */
.spark-path { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.5s var(--ease-out-soft) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------------- défilement */

.scroll-slim::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll-slim::-webkit-scrollbar-thumb { background: rgba(7, 41, 58, 0.18); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
.scroll-slim::-webkit-scrollbar-thumb:hover { background: rgba(7, 41, 58, 0.3); background-clip: content-box; }
.scroll-slim::-webkit-scrollbar-track { background: transparent; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ------------------------------------------------------- accessibilité */

:focus-visible {
  outline: 2.5px solid var(--brand-500); outline-offset: 2px; border-radius: 0.4rem;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 90;
  background: var(--ink); color: #fff; padding: 0.65rem 1.1rem; border-radius: 0.6rem;
  transition: top 0.25s var(--ease-out-soft);
}
.skip-link:focus { top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .line-mask > span { transform: none !important; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #cbd5e1; }
}
