/* Cori in Paci, page publique (version Opus) : une même pièce, du matin à la nuit. */
:root {
  --mur: #E6D5BA;
  --mur-chaud: #DCC6A4;
  --soleil: #FFF5E2;
  --ombre: #6B4A2B;
  --encre: #2B1B12;
  --nuit: #16100E;
  --creme: #F3E7D3;
  --ambre: #E9B574;
  --m: clamp(18px, 3vw, 44px);
  --p: 0;
  --titre: "DM Serif Display", Georgia, serif;
  --serif: "Gilda Display", Georgia, serif;
  --sans: "Jost", system-ui, sans-serif;
  --miel: #E2B26F;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--nuit); color: var(--encre);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--encre); outline-offset: 4px; }
.nuit :focus-visible { outline-color: var(--miel); }
::selection { background: var(--encre); color: var(--creme); }
main { overflow-x: clip; }

/* Le grain du papier, sur toute la page */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: var(--grain); opacity: .09; mix-blend-mode: multiply;
}

/* ---------- Le jour ---------- */
.jour { position: relative; min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; color: var(--encre); }
.jour > .carte { grid-row: 2; align-self: end; justify-self: end; margin: 0 var(--m) clamp(20px, 4svh, 48px); }
.jour > .titre { grid-row: 3; }
.piece {
  position: absolute; inset: 0; background: var(--mur);
  background-image:
    radial-gradient(85% 70% at 70% 30%, rgba(255, 244, 222, .7), rgba(232, 218, 195, 0) 62%),
    radial-gradient(70% 60% at 0% 100%, rgba(120, 86, 52, .28), rgba(120, 86, 52, 0) 70%);
}

/* La fenêtre : six carreaux de soleil posés sur le mur */
.fenetre {
  position: absolute; right: 4vw; top: -6svh; width: 44vw; height: 96svh;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 1.1vw;
  transform: perspective(1400px) rotateY(-22deg) skewY(-7deg) translateY(calc(var(--p) * 14svh));
  transform-origin: right top; opacity: calc(1 - var(--p) * 1.1);
}
.fenetre i { background: #FFF1D6; filter: blur(6px); mix-blend-mode: screen; opacity: 1; border-radius: 2px; }

/* L'ombre des feuilles devant la fenêtre */
.feuilles {
  position: absolute; right: -2vw; top: -4svh; width: 58vw; height: auto; color: var(--ombre);
  opacity: calc(.17 - var(--p) * .17); filter: blur(9px); mix-blend-mode: multiply;
  transform-origin: 0% 0%; animation: vent 9s ease-in-out infinite alternate;
}
@keyframes vent {
  0% { transform: rotate(0deg) translate(0, 0); }
  50% { transform: rotate(1.4deg) translate(-.4vw, .3vw); }
  100% { transform: rotate(-.8deg) translate(.3vw, -.2vw); }
}

/* La nuit qui tombe pendant qu'on descend */
.tombe { position: absolute; inset: 0; background: #3A2217; opacity: min(1, calc(var(--p) * 1.15)); }
.tombe::after { content: ""; position: absolute; inset: 0; background: var(--nuit); opacity: clamp(0, calc(var(--p) * 1.6 - .45), .9); }
.jour::after { /* le bas du matin se fond dans la nuit : plus de couture entre les deux écrans */
  content: ""; position: absolute; inset: auto 0 0; height: 55svh; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(22, 16, 14, 0), rgba(22, 16, 14, .85) 60%, var(--nuit)); opacity: min(1, calc(var(--p) * 5));
}

.bar { position: relative; z-index: 3; display: flex; justify-content: flex-end; align-items: center; padding: 22px var(--m); }
.etiquette {
  display: inline-flex; align-items: center; gap: 14px; height: 46px; padding: 0 24px;
  font-family: var(--sans); font-weight: 400; font-size: .8125rem; letter-spacing: .26em; text-transform: uppercase; text-decoration: none;
  color: var(--encre); border: 1.5px solid var(--encre); border-radius: 0; background: rgba(255, 250, 241, .2);
  transition: background-color .3s ease, color .3s ease;
}
.etiquette:hover { background: var(--encre); color: var(--creme); }

/* Le titre, comme sur une couverture de magazine */
.titre {
  position: relative; z-index: 2; padding: 0 var(--m) clamp(24px, 6svh, 72px);
  font-family: var(--titre); font-weight: 400; font-size: clamp(3rem, 11.5vw, 12rem);
  color: color-mix(in srgb, var(--creme) calc(min(1, var(--p) * 3) * 100%), var(--encre)); /* le titre s'éclaire quand la nuit tombe */
  line-height: .9; letter-spacing: -0.02em; white-space: nowrap;
  transform: translateY(calc(var(--p) * -6svh));
}

/* Verre poli */
.verre {
  background: rgba(255, 250, 241, .3);
  -webkit-backdrop-filter: blur(22px) saturate(1.35); backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .75),
    inset 0 -1px 1px rgba(107, 74, 43, .1),
    0 30px 70px -30px rgba(70, 44, 20, .45),
    0 2px 8px rgba(70, 44, 20, .08);
}

