/* PROJECT 40 — l'invitation (récit au défilement) */

.page-inv main, .page-inv .topbar, .page-inv .foot { position: relative; z-index: 10; }
.page-inv.is-loading { overflow: hidden; }

/* ---------------------------------------------------------------- chargement */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  background: var(--night);
  transition: opacity 1s var(--ease), visibility 1s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-mark {
  font-family: var(--serif);
  font-variation-settings: 'opsz' 11;
  font-size: 92px;
  line-height: 1;
  letter-spacing: -0.03em;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.55; transform: scale(0.97); } }
.loader-line { width: 160px; height: 1px; background: var(--line); overflow: hidden; }
.loader-line i { display: block; height: 100%; background: var(--oro); transform: scaleX(0); transform-origin: left; animation: load 1.6s var(--ease) forwards; }
.loader.is-done .loader-line i { transform: scaleX(1); }
@keyframes load { to { transform: scaleX(0.82); } }

.flash {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 236, 196, 0.95) 0%, rgba(214, 179, 106, 0.6) 30%, rgba(10, 6, 7, 0) 70%);
}

/* ---------------------------------------------------------------- en-tête */

.topbar {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  z-index: 40 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) clamp(18px, 4vw, 44px) 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease) 0.4s;
}
.page-inv:not(.is-loading) .topbar { opacity: 1; }
.topbar > * { pointer-events: auto; }
.mark {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  color: var(--crema);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.topbar-status { display: inline-flex; align-items: center; gap: 10px; color: var(--crema-3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rojo-glow); box-shadow: 0 0 10px var(--rojo-glow); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.topbar-cta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--night);
  background: var(--oro);
  padding: 10px 14px;
  border-radius: 2px;
}
.topbar-cta:hover { color: var(--night); background: var(--oro-pale); }
.topbar-cta:not([hidden]) ~ .topbar-status, .topbar-status:has(~ .topbar-cta:not([hidden])) { display: none; }

/* ---------------------------------------------------------------- accès par code */

