/* =========================================================
   Nestal — page de pré-lancement « La porte s'ouvre bientôt »
   Système Studio Ayer : Alabaster + Charcoal portent la page,
   Chestnut est le seul fond sombre, l'orange est un accent rare
   (la porte du N, le bouton). Fraunces = display, DM Sans = corps.
   ========================================================= */

:root {
  --alabaster: #f6f1ea;
  --charcoal: #2b2d28;
  --charcoal-60: rgba(43, 45, 40, 0.62);
  --charcoal-30: rgba(43, 45, 40, 0.3);
  --orange: #f26323;
  --ochre: #fdb000;
  --chestnut: #7a4737;
  --sand: #d1c6b3;
  --sand-soft: rgba(209, 198, 179, 0.45);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--alabaster);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

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

/* Grain papier — toute la page lit comme un imprimé, pas un écran */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.05;
  mix-blend-mode: multiply;
}

.svg-defs { position: absolute; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Révélations au défilement ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Titres : les lignes arrivent l'une après l'autre */
.reveal .line {
  display: block;
  opacity: 0;
  transform: translateY(0.55em);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.is-visible .line { opacity: 1; transform: translateY(0); }
.reveal.is-visible .line:nth-child(2) { transition-delay: 0.09s; }
.reveal.is-visible .line:nth-child(3) { transition-delay: 0.18s; }

.parallax-layer { will-change: transform; }

/* =========================================================
   1. LA PORTE — hero
   ========================================================= */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: clamp(2rem, 6vw, 4rem);
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero__logo {
  margin: 0;
  width: min(560px, 74vw);
}

.hero__logo svg {
  display: block;
  width: 100%;
  height: auto;
  fill: var(--charcoal);
}

/* Entrée du logotype : les lettres se posent une à une, puis la porte s'allume */
.logo-letter {
  opacity: 0;
  transform: translateY(14px);
  transform-box: fill-box;
  animation: lettre-posee 0.55s var(--ease-out) forwards;
}

.logo-letter:nth-child(1) { animation-delay: 0.05s; }
.logo-letter:nth-child(2) { animation-delay: 0.13s; }
.logo-letter:nth-child(3) { animation-delay: 0.21s; }
.logo-letter:nth-child(4) { animation-delay: 0.29s; }
.logo-letter:nth-child(5) { animation-delay: 0.37s; }
.logo-letter:nth-child(6) { animation-delay: 0.45s; }

@keyframes lettre-posee {
  to { opacity: 1; transform: translateY(0); }
}

/* La porte du N — un seul clin d'œil orange, une seule fois, après les lettres */
.logo__notch {
  fill: var(--charcoal);
  animation: lettre-posee 0.55s var(--ease-out) 0.05s forwards,
             porte-ouverte 0.5s var(--ease-out) 1.25s forwards;
  opacity: 0;
  transform: translateY(14px);
  transform-box: fill-box;
}

@keyframes porte-ouverte {
  to { fill: var(--orange); }
}

.hero__kicker {
  margin: clamp(1.6rem, 4vh, 2.6rem) 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--charcoal-60);
}

/* Le kicker et l'invite à défiler arrivent en dernier */
.hero__kicker,
.scroll-cue {
  opacity: 0;
  animation: apparition 0.7s var(--ease-out) 1.3s forwards;
}

@keyframes apparition {
  to { opacity: 1; }
}

.scroll-cue {
  position: absolute;
  bottom: clamp(1.5rem, 4vh, 2.75rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.scroll-cue__line {
  width: 1px;
  height: 52px;
  background: var(--sand);
  animation: cue-glisse 2.6s ease-in-out infinite;
  transform-origin: top;
}

@keyframes cue-glisse {
  0%, 100% { transform: scaleY(0.55); opacity: 0.6; }
  50%      { transform: scaleY(1); opacity: 1; }
}

.scroll-cue__label {
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--charcoal-60);
}

/* =========================================================
   Chapitres — gabarit éditorial
   ========================================================= */

.chapter { padding: clamp(4.5rem, 12vh, 8.5rem) clamp(1.25rem, 5vw, 4rem); }

.chapter__inner {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(1.25rem, 3vw, 3rem);
  align-items: center;
}

.chapter__no {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--sand);
}

.chapter__no--sombre { color: rgba(246, 241, 234, 0.38); }

.chapter__kicker {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--charcoal-60);
}

.chapter__headline {
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-weight: 540;
  font-variation-settings: "SOFT" 40, "WONK" 0;
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  line-height: 1.07;
  letter-spacing: -0.015em;
}

.chapter__headline em {
  font-style: italic;
  font-weight: 480;
}

