@font-face {
  font-family: "Benedict";
  src: url("/fonts/benedict.woff2") format("woff2"),
       url("/fonts/benedict.woff")  format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink:      #ffca3c;
  --ink-soft: rgb(255, 255, 255);
  --ivory:    #fdfaf3;
  --harvest:  #c47c15;

  --display: "Google Sans", "Product Sans", "Poppins", system-ui, sans-serif;
  --body:    "Inter", system-ui, -apple-system, sans-serif;
  --script:  "Benedict", "Caveat", "Segoe Script", cursive;

  --card-w: clamp(170px, min(34vw, 42vh), 400px);
  --card-h: calc(var(--card-w) * 1.4);
  --radius: 99vw;
  --spread: 13deg;

  --wob:    1.8deg;
  --wcycle: 5s;
}

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

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--body);
  color: var(--ink);
  background: #a8d4ef;
  overflow: hidden;
}

.sky-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  animation: sky-drift 40s ease-in-out infinite alternate;
}

@keyframes sky-drift {
  from { transform: scale(1.06) translate3d(-1%, 0, 0); }
  to   { transform: scale(1.12) translate3d( 1%, -1.5%, 0); }
}

.stage {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(24px, 5vh, 56px) 4vw clamp(20px, 4vh, 44px);
  overflow: hidden;
}

.fan {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-w);
  height: var(--card-h);
  transform: translate(-50%, -44%);
  z-index: 1;
}

.card {
  --mid:   calc((var(--n) - 1) / 2);
  --angle: calc((var(--i) - var(--mid)) * var(--spread));

  position: absolute;
  top: 0;
  left: 50%;
  width: var(--card-w);
  height: var(--card-h);
  margin: 0 0 0 calc(var(--card-w) / -2);
  padding: 0;
  background: none;
  opacity: 0;
  z-index: var(--z-center);

  --amp: calc(var(--wob) * var(--wmul, 1));

  transform-origin: 50% var(--radius);
  transform: rotate(var(--angle));
  will-change: transform;

  animation:
    tilt   var(--wcycle) linear infinite,
    appear 900ms ease both;
  animation-delay:
    calc(var(--phase, 0) * var(--wcycle) * -1),
    calc(var(--i) * 130ms + 300ms);
}

@keyframes appear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes tilt {
  0%, 4% {
    transform: rotate(calc(var(--angle) + var(--amp)));
    animation-timing-function: cubic-bezier(.37, .05, .63, .95);
  }
  46% {
    transform: rotate(calc(var(--angle) - var(--amp)));
    animation-timing-function: linear;
  }
  54% {
    transform: rotate(calc(var(--angle) - var(--amp)));
    animation-timing-function: cubic-bezier(.37, .05, .63, .95);
  }
  96%, 100% {
    transform: rotate(calc(var(--angle) + var(--amp)));
  }
}

.card__media {
  position: relative;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: var(--tone, linear-gradient(160deg, #3d7a4d, #1d4229));
  transform: scale(var(--sc, 1));
  transform-origin: 50% 50%;
  filter: blur(var(--blur, 0px));
  box-shadow:
    0 34px 60px -22px rgba(4, 26, 48, .55),
    0 12px 24px -12px rgba(4, 26, 48, .40);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 45%);
  display: block;
  filter: brightness(var(--bri, 1)) saturate(var(--sat, 1));
  -webkit-user-drag: none;
  user-select: none;
}

.card__media img.is-missing { opacity: 0; }

.card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255,255,255,.16) 0%, transparent 42%, transparent 74%, rgba(0,0,0,.26) 100%),
    linear-gradient(to top, rgba(2, 18, 32, .34) 0%, transparent 46%);
  pointer-events: none;
}

.card__label {
  position: absolute;
  z-index: 2;
  left: 14px;
  bottom: 14px;
  font-size: clamp(8px, .9vw, 11px);
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .85);
}

/* =========================================================
   Mode téléphone : éventail piloté au doigt (classe posée par le JS)
   ========================================================= */
