/* RXN Solutions — Espace client
   Palette dérivée du logo : noir d'encre → indigo → violet électrique. */

:root {
  --void:   #06060E;
  --ink:    #0C0B18;
  --slate:  #15142A;
  --indigo: #1B1566;
  --volt:   #3B34E8;
  --pale:   #F1F1F3;
  --muted:  #8B89A8;

  --edge: rgba(255,255,255,.075);
  --edge-lit: rgba(102,94,255,.42);

  --ease: cubic-bezier(.22,.9,.28,1);
  --gap: clamp(14px, 3.5vw, 18px);

  /* Rôles dépendants du thème */
  --bg: var(--void);
  --text: var(--pale);
  --card-top: rgba(21,20,42,.72);
  --card-bot: rgba(12,11,24,.72);
  --glyph: #A29DFF;
  --glyph-bg: rgba(255,255,255,.03);
  --accent-soft: #A29DFF;
  --aura-a: rgba(59,52,232,.30);
  --aura-b: rgba(27,21,102,.55);
  --grain-opacity: .035;
  --shadow: 0 18px 44px -18px rgba(59,52,232,.75);
  --soon: .46;
  --wordmark-a: #A8A4FF;
  --wordmark-b: #4F47F5;
}

/* Thème clair — papier lavande, encre indigo. Même identité, autre lumière. */
:root[data-theme="light"] {
  --bg:     #F2F1F7;
  --text:   #14122B;
  --muted:  #61608A;

  --edge: rgba(20,18,43,.10);
  --edge-lit: rgba(59,52,232,.45);

  --card-top: rgba(255,255,255,.92);
  --card-bot: rgba(248,248,253,.82);
  --glyph: #4740D6;
  --glyph-bg: rgba(59,52,232,.07);
  --accent-soft: #3B34E8;
  --aura-a: rgba(59,52,232,.16);
  --aura-b: rgba(146,140,255,.30);
  --grain-opacity: .022;
  --shadow: 0 18px 40px -20px rgba(27,21,102,.45);
  --soon: .55;
  --wordmark-a: #6A63F0;
  --wordmark-b: #2A2298;
}

:root[data-theme="light"] .link-card .badge { background: rgba(255,255,255,.6); }

:root[data-theme="light"] a.link-card:hover .glyph,
:root[data-theme="light"] a.link-card:focus-visible .glyph {
  background: var(--volt);
  color: #fff;
}

html { background: var(--bg); }

html, body { transition: background-color .5s var(--ease); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter Tight", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--volt); color: #fff; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid #6D66FF;
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Atmosphère ─────────────────────────────────────────── */

.aura {
  position: fixed;
  top: -34vh; left: 50%;
  width: min(1100px, 165vw); aspect-ratio: 1;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side, var(--aura-a), transparent 70%),
    radial-gradient(closest-side at 68% 42%, var(--aura-b), transparent 72%);
  filter: blur(12px);
  pointer-events: none;
  z-index: 0;
  animation: drift 18s var(--ease) infinite alternate;
}

@keyframes drift {
  from { transform: translateX(-52%) translateY(0) scale(1); }
  to   { transform: translateX(-48%) translateY(3vh) scale(1.08); }
}

.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Barre flottante : retour au site + apparence ────────── */

.back {
  position: fixed;
  top: clamp(14px, 3vw, 22px);
  left: clamp(14px, 3vw, 22px);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 15px 0 12px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--card-top), var(--card-bot));
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-8px);
  animation: rise .7s var(--ease) .15s forwards;
  transition: color .32s var(--ease), border-color .32s var(--ease);
}

.back svg {
  width: 15px; height: 15px;
  transition: transform .32s var(--ease);
}

.back:hover { color: var(--text); border-color: var(--edge-lit); }
.back:hover svg { transform: translateX(-3px); }

/* ── Sélecteur d'apparence ──────────────────────────────── */

.theme-switch {
  position: fixed;
  top: clamp(14px, 3vw, 22px);
  right: clamp(14px, 3vw, 22px);
  z-index: 5;
  display: flex;
  padding: 4px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--card-top), var(--card-bot));
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-8px);
  animation: rise .7s var(--ease) .15s forwards;
}

.theme-switch .knob {
  position: absolute;
  top: 4px; left: 4px;
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--volt);
  box-shadow: 0 6px 16px -6px rgba(59,52,232,.9);
  transform: translateX(var(--knob-x, 0));
  transition: transform .42s var(--ease);
}

.theme-switch button {
  position: relative;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .32s var(--ease), transform .32s var(--ease);
}

.theme-switch button svg { width: 16px; height: 16px; }

.theme-switch button:hover { color: var(--text); }

.theme-switch button[aria-pressed="true"] { color: #fff; }

.theme-switch button:active { transform: scale(.9); }

/* ── Structure ──────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 2;
  width: min(560px, 100% - 2.5rem);
  margin-inline: auto;
  padding: clamp(56px, 12vh, 104px) 0 48px;
}

/* ── En-tête ────────────────────────────────────────────── */

.masthead { text-align: center; }

.mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  margin-bottom: 26px;
}