.chapter__body {
  margin: 0;
  max-width: 32rem;
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  color: var(--charcoal);
}

/* Soulignement ocre, tracé un peu irrégulier — il se dessine à la révélation */
.souligne {
  position: relative;
  white-space: nowrap;
}

.souligne__trait {
  position: absolute;
  left: 0;
  bottom: -0.22em;
  width: 100%;
  height: 0.5em;
  overflow: visible;
}

.souligne__trait path {
  fill: none;
  stroke: var(--ochre);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.65s var(--ease-out) 0.45s;
}

.reveal.is-visible .souligne__trait path { stroke-dashoffset: 0; }

/* ---------- 01 · Les lieux ---------- */

.collage {
  grid-column: 1 / 7;
  grid-row: 1;
  position: relative;
  padding-bottom: clamp(4rem, 9vw, 6.5rem);
}

.collage__item { margin: 0; }

.collage__item img { border: 1px solid var(--sand); }

.collage__item--escalier { width: 92%; }

.collage__item--cuisine {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 44%;
  box-shadow: 0 18px 50px rgba(43, 45, 40, 0.14);
}

.chapter--lieux .chapter__text { grid-column: 7 / 13; grid-row: 1; }

/* ---------- 02 · Le métier ---------- */

.chapter--metier .chapter__text { grid-column: 1 / 7; grid-row: 1; }

.chapter--metier .chapter__illu {
  grid-column: 7 / 13;
  grid-row: 1;
  margin: 0;
}

.chapter--metier .chapter__illu img {
  width: min(100%, 520px);
  margin-left: auto;
}

/* ---------- 04 · Nestal ---------- */

.chapter--nestal .chapter__illu {
  grid-column: 1 / 5;
  grid-row: 1;
  margin: 0;
}

.chapter--nestal .chapter__illu img {
  width: min(78%, 340px);
  margin: 0 auto;
}

.chapter--nestal .chapter__text { grid-column: 5 / 13; grid-row: 1; }

/* =========================================================
   03 · La question — le seul fond sombre
   ========================================================= */

.question {
  position: relative;
  overflow: hidden;
  background: var(--chestnut);
  color: var(--alabaster);
  padding: clamp(6rem, 16vh, 10.5rem) clamp(1.25rem, 5vw, 4rem);
}

.question__porte {
  position: absolute;
  top: 50%;
  right: -4%;
  transform: translateY(-50%);
  height: 150%;
  width: auto;
  fill: rgba(246, 241, 234, 0.09);
  pointer-events: none;
}

.question__inner {
  position: relative;
  max-width: 1160px;
  margin: 0 auto;
}

