:root {
  --ink: #1a1616;
  --ink-2: #241e1e;
  --white: #fff;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--ink);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grands écrans : tout est en rem, on agrandit la base */
@media (min-width: 1800px) { html { font-size: 112.5%; } }
@media (min-width: 2300px) { html { font-size: 131.25%; } }
@media (min-width: 3200px) { html { font-size: 175%; } }

::selection { background: #383030; color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Layout ---------- */
.portal {
  position: relative;
  display: flex;
  min-height: 100svh; /* min et non fixe : sur écran bas (mobile paysage) la page défile au lieu de couper */
}

.panel {
  --mx: 50%;
  padding-block: 3rem;
  --my: 50%;
  position: relative;
  flex: 1 1 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  background: radial-gradient(120% 90% at 50% 110%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--ink);
  transition: flex-grow .9s var(--ease), filter .6s var(--ease);
  animation: panel-in 1.1s var(--ease-io) backwards;
}
.panel--perf { animation-name: panel-in-top; }
.panel--dep { animation-name: panel-in-bottom; animation-delay: .08s; }

/* Survol : le panneau visé s'élargit, l'autre s'efface */
@media (hover: hover) {
  .portal:has(.panel:hover) .panel:not(:hover) { flex-grow: .7; filter: grayscale(.85) brightness(.55); }
  .panel:hover { flex-grow: 1.35; }
}
.portal:has(.panel:focus-within) .panel:not(:focus-within) { filter: grayscale(.85) brightness(.55); }

/* Grand mot en fond, qui défile lentement */
.panel__bg {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: -1;
  font-size: clamp(5rem, 16vw, 16rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--accent) 35%, transparent);
  translate: 0 -50%;
  animation: drift 28s linear infinite alternate;
  transition: -webkit-text-stroke-color .6s;
  user-select: none;
}
.panel--dep .panel__bg { animation-direction: alternate-reverse; }
.panel:hover .panel__bg { -webkit-text-stroke-color: color-mix(in srgb, var(--accent) 70%, transparent); }

/* Halo qui suit le curseur (variables --mx/--my posées par app.js) */
.panel__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(520px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 38%, transparent), transparent 65%);
  opacity: 0;
  transition: opacity .5s;
}
.panel:hover .panel__glow { opacity: 1; }

/* ---------- Contenu ---------- */
.panel__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 3vh, 2rem);
  width: min(30rem, 86%);
  text-align: center;
}
.panel__content > * { animation: rise .9s var(--ease) backwards; /* backwards : aucun transform/filter résiduel (sinon le lien ne couvre plus le panneau) */ }
.panel__eyebrow { animation-delay: .7s; }
.panel__logo { animation-delay: .8s; }
.panel__title { animation-delay: .95s; }
.panel__cta { animation-delay: 1.1s; }

.panel__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--accent);
}
.panel__eyebrow::before, .panel__eyebrow::after {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: currentColor;
}

.panel__logo {
  --rx: 0deg;
  --ry: 0deg;
  width: 100%;
  padding: clamp(1rem, 3vh, 1.75rem) 1.5rem;
  background: var(--white);
  border-radius: 1.5rem;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .4s var(--ease), box-shadow .6s var(--ease);
}
.panel__logo img {
  display: block;
  width: 100%;
  max-height: 22vh;
  height: auto;
  object-fit: contain;
  animation: float 6s ease-in-out infinite;
}
.panel--dep .panel__logo img { animation-delay: -3s; }
.panel:hover .panel__logo {
  box-shadow: 0 40px 80px -20px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 0 2px var(--accent);
}

.panel__title {
  font-size: clamp(.95rem, 1.6vw, 1.25rem);
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1.6;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
}
.panel__title strong {
  display: block;
  font-size: 1.45em;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--white);
}

/* Le lien couvre tout le panneau */
.panel__cta {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 2.25rem;
  border: 2px solid var(--accent);
  background: linear-gradient(var(--accent), var(--accent)) no-repeat bottom / 100% 0%;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--white);
  transition: background-size .5s var(--ease), box-shadow .4s var(--ease);
}
.panel__cta::after {
  content: "";
  position: absolute; /* zone cliquable = tout le panneau (le .panel est le bloc conteneur) */
  inset: 0;
}
.panel__cta svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .4s var(--ease);
}
.panel:hover .panel__cta,
.panel__cta:focus-visible { background-size: 100% 100%; }
.panel:hover .panel__cta { box-shadow: 0 15px 40px -10px var(--accent); }
.panel:hover .panel__cta svg { transform: translateX(4px); }
.panel__cta:focus-visible { outline: 3px solid var(--white); outline-offset: 4px; }