.gate {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 20px calc(9vh + var(--safe-b));
}
.gate-inner { width: min(100%, 520px); text-align: center; }
.gate-title {
  font-size: clamp(56px, 11vw, 112px);
  line-height: 0.95;
  margin: 14px 0 16px;
}
.gate-title span:first-child { font-style: italic; }
.gate-title .gold { font-variation-settings: 'opsz' 11; }
.gate-sub { color: var(--crema-2); margin-bottom: 28px; }
.code-form { display: flex; gap: 10px; }
.code-input {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  background: rgba(10, 6, 7, 0.6);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.24em;
  text-align: center;
  text-transform: uppercase;
  color: var(--oro-pale);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.code-input::placeholder { color: rgba(241, 223, 176, 0.25); }
.code-input:focus { outline: none; border-color: var(--oro); }
.code-form .btn { height: 56px; }
.gate-error { min-height: 1.6em; margin: 14px 0 0; color: #ff8a8f; font-size: 15px; }
.gate.is-shake .code-form { animation: shake 0.5s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (max-width: 520px) {
  .code-form { flex-direction: column; }
}

/* ---------------------------------------------------------------- sections */

#story section { position: relative; }

/* héros */
.s-hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 20px calc(13vh + var(--safe-b));
  text-align: center;
}
.hero-inner { display: grid; justify-items: center; gap: 10px; }
@media (max-aspect-ratio: 1/1) { .s-hero { padding-bottom: calc(18vh + var(--safe-b)); } }
.hero-title { display: flex; flex-direction: column; align-items: center; margin: 6px 0 4px; }
.hero-word {
  font-style: italic;
  font-size: clamp(40px, 6.4vw, 92px);
  line-height: 1;
  letter-spacing: 0.01em;
  display: block;
  overflow: hidden;
  padding: 0 0.08em 0.06em;
}
.hero-word .ch { display: inline-block; will-change: transform; }
.hero-num {
  display: block;
  font-variation-settings: 'opsz' 11;
  font-size: clamp(110px, 18vw, 250px);
  line-height: 0.82;
  letter-spacing: -0.05em;
  padding-right: 0.05em;
  filter: drop-shadow(0 10px 40px rgba(214, 179, 106, 0.22));
}
.hero-hello { font-size: clamp(16px, 1.6vw, 19px); color: var(--crema-2); margin: 10px 0 0; }
.hero-hello em { color: var(--oro-pale); font-size: 1.15em; }
.hero-hello strong { color: var(--crema); font-weight: 600; }
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 12px;
}
.scroll-cue .kicker { font-size: 10px; color: var(--crema-3); }
.scroll-cue i { width: 1px; height: 44px; background: linear-gradient(var(--oro), transparent); animation: cue 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* manifeste */
.s-manifesto {
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  padding: 0 clamp(22px, 8vw, 140px);
}
.manifesto-text {
  max-width: 1040px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 4.3vw, 64px);
  line-height: 1.16;
  letter-spacing: -0.012em;
  text-align: center;
  text-wrap: balance;
}
.manifesto-text .w { display: inline-block; opacity: 0.12; will-change: opacity; }
.manifesto-text .w.is-host { font-style: italic; color: var(--oro-pale); }

/* ordre de mission */
/* overflow-x: clip : la carte inclinée et le tampon agrandi de l'animation n'élargissent pas la page sur mobile */
.s-dossier { padding: 18vh 20px; display: grid; place-items: center; perspective: 1400px; overflow-x: clip; }
.dossier-card {
  width: min(100%, 640px);
  padding: clamp(26px, 5vw, 52px);
  color: #2a1d17;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    linear-gradient(135deg, #f3ead9, #e6d8bf);
  border-radius: 2px;
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transform-origin: 50% 100%;
  position: relative;
}
.dossier-card::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(110, 10, 24, 0.22);
  pointer-events: none;
}
.dossier-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.dossier-head .kicker { color: #6e0a18; }
.dossier-head .stamp { color: #b3132b; font-size: 12px; }
.dossier-list { margin: 0; display: grid; gap: 0; }
.dossier-list > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid rgba(42, 29, 23, 0.14);
  align-items: baseline;
}
.dossier-list dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(42, 29, 23, 0.6); }
.dossier-list dd { margin: 0; font-variation-settings: 'opsz' 14; font-family: var(--serif); font-size: clamp(19px, 2.2vw, 24px); line-height: 1.3; }
/* le texte s'écrit lettre après lettre, à l'encre foncée, sur le papier (lettres créées par invitation.js) */
.ink .wd { white-space: nowrap; }
.ink .ch { opacity: 0; }
.dossier-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 26px; }
.dossier-foot .kicker { color: rgba(42, 29, 23, 0.55); }
.dossier-foot .sig { font-family: var(--serif); font-style: italic; font-size: 40px; color: #6e0a18; line-height: 1; }
@media (max-width: 520px) {
  .dossier-list > div { grid-template-columns: 1fr; gap: 6px; }
}
/* petits téléphones : la carte tient en entier sous la barre du haut pendant que le texte s'écrit */
@media (max-width: 520px) and (max-height: 760px) {
  .dossier-card { padding: 20px 22px; }
  .dossier-card::before { inset: 8px; }
  .dossier-head { margin-bottom: 12px; }
  .dossier-list > div { padding: 9px 0; gap: 2px; }
  .dossier-list dd { font-size: 18px; }
  .dossier-foot { margin-top: 10px; }
  .dossier-foot .sig { font-size: 30px; }
}

/* fiesta (éventail) */
.s-fiesta {
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
  padding: 0 clamp(22px, 7vw, 120px);
}
.fiesta-words { display: grid; gap: clamp(4px, 1.4vh, 16px); }
.fw { margin: 0; display: flex; align-items: baseline; gap: 18px; opacity: 0; }
.fw em { font-size: clamp(52px, 8.6vw, 128px); line-height: 0.95; color: var(--crema); }
.fw span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--oro); }
.fw-last em { background: var(--gold-grad); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: shimmer 6s ease-in-out infinite alternate; padding-right: 0.08em; }
.fw-last span { max-width: 16ch; line-height: 1.6; }
@media (max-aspect-ratio: 1/1) {
  .s-fiesta { align-items: flex-end; padding-bottom: calc(9vh + var(--safe-b)); }
  .fw { flex-direction: column; gap: 2px; }
  .fw em { font-size: clamp(44px, 13vw, 92px); }
}

