/* ==========================================================================
   Tokens (repris de la maquette Figma « Folio »)
   ========================================================================== */
@font-face {
  font-family: "Cormorant Upright";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/cormorant-upright-300.woff2") format("woff2");
}

@font-face {
  font-family: "Cormorant Upright";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/cormorant-upright-400.woff2") format("woff2");
}

:root {
  /* Couleurs */
  --color-bg: #fff;
  --color-text: #000;
  /* Figma : #828282 (contraste 3,9:1) → assombri à #767676 pour atteindre AA (4,5:1) */
  --color-muted: #767676;
  --color-focus: #000;

  /* Typographie */
  --font-serif: "Cormorant Upright", "Cormorant", Garamond, "Times New Roman", serif;
  --weight-light: 300;
  --weight-regular: 400;
  --line-height: 1.21; /* « normal » de Cormorant dans Figma */
  --fs-title: 36px;
  --fs-body: 20px;

  /* Espacements (mobile) */
  --gutter: 30px;
  --space-bottom: 40px;
  --space-photo-title: 23px;
  --space-title-text: 11px;
  --space-text-note: 10px;

  /* Photo */
  --photo-ratio: 333 / 446;
  --photo-width: 100%;

  /* Fond dégradé (rendu exporté depuis Figma) */
  --bg-image: url("../img/bg-mobile.jpg");
  --bg-ratio: 393 / 441;

  /* Grain animé par-dessus le dégradé */
  --grain-image: url("../img/grain.png");
  --grain-size: 160px;
  --grain-opacity: 0.4;
}

/* Petits téléphones (< 393px, non maquettés) : le nom et les rôles tiennent sur une ligne */
@media (max-width: 380px) {
  :root {
    --gutter: 24px;
    --fs-title: min(30px, (100vw - 2 * var(--gutter)) * 36 / 340);
    --fs-body: min(18px, (100vw - 2 * var(--gutter)) * 18 / 280);
  }
}

@media (min-width: 768px) {
  :root {
    --bg-image: url("../img/bg-desktop.jpg");
    --bg-ratio: 1440 / 673;
    --content-max: 440px;
  }
}

@media (min-width: 1024px) {
  :root {
    --fs-title: 42px;
    /* Maquette 1440 × 1024 : photo 554 × 741, marge gauche 116, écart 64 */
    --gutter: calc(116 / 1440 * 100vw);
    --photo-ratio: 554 / 741;
    --photo-width: min(calc(554 / 1440 * 100vw), calc(741 / 1024 * 100svh * 554 / 741));
    --space-columns: calc(64 / 1440 * 100vw);
    --space-title-text: 15px;
    --space-text-note: 3px;
  }
}

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

/* Fond et débordement posés sur html pour que body garde les siens :
   le grain en « overlay » doit se fondre dans le blanc de body, et body rogne les calques animés */
html {
  overflow-x: hidden;
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-weight: var(--weight-regular);
  font-size: var(--fs-body);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overflow: clip;
}

/* Dégradé qui dérive lentement */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  aspect-ratio: var(--bg-ratio);
  background: var(--bg-image) top center / 100% auto no-repeat;
  transform-origin: 50% 0;
  animation: bg-drift 26s ease-in-out infinite alternate;
  will-change: transform;
  pointer-events: none;
}

/* Grain qui saute : en « overlay », il reste invisible sur le blanc et ne ressort que sur le rose */
body::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--grain-size));
  z-index: -1;
  background: var(--grain-image) repeat;
  background-size: var(--grain-size);
  mix-blend-mode: overlay;
  opacity: var(--grain-opacity);
  animation: grain-jump 1.2s steps(1) infinite;
  will-change: transform;
  pointer-events: none;
}

/* Grain redessiné en WebGL pour réagir à la souris (voir grain-hover.js).
   Même fondu « overlay » : l'effet ne se voit que sur le rose, jamais sur le blanc.
   Sans WebGL (ou sur mobile), le grain CSS ci-dessus reste en place */
.grain-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  mix-blend-mode: overlay;
  opacity: var(--grain-opacity);
  pointer-events: none;
}

.grain-gl body::after {
  content: none;
}

@keyframes bg-drift {
  0% { transform: translate3d(-1.5%, 0, 0) scale(1.03); }
  50% { transform: translate3d(0.5%, -2%, 0) scale(1.07); }
  100% { transform: translate3d(1.5%, -1%, 0) scale(1.05); }
}

@keyframes grain-jump {
  0% { transform: translate3d(0, 0, 0); }
  10% { transform: translate3d(-37px, 52px, 0); }
  20% { transform: translate3d(61px, -18px, 0); }
  30% { transform: translate3d(-84px, -66px, 0); }
  40% { transform: translate3d(23px, 97px, 0); }
  50% { transform: translate3d(-12px, -121px, 0); }
  60% { transform: translate3d(108px, 34px, 0); }
  70% { transform: translate3d(-139px, 9px, 0); }
  80% { transform: translate3d(47px, -88px, 0); }
  90% { transform: translate3d(-70px, 130px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
  }
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
p {
  margin: 0;
  font-weight: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

/* ==========================================================================
   Page d'attente
   ========================================================================== */
.intro {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100svh;
  max-width: calc(var(--content-max, 100vw) + 2 * var(--gutter));
  margin-inline: auto;
  padding: var(--gutter) var(--gutter) var(--space-bottom);
}

.intro__picture {
  display: block;
  width: var(--photo-width);
}

.intro__photo {
  width: 100%;
  aspect-ratio: var(--photo-ratio);
  object-fit: cover;
}

.intro__text {
  margin-top: var(--space-photo-title);
}

.intro__name {
  font-size: var(--fs-title);
  line-height: var(--line-height);
}

.intro__roles {
  margin-top: var(--space-title-text);
}

/* Liens simplement soulignés en noir, sans effet au survol */
.intro__link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--color-text);
  text-decoration-thickness: from-font;
  text-decoration-skip-ink: none;
  text-underline-position: from-font;
}

.intro__note {
  margin-top: var(--space-text-note);
  color: var(--color-muted);
  font-weight: var(--weight-light);
}

@media (min-width: 1024px) {
  .intro {
    display: grid;
    grid-template-columns: var(--photo-width) minmax(0, 1fr);
    column-gap: var(--space-columns);
    align-content: center;
    align-items: end;
    max-width: none;
    margin: 0;
    padding: var(--space-bottom) var(--gutter);
  }

  .intro__text {
    margin-top: 0;
  }

  .intro__name {
    white-space: nowrap;
  }

  .intro__brand {
    text-transform: uppercase;
  }
}