/* ---------- Médaillon central ---------- */
.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 8.5rem;
  height: 8.5rem;
  translate: -50% -50%;
  pointer-events: none;
  animation: pop .8s 1.2s var(--ease) both;
}
.portal::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 4;
  width: 1px;
  background: linear-gradient(transparent, rgba(255, 255, 255, .25) 20%, rgba(255, 255, 255, .25) 80%, transparent);
  transform-origin: top;
  animation: grow-y 1s .9s var(--ease) both;
  pointer-events: none;
}
.hub__ring { position: absolute; inset: 0; animation: spin 20s linear infinite; }
.hub__ring svg { width: 100%; height: 100%; overflow: visible; }
.hub__ring text { fill: rgba(255, 255, 255, .75); font-size: 7.6px; font-weight: 700; text-transform: uppercase; }
.hub__core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4.25rem;
  height: 4.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #e81820 0 50%, #fd8030 50% 100%);
  box-shadow: 0 0 0 6px var(--ink), 0 10px 30px rgba(0, 0, 0, .5);
  font-size: .8rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  letter-spacing: .05em;
}
/* Le médaillon glisse avec la séparation pendant le survol */
@media (hover: hover) {
  .hub, .portal::before { transition: left .9s var(--ease); }
  .portal:has(.panel--perf:hover) .hub, .portal:has(.panel--perf:hover)::before { left: 65.85%; }
  .portal:has(.panel--dep:hover) .hub, .portal:has(.panel--dep:hover)::before { left: 34.15%; }
}

/* ---------- Transition de sortie ---------- */
.wipe {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--wipe, var(--ink));
  clip-path: circle(0% at var(--wx, 50%) var(--wy, 50%));
  pointer-events: none;
}
.is-leaving .wipe { clip-path: circle(150% at var(--wx, 50%) var(--wy, 50%)); transition: clip-path .7s var(--ease-io); }

.credit {
  position: fixed;
  right: 1rem;
  bottom: .75rem;
  z-index: 6;
  font-size: .7rem;
  color: rgba(255, 255, 255, .35);
  animation: rise .6s 1.6s backwards;
}
.credit a { color: rgba(255, 255, 255, .6); font-weight: 700; text-decoration: none; }
.credit a:hover { color: #fff; }

/* ---------- Keyframes ---------- */
@keyframes panel-in-top { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes panel-in-bottom { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(30px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes drift { from { transform: translateX(-8%); } to { transform: translateX(-42%); } }
@keyframes pop { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }
@keyframes grow-y { from { scale: 1 0; } to { scale: 1 1; } }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- Mobile : panneaux empilés ---------- */
@media (max-width: 820px) {
  body { overflow: auto; }
  .portal { flex-direction: column; height: auto; min-height: 100svh; }
  .panel { flex: none; min-height: 50svh; padding: 4.5rem 0; }
  .panel__eyebrow { letter-spacing: .22em; font-size: .7rem; }
  .panel--dep { border-top: 1px solid rgba(255, 255, 255, .15); }
  .portal::before { display: none; }
  /* Le médaillon reste dans le flux, centré sur la jonction des deux panneaux */
  .hub { position: relative; top: auto; left: auto; translate: none; flex: none; align-self: center; margin-block: -3.25rem; width: 6.5rem; height: 6.5rem; }
  .hub__core { width: 3.4rem; height: 3.4rem; font-size: .65rem; }
  .panel__logo img { max-height: 16vh; }
  .credit { position: static; padding: 1rem; text-align: center; background: var(--ink); }
}

/* Écrans bas (mobile paysage, petits portables) : contenu plus compact */
@media (max-height: 560px) and (min-width: 821px) {
  .panel__content { gap: .85rem; }
  .panel__logo { padding: .75rem 1.25rem; }
  .panel__logo img { max-height: 28vh; }
  .panel__eyebrow { font-size: .65rem; }
  .panel__cta { padding: .7rem 1.6rem; font-size: .85rem; }
  .hub { width: 6.5rem; height: 6.5rem; }
  .hub__core { width: 3.4rem; height: 3.4rem; font-size: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}