.carte {
  position: relative; z-index: 3; width: min(380px, calc(100% - 2 * var(--m))); padding: 34px 32px 30px; border-radius: 30px;
}
.phrase { font-family: var(--serif); font-size: clamp(1.375rem, 1.1rem + .8vw, 1.75rem); line-height: 1.3; }
.bouton {
  display: inline-flex; align-items: center; height: 52px; padding: 0 30px; margin-top: 26px; border-radius: 999px;
  background: var(--encre); color: var(--creme); font-family: var(--sans); font-weight: 400; font-size: .875rem; letter-spacing: .22em; text-transform: uppercase; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 10px 24px -10px rgba(43, 27, 18, .7);
  transition: transform .3s ease, box-shadow .3s ease;
}
.bouton:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 16px 30px -12px rgba(43, 27, 18, .75); }
.bouton:active { transform: translateY(0); }
.qr { display: flex; align-items: center; gap: 16px; margin-top: 26px; padding-top: 22px; }
.qr-img { width: 92px; height: 92px; flex: none; border-radius: 12px; }
.qr p { font-family: var(--serif); font-size: .9375rem; line-height: 1.35; max-width: 18ch; }

/* ---------- La nuit ---------- */
.nuit {
  position: relative; min-height: 100svh; background: var(--nuit); color: var(--creme);
  display: flex; align-items: center; padding: 14svh var(--m); overflow: hidden;
}
.chambre {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 55% at 74% 62%, rgba(176, 104, 52, .32), rgba(22, 16, 14, 0) 70%),
    linear-gradient(to bottom, rgba(22, 16, 14, 0) 72%, rgba(10, 7, 6, .7) 72.2%);
}
/* La porte entrouverte : un fil de lumière, son halo sur le mur, sa flaque sur le sol */
.porte {
  position: absolute; left: 72%; bottom: 28%; width: 7px; height: 50svh;
  animation: veille 6s ease-in-out infinite alternate;
}
.porte::before { /* le halo sur le mur, plus fort près du sol */
  content: ""; position: absolute; left: -11vw; right: -11vw; top: 6%; bottom: -2%;
  background: radial-gradient(50% 60% at 50% 72%, rgba(233, 181, 116, .3), rgba(233, 181, 116, 0) 70%);
  filter: blur(10px);
}
.porte b { /* le fil, plus chaud au centre, flou sur les bords */
  position: absolute; inset: 0; border-radius: 2px;
  background: linear-gradient(to bottom, rgba(255, 214, 160, .55), #FFE4B8 30%, #F6C88A 85%, rgba(246, 200, 138, .8));
  filter: blur(1.2px); box-shadow: 0 0 14px 2px rgba(255, 210, 150, .45);
}
.flaque {
  position: absolute; left: calc(72% - 15vw + 3px); bottom: 0; width: 30vw; height: 28%;
  filter: blur(14px); animation: veille 6s ease-in-out infinite alternate;
}
.flaque::before { /* la lumière qui s'élargit en venant vers nous */
  content: ""; position: absolute; inset: 0; clip-path: polygon(48.8% 0, 51.2% 0, 76% 100%, 30% 100%);
  background: linear-gradient(to bottom, rgba(246, 200, 138, .5), rgba(233, 181, 116, .08));
}
@keyframes veille { from { opacity: .85; } to { opacity: 1; } }

.nuit-texte { position: relative; z-index: 2; }
.nuit h2 { font-family: var(--titre); font-weight: 400; font-size: clamp(2.75rem, 8.5vw, 8.5rem); line-height: .95; letter-spacing: -0.02em; white-space: nowrap; }
.nuit p { margin-top: 44px; font-family: var(--serif); font-size: clamp(1.25rem, 1rem + .8vw, 1.625rem); line-height: 1.3; max-width: 30ch; opacity: .92; }
.etiquette-nuit { margin-top: 40px; height: 52px; padding: 0 30px; color: var(--miel); border-color: var(--miel); background: transparent; }
.etiquette-nuit:hover { background: var(--miel); color: var(--nuit); }

/* Entrées */
@keyframes monte { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes eclaire { from { opacity: 0; } to { opacity: 1; } }
.piece { animation: eclaire 1.6s ease both; }
.bar { animation: monte .8s ease .1s both; }
.titre { animation: monte 1.1s cubic-bezier(.2, .7, .2, 1) .25s both; }
.carte { animation: monte 1s cubic-bezier(.2, .7, .2, 1) .8s both; }
.js .rev { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.js .rev.vu { opacity: 1; transform: none; }

@media (hover: none) and (pointer: coarse) { .qr { display: none; } }

/* Téléphone */
@media (max-width: 760px) {
  .fenetre { width: 86vw; right: -18vw; height: 70svh; }
  .feuilles { width: 120vw; right: -30vw; }
  .jour { grid-template-rows: auto 1fr auto auto; }
  .jour { grid-template-columns: 100%; }
  .jour > .titre { font-size: 15.5vw; padding-bottom: 0; grid-row: 2; align-self: center; }
  .jour > .carte { grid-row: 3; justify-self: stretch; width: auto; margin: 0 var(--m) var(--m); }
  .nuit h2 { font-size: 12.5vw; }
  .etiquette { padding: 0 18px; }
  .qr { display: none; }
  .porte { left: 93%; height: 40svh; }
  .flaque { left: calc(93% - 30vw + 3px); width: 60vw; }
  .nuit p { max-width: 21ch; }
  .nuit { align-items: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .feuilles, .porte, .flaque, .piece, .bar, .titre, .carte { animation: none !important; }
  .js .rev { opacity: 1; transform: none; transition: none; }
  /* la nuit tombe quand même (c'est de la lumière, pas du mouvement), mais rien ne glisse */
  .fenetre { transform: perspective(1400px) rotateY(-22deg) skewY(-7deg); }
  .titre { transform: none; }
}