/* destination */
.s-dest {
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 20px;
}
.sun {
  position: absolute;
  left: 50%;
  top: 62%;
  width: min(70vw, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, 30%);
  background: radial-gradient(circle at 50% 50%, rgba(255, 214, 160, 0.95) 0%, rgba(255, 170, 120, 0.7) 35%, rgba(232, 120, 100, 0.0) 70%);
  filter: blur(6px);
  opacity: 0;
}
.dest-inner { position: relative; display: grid; justify-items: center; gap: 16px; }
.dest-city {
  font-size: clamp(64px, 15vw, 230px);
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: #fff3ea;
  text-shadow: 0 10px 60px rgba(120, 30, 40, 0.5);
}
.dest-city .ch { display: inline-block; }
.dest-coords { font-family: var(--mono); font-size: clamp(12px, 1.4vw, 15px); letter-spacing: 0.2em; color: #ffe6c8; min-height: 1.4em; margin: 0; }
.dest-coords::after { content: '▍'; animation: blink 0.9s steps(1) infinite; margin-left: 2px; color: var(--oro-pale); }
.dest-text { max-width: 30ch; color: rgba(255, 240, 230, 0.9); font-size: clamp(17px, 1.6vw, 20px); margin: 6px 0 0; }

/* date */
.s-date {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12vh 20px;
}
.date-inner { display: grid; justify-items: center; gap: 12px; perspective: 900px; }
.date-days { display: flex; align-items: center; gap: clamp(8px, 2vw, 26px); margin: 8px 0 0; }
.date-days b {
  font-weight: 400;
  font-variation-settings: 'opsz' 11;
  font-family: var(--serif);
  font-size: clamp(88px, 17vw, 250px);
  line-height: 0.86;
  letter-spacing: -0.04em;
  background: var(--gold-grad);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  padding: 0 0.04em;
}
.date-days i { width: clamp(6px, 0.9vw, 12px); height: clamp(6px, 0.9vw, 12px); border-radius: 50%; background: var(--rojo-glow); box-shadow: 0 0 18px var(--rojo-glow); }
.date-days small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--crema-3); margin-top: 10px; -webkit-text-fill-color: var(--crema-3); }
.date-day { display: grid; justify-items: center; }
.date-month { font-family: var(--serif); font-style: italic; font-size: clamp(30px, 4.6vw, 62px); margin: 0; line-height: 1.1; }
.date-sub { font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--crema-2); margin: 8px 0 0; }

/* neuf mois */
.s-journey { overflow: hidden; }
.journey-pin {
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(26px, 5vh, 56px);
  padding: 12vh 0 8vh;
}
.journey-head { padding: 0 clamp(22px, 7vw, 120px); max-width: 760px; }
.journey-head h2 { font-size: clamp(44px, 6.4vw, 96px); margin: 10px 0 14px; }
.journey-head h2 em { color: var(--oro-pale); }
.journey-head p { color: var(--crema-2); max-width: 44ch; margin: 0; }
.journey-rail { margin: 0 clamp(22px, 7vw, 120px); height: 1px; background: var(--line); }
.journey-rail i { display: block; height: 100%; background: var(--oro); transform: scaleX(0); transform-origin: left; box-shadow: 0 0 12px var(--oro); }
.journey-track {
  display: flex;
  gap: clamp(16px, 2.4vw, 32px);
  padding: 0 clamp(22px, 7vw, 120px);
  width: max-content;
  will-change: transform;
}
.step {
  width: clamp(250px, 27vw, 360px);
  padding: 26px 24px 28px;
  background: linear-gradient(180deg, rgba(36, 18, 20, 0.7), rgba(18, 10, 12, 0.55));
  border: 1px solid var(--line);
  border-top: 2px solid rgba(214, 179, 106, 0.45);
  border-radius: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.step.is-now { border-top-color: var(--rojo-glow); background: linear-gradient(180deg, rgba(110, 10, 24, 0.55), rgba(30, 10, 14, 0.55)); }
.step-date { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--oro); }
.step.is-now .step-date::after { content: ' · tu es ici'; color: var(--rojo-glow); }
.step h3 { font-size: clamp(28px, 2.6vw, 36px); margin: 14px 0 10px; }
.step p { margin: 0; color: var(--crema-2); font-size: 16px; }