.mark::after {
  content: "";
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(59,52,232,.55), transparent 72%);
  filter: blur(16px);
  z-index: -1;
  animation: pulse 5.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.12); }
}

.mark img {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: block;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #7F79E8;
}

.wordmark {
  margin: 0 0 16px;
  font-family: "Familjen Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 9.5vw, 54px);
  line-height: .98;
  letter-spacing: -.035em;
}

.wordmark span {
  font-weight: 400;
  color: transparent;
  background: linear-gradient(100deg, var(--wordmark-a), var(--wordmark-b));
  -webkit-background-clip: text;
          background-clip: text;
}

.lede {
  margin: 0 auto;
  max-width: 42ch;
  color: var(--muted);
  font-size: 15px;
  text-wrap: pretty;
}

/* ── La chaîne ──────────────────────────────────────────── */

.chain {
  margin-top: clamp(40px, 8vh, 64px);
  display: flex;
  flex-direction: column;
}

.joint {
  position: relative;
  height: 26px;
  display: grid;
  place-items: center;
}

.joint .thread {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--edge-lit), var(--edge));
  transform-origin: top;
}

.joint .ring {
  width: 9px; height: 9px;
  border: 1px solid var(--edge-lit);
  border-radius: 3px;
  background: var(--bg);
  transform: rotate(45deg);
}

/* ── Cartes ─────────────────────────────────────────────── */

.link-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--gap);
  padding: 20px var(--gap) 20px 18px;
  border: 1px solid var(--edge);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card-top), var(--card-bot));
  backdrop-filter: blur(8px);
  text-decoration: none;
  overflow: hidden;
  transition:
    transform .45s var(--ease),
    border-color .45s var(--ease),
    box-shadow .45s var(--ease);
}

.sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(6,6,14,0), rgba(27,21,102,.55) 42%, rgba(59,52,232,.42));
  opacity: 0;
  transition: opacity .45s var(--ease);
  pointer-events: none;
}

.link-card .glyph {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--glyph-bg);
  color: var(--glyph);
  transition: color .45s var(--ease), border-color .45s var(--ease), background .45s var(--ease);
}

.link-card .glyph svg { width: 20px; height: 20px; }

.link-card .body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.link-card .title {
  font-family: "Familjen Grotesk", sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.015em;
}

.link-card .sub {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.42;
  text-wrap: pretty;
}

.link-card .tail {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.link-card .host {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}

.link-card .arrow {
  width: 19px; height: 19px;
  color: var(--muted);
  transition: transform .45s var(--ease), color .45s var(--ease);
}

.link-card .badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 4px 9px;
}

/* Interaction — uniquement sur les liens actifs */
a.link-card:hover,
a.link-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--edge-lit);
  box-shadow: var(--shadow);
}

a.link-card:hover .sweep,
a.link-card:focus-visible .sweep { opacity: 1; }

a.link-card:hover .glyph,
a.link-card:focus-visible .glyph {
  color: #fff;
  border-color: var(--edge-lit);
  background: rgba(59,52,232,.28);
}

a.link-card:hover .host,
a.link-card:focus-visible .host { opacity: 1; transform: none; }

a.link-card:hover .arrow,
a.link-card:focus-visible .arrow { transform: translateX(4px); color: var(--text); }

a.link-card:active { transform: translateY(-1px); }

.link-card.is-soon {
  opacity: var(--soon);
  cursor: default;
}

/* ── Pied de page ───────────────────────────────────────── */

.foot {
  margin-top: clamp(44px, 9vh, 72px);
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

.foot p { margin: 0 0 6px; }

.foot a {
  color: var(--accent-soft);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-soft) 32%, transparent);
  transition: border-color .3s var(--ease);
}

.foot a:hover { border-color: var(--accent-soft); }

.fine {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .1em;
  opacity: .55;
}

/* ── Entrée en scène ────────────────────────────────────── */

.reveal > * {
  opacity: 0;
  transform: translateY(14px);
  animation: rise .85s var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

.reveal .link-card.is-soon { animation-name: rise-soon; }
@keyframes rise-soon {
  to { opacity: var(--soon); transform: none; }
}

.reveal .joint { opacity: 1; transform: none; animation: none; }

.reveal .joint .thread {
  transform: scaleY(0);
  animation: draw .5s var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes draw { to { transform: scaleY(1); } }

.reveal .joint .ring {
  opacity: 0;
  animation: ringIn .4s var(--ease) forwards;
  animation-delay: calc(var(--d, 0ms) + 240ms);
}
@keyframes ringIn {
  from { opacity: 0; transform: rotate(0) scale(.4); }
  to   { opacity: 1; transform: rotate(45deg) scale(1); }
}

@media (max-width: 420px) {
  .link-card { padding: 17px 15px; gap: 13px; }
  .link-card .glyph { width: 38px; height: 38px; border-radius: 11px; }
  .link-card .sub { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal > *, .reveal .joint .thread, .reveal .joint .ring { opacity: 1; transform: none; }
  .reveal .link-card.is-soon { opacity: var(--soon); }
}