.question__lines {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 440;
  font-variation-settings: "SOFT" 70, "WONK" 0;
  font-size: clamp(1.9rem, 4.4vw, 3.4rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.question__line { display: block; }

.question__line--forte { margin-top: 0.35em; }

.question__temps { color: var(--ochre); }

/* =========================================================
   L'invitation + formulaire
   ========================================================= */

.invitation { padding: clamp(5rem, 14vh, 10rem) clamp(1.25rem, 5vw, 4rem); }

.invitation__panel {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

/* La petite porte au-dessus du titre — elle s'ouvre à l'inscription */
.invitation__door {
  width: 34px;
  margin: 0 auto 1.4rem;
  perspective: 260px;
}

.invitation__door svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.invitation__door-light {
  fill: var(--ochre);
  opacity: 0;
  transition: opacity 0.6s ease 0.25s, filter 0.6s ease 0.25s;
}

.invitation__door-leaf {
  fill: var(--charcoal);
  transform-box: fill-box;
  transform-origin: left center;
  transition: transform 0.85s cubic-bezier(0.34, 1.2, 0.44, 1) 0.1s;
}

.invitation__panel.is-open .invitation__door-leaf { transform: rotateY(-74deg); }

.invitation__panel.is-open .invitation__door-light {
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(253, 176, 0, 0.75));
}

/* À l'ouverture, le formulaire s'efface au profit du message */
.invitation__panel.is-open .signup__select-wrap,
.invitation__panel.is-open .signup__input,
.invitation__panel.is-open .signup__button,
.invitation__panel.is-open .signup__rgpd {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.invitation__panel.is-open-done .signup__select-wrap,
.invitation__panel.is-open-done .signup__input,
.invitation__panel.is-open-done .signup__button,
.invitation__panel.is-open-done .signup__rgpd { display: none; }

.invitation__panel.is-open .signup__status {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.4;
}

.invitation__headline {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 540;
  font-variation-settings: "SOFT" 40, "WONK" 0;
  font-size: clamp(2.1rem, 4.6vw, 3.2rem);
  line-height: 1.07;
  letter-spacing: -0.015em;
}

.invitation__body {
  margin: 0 auto 2.25rem;
  max-width: 30rem;
  font-size: clamp(1rem, 1.3vw, 1.125rem);
}

/* « Vous êtes… » — menu déroulant */
.signup__select-wrap {
  position: relative;
  flex: 1 1 100%;
}

.signup__select-wrap::after {
  content: "";
  position: absolute;
  right: 1.1rem;
  top: 50%;
  width: 0.65rem;
  height: 0.65rem;
  transform: translateY(-70%) rotate(45deg);
  border-right: 1.5px solid var(--charcoal-60);
  border-bottom: 1.5px solid var(--charcoal-60);
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.signup__select-wrap:hover::after { border-color: var(--charcoal); }

.signup__select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 0.9rem 2.6rem 0.9rem 1.1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--charcoal-60);
  background: var(--alabaster);
  border: 1px solid var(--charcoal-30);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.signup__select:hover { border-color: var(--charcoal-60); }

.signup__select:focus {
  outline: none;
  border-color: var(--charcoal);
}

.signup__select.has-value { color: var(--charcoal); }

.signup__form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.signup__input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--charcoal);
  background: var(--alabaster);
  border: 1px solid var(--charcoal-30);
  border-radius: 2px;
  transition: border-color 0.2s ease;
}

.signup__input::placeholder { color: var(--charcoal-60); }

.signup__input:focus {
  outline: none;
  border-color: var(--charcoal);
}

.signup__input[aria-invalid="true"] { border-color: var(--orange); }

.signup__button {
  flex: 0 0 auto;
  padding: 0.9rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--charcoal);
  background: var(--orange);
  border: 1px solid var(--orange);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.signup__button:hover,
.signup__button:focus-visible { background: #e0561a; border-color: #e0561a; }

.signup__button:disabled { opacity: 0.6; cursor: default; }

.signup__status {
  flex: 1 1 100%;
  margin: 0.35rem 0 0;
  min-height: 1.4em;
  font-size: 0.9375rem;
}

.signup__status[data-state="error"] { color: #a03d10; }

.signup__rgpd {
  margin: 1.75rem auto 0;
  max-width: 26rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--charcoal-60);
}

/* =========================================================
   Footer
   ========================================================= */

.footer {
  padding: clamp(3rem, 8vh, 5rem) clamp(1.25rem, 5vw, 4rem) 2.5rem;
  border-top: 1px solid var(--sand);
  text-align: center;
}

.footer__logo { margin: 0 auto 1.5rem; width: 104px; }

.footer__logo svg {
  display: block;
  width: 100%;
  height: auto;
  fill: var(--charcoal);
}

.footer__legal {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.875rem;
}

.footer__legal a {
  color: var(--charcoal-60);
  text-decoration: none;
  border-bottom: 1px solid var(--sand);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer__legal a:hover,
.footer__legal a:focus-visible {
  color: var(--charcoal);
  border-color: var(--charcoal-60);
}

.footer__copyright {
  margin: 1.4rem 0 0;
  font-size: 0.8125rem;
  color: var(--charcoal-60);
}

/* =========================================================
   Écrans étroits
   ========================================================= */

@media (max-width: 860px) {
  .chapter__inner { display: block; }

  /* Sur petit écran, les titres se composent naturellement :
     le découpage en lignes fixes créerait des veuves. */
  .chapter__headline .line,
  .invitation__headline .line {
    display: inline;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .collage { padding-bottom: 3.5rem; margin-bottom: 2.5rem; }
  .collage__item--escalier { width: 100%; }
  .collage__item--cuisine { width: 52%; right: -0.25rem; }

  .chapter--metier .chapter__illu { margin-bottom: 2.5rem; }
  .chapter--metier .chapter__illu img { width: min(82%, 420px); margin: 0 auto; }

  .chapter--nestal .chapter__illu { margin-bottom: 2.5rem; }
  .chapter--nestal .chapter__illu img { width: min(58%, 280px); }

  .question__porte { right: -18%; opacity: 0.8; }
}

/* =========================================================
   Mouvement réduit
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal .line {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .logo-letter,
  .logo__notch,
  .hero__kicker,
  .scroll-cue {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .logo__notch { fill: var(--orange); }

  .scroll-cue__line { animation: none; }

  .souligne__trait path {
    transition: none;
    stroke-dashoffset: 0;
  }

  .invitation__door-leaf,
  .invitation__door-light,
  .invitation__panel.is-open .signup__select-wrap,
  .invitation__panel.is-open .signup__input,
  .invitation__panel.is-open .signup__button,
  .invitation__panel.is-open .signup__rgpd {
    transition: none;
  }
}