/* lettre */
.s-letter { padding: 18vh 20px; display: grid; place-items: center; perspective: 1400px; }
.letter {
  position: relative;
  width: min(100%, 700px);
  padding: clamp(34px, 6vw, 68px) clamp(26px, 6vw, 72px);
  color: #2a1d17;
  background:
    radial-gradient(120% 80% at 80% 0%, rgba(255, 255, 255, 0.5), transparent 60%),
    linear-gradient(160deg, #f5ecdc, #e9dcc4);
  border-radius: 2px;
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.6);
  transform-origin: 50% 0%;
}
.letter::after {
  content: '40';
  position: absolute;
  top: -26px;
  right: clamp(20px, 6vw, 60px);
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  color: rgba(255, 220, 200, 0.85);
  background: radial-gradient(circle at 35% 30%, #d62a3c, #8e0d1d 55%, #5c0612);
  box-shadow: 0 6px 18px rgba(80, 0, 10, 0.5), inset 0 -4px 10px rgba(0, 0, 0, 0.35), inset 0 3px 6px rgba(255, 140, 140, 0.35);
}
.letter .kicker { color: #8e0d1d; margin-bottom: 26px; }
.letter-body { font-variation-settings: 'opsz' 16; font-family: var(--serif); font-size: clamp(19px, 2.1vw, 24px); line-height: 1.55; }
.letter-body p { margin: 0 0 1em; }
.letter-body p:last-child { font-style: italic; font-size: 1.6em; color: #6e0a18; margin: 0.4em 0 0; text-align: right; }

/* infos */
.s-info { padding: 14vh clamp(20px, 6vw, 100px) 16vh; max-width: 1320px; margin: 0 auto; }
.info-head { margin-bottom: 44px; }
.info-head h2 { font-size: clamp(44px, 6vw, 88px); margin-top: 10px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.info {
  padding: 26px 24px;
  background: rgba(20, 11, 13, 0.62);
  border: 1px solid var(--line);
  border-radius: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.info-n { font-family: var(--mono); font-size: 11px; color: var(--oro); letter-spacing: 0.2em; }
.info h3 { font-size: 30px; margin: 12px 0 12px; }
.info p, .info .rich { color: var(--crema-2); font-size: 16px; margin: 0; }
.note {
  display: flex;
  gap: 16px;
  margin-top: 22px;
  padding: 22px 24px;
  border: 1px dashed rgba(214, 179, 106, 0.45);
  border-radius: 2px;
  background: rgba(110, 10, 24, 0.14);
}
.note-mark { font-family: var(--serif); font-size: 40px; line-height: 0.8; color: var(--oro); }
.note .rich { color: var(--crema); font-size: 17px; }

/* réponse */
.s-rsvp {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32vh 20px 12vh;
  text-align: center;
}
/* écran vertical : de la place sous les boutons pour que la boule tienne au-dessus du titre en bas de page */
@media (max-aspect-ratio: 1/1) { .s-rsvp { align-items: end; padding-bottom: 6vh; } }
.rsvp-inner { width: min(100%, 1100px); display: grid; justify-items: center; gap: 12px; }
.rsvp-title { font-size: clamp(54px, 9.4vw, 136px); line-height: 0.95; margin: 6px 0 26px; }
@media (min-width: 700px) { .rsvp-title { white-space: nowrap; } }
.rsvp-title em { background: var(--gold-grad); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: shimmer 6s ease-in-out infinite alternate; padding-right: 0.06em; }
.rsvp-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 760px); }
.choice {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 30px 20px;
  background: rgba(20, 11, 13, 0.65);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.4s, background 0.4s, transform 0.4s var(--ease), box-shadow 0.4s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.choice span { font-family: var(--serif); font-size: clamp(26px, 3vw, 34px); line-height: 1.1; }
.choice small { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--crema-3); }
.choice:hover { border-color: var(--oro); transform: translateY(-3px); }
.choice-yes:hover, .choice-yes.is-selected { background: rgba(110, 10, 24, 0.5); box-shadow: 0 20px 60px rgba(179, 19, 43, 0.3); }
.choice.is-selected { border-color: var(--oro); }
@media (max-width: 560px) { .rsvp-choice { grid-template-columns: 1fr; } }
.rsvp-form { width: min(100%, 520px); margin-top: 22px; text-align: left; }
.rsvp-form .opt { text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 2px; width: max-content; }
.stepper button { width: 50px; height: 50px; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--oro-pale); }
.stepper button:hover { background: rgba(214, 179, 106, 0.1); }
.stepper output { min-width: 48px; text-align: center; font-family: var(--serif); font-size: 26px; }
.rsvp-actions { display: flex; align-items: center; gap: 24px; margin-top: 10px; flex-wrap: wrap; }
.rsvp-done { width: min(100%, 600px); display: grid; justify-items: center; gap: 14px; margin-top: 4px; }
.rsvp-done h3 { font-size: clamp(34px, 4.6vw, 54px); }
.rsvp-done .rich { font-size: 18px; max-width: 46ch; }
.rsvp-done .countdown { margin: 18px 0 8px; }
.rsvp-done .countdown b { font-size: clamp(30px, 6vw, 52px); }
.rsvp-done .btn { margin-top: 10px; }
.rsvp-done .muted { font-size: 14px; color: var(--crema-3); }

/* pied */
.foot { padding: 50px 20px calc(40px + var(--safe-b)); text-align: center; border-top: 1px solid var(--line); display: grid; justify-items: center; gap: 6px; }
.foot .mark { font-size: 30px; margin-bottom: 8px; }
.foot p { margin: 0; font-size: 13px; color: var(--crema-3); }
.foot-code { font-family: var(--mono); font-size: 12px !important; letter-spacing: 0.1em; }

/* mouvements réduits / sans 3D : tout reste lisible */
.no-motion .fw, .no-motion .manifesto-text .w { opacity: 1 !important; }
.no-motion .s-manifesto, .no-motion .s-fiesta, .no-motion .s-dest, .no-motion .journey-pin { height: auto; min-height: 80vh; padding-top: 12vh; padding-bottom: 12vh; }
.no-motion .journey-track { width: auto; flex-wrap: wrap; }
.no-motion .sun { opacity: 0.8; }