.fan.is-interactive .card {
  animation: none;                 /* plus d'oscillation automatique */
  opacity: var(--op, 1);           /* fondu géré par le JS au niveau de la boucle */
  transform: rotate(var(--angle)); /* angle calculé en continu par le JS */
  will-change: transform, opacity;
}

/* L'apparition passe sur le média pour ne pas écraser l'opacité pilotée par le JS */
.fan.is-interactive .card__media {
  animation: appear 900ms ease both;
  animation-delay: calc(var(--i) * 90ms + 300ms);
}

html.fan-swipe .stage {
  touch-action: pan-y;             /* le glissement horizontal est pour nous */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
}

html.fan-swipe .stage.is-dragging { cursor: grabbing; }

/* ========================================================= */

.masthead,
.outro {
  position: relative;
  z-index: 3;
  text-align: center;
  width: 100%;
  pointer-events: none;
  bottom: 20px;
}

.masthead > *, .outro > * { animation: rise 1200ms cubic-bezier(.2, .8, .2, 1) both; }
.masthead__logo  { animation-delay: 160ms; }
.masthead__title { animation-delay: 300ms; }
.outro__baseline { animation-delay: 560ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.masthead__logo {
  display: block;
  height: auto;
  width: clamp(180px, 24vw, 350px);
  margin: 0 auto .9rem;
  filter: drop-shadow(0 2px 8px rgba(8, 38, 60, .22));
}

.masthead__title {
  margin: 0;
  font-family: var(--display);
  position: relative;
  top: -15px;
  font-weight: 500;
  font-size: clamp(.95rem, 4.3vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: -.025em;
  white-space: nowrap;
  color: #edfac1;
  text-shadow: 0 2px 18px rgba(4, 26, 48, .35);
}

.outro__baseline {
  margin: 0 auto;
  max-width: 44rem;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1rem, 2vw, 1.55rem);
  line-height: 1.45;
  color: var(--ink-soft);
  position: relative;
  top: 20px;
  text-shadow: 0 2px 16px rgba(4, 26, 48, .55);
}

.outro__wink {
  display: inline-block;
  margin: 0 .18em;
  font-family: var(--script);
  font-weight: 400;
  font-size: 1.2em;
  line-height: 1;
  color: #edfac1;
  transform: translateY(.08em);
  text-shadow: 0 2px 14px rgba(4, 26, 48, .45);
}

@media (max-width: 900px) {
  :root {
    --card-w: clamp(150px, min(42vw, 34vh), 300px);
    --radius: 126vw;
    --spread: 13deg;
    --wob:    1.6deg;
  }
  .stage { padding: 8vh 4vw 7vh; }
  .masthead__logo { width: min(46vw, 320px); }
  .masthead__title { font-size: clamp(1.2rem, 4.6vw, 2.2rem); }
  .outro__baseline { font-size: clamp(1.05rem, 3vw, 1.4rem); }
  .card__media { border-radius: 18px; }
}

@media (max-width: 560px) {
  :root {
    --card-w: clamp(150px, min(58vw, 34vh), 300px);
    --radius: 140vw;
    --spread: 14deg;
    --wob:    1.6deg;
  }

  .stage { padding: 9vh 4vw 8vh; }

  .fan { transform: translate(-50%, -46%); }

  .masthead__logo {
    width: min(62vw, 280px);
    margin-bottom: 1.1rem;
  }

  .masthead__title {
    top: 0;
    max-width: 20ch;
    margin-inline: auto;
    white-space: normal;
    font-size: clamp(1.15rem, 6.2vw, 1.7rem);
    line-height: 1.22;
  }

  .outro__baseline {
    top: 0;
    font-size: clamp(1rem, 4.8vw, 1.35rem);
    line-height: 1.5;
  }

  .outro__wink { font-size: 1.35em; }

  .card__media { border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sky-bg { animation: none; }
  .masthead > *, .outro > * { animation: none; opacity: 1; transform: none; }
  .card { animation: none; opacity: 1; transform: rotate(var(--angle)); }
  .fan.is-interactive .card__media { animation: none; }
}