@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400;1,9..144,500&family=Jost:wght@300;400;500;600&family=Mrs+Saint+Delafield&display=swap');

  :root{
    --ivory:#F3EEE0;
    --ivory-2:#EAE1C9;
    --ink:#201F1B;
    --ink-2:#14130F;
    --rose:#B08D46;
    --rose-light:#D8C08A;
    --toile-blue:#7E93B0;
    --sage:#78896A;
    --charcoal:#221F1A;
    --cream:#F7F1E4;
    --max-w:480px;
  }

  *{box-sizing:border-box; margin:0; padding:0;}

  html{
    scroll-behavior:smooth;
    scroll-snap-type:y proximity;
  }

  @media (prefers-reduced-motion: reduce){
    html{scroll-behavior:auto; scroll-snap-type:none;}
    *{animation-duration:0.001ms !important; transition-duration:0.001ms !important;}
  }

  body{
    font-family:'Jost', sans-serif;
    background:#5E7391;
    background-image:
      radial-gradient(circle at 20% 20%, rgba(176,141,70,0.07), transparent 40%),
      radial-gradient(circle at 80% 70%, rgba(176,141,70,0.05), transparent 45%);
    color:var(--charcoal);
    -webkit-font-smoothing:antialiased;
  }

  html, body{
    overflow-x:hidden;
  }

  .frame{
    max-width:var(--max-w);
    margin:0 0 0 auto;
    background:var(--ivory);
    position:relative;
    overflow: hidden;
  }

  @media (min-width:640px){
    body{
      padding:0 0 32px 16px;
      background-image:
        radial-gradient(circle at 20% 20%, rgba(176,141,70,0.07), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(176,141,70,0.05), transparent 45%),
        url(/photos/desktop.jpeg);
      background-repeat:no-repeat, no-repeat, no-repeat;
      background-position:0 0, 0 0, left center;
      background-size:auto, auto, contain;
      background-attachment:scroll, scroll, fixed;
    }
    .frame{
      box-shadow:0 40px 90px -20px rgba(0,0,0,0.55), 0 0 0 1px rgba(176,141,70,0.25);
      border-radius:0 0 2 px 2px;
    }
  }

  /* ---------- shared page shell ---------- */
  .page{
    position:relative;
    min-height:100svh;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:88px 32px 64px;
    scroll-snap-align:start;
    overflow:hidden;
  }
  .page.on-ivory{ background:var(--ivory); color:var(--charcoal); }
  .page.on-green{ background:var(--ink); color:var(--cream); }

  /* torn-page edge between sections */
  .edge{
    display: none;
    position:absolute;
    left:0; right:0; bottom:-1px;
    height:16px;
    background-size:16px 16px;
    background-repeat:repeat-x;
  }
  .edge-to-ivory{
    background-image:
      linear-gradient(135deg, var(--ivory) 50%, transparent 50.5%),
      linear-gradient(-135deg, var(--ivory) 50%, transparent 50.5%);
  }
  .edge-to-green{
    background-image:
      linear-gradient(135deg, var(--ink) 50%, transparent 50.5%),
      linear-gradient(-135deg, var(--ink) 50%, transparent 50.5%);
  }

  .eyebrow{
    font-family:'Jost', sans-serif;
    font-size:11px;
    letter-spacing:0.32em;
    text-transform:uppercase;
    color:var(--rose);
    margin-bottom:14px;
    display:flex; align-items:center; gap:10px;
  }
  .eyebrow::before{ content:""; width:22px; height:1px; background:var(--rose); display:inline-block;}

  h1,h2,h3{ font-family:'Fraunces', serif; font-weight:500; letter-spacing:-0.01em; }
  h2{ font-size:clamp(28px,7vw,36px); line-height:1.12; margin-bottom:18px; }
  .script{ font-family:'Mrs Saint Delafield', cursive; color:var(--rose); line-height:1; }

  p{ font-size:15.5px; line-height:1.75; font-weight:300; }
  .on-green p{ color:rgba(242,236,221,0.82); }
  .on-ivory p{ color:rgba(42,37,30,0.78); }

  .divider{
    width:36px; height:1px; background:var(--rose); margin:22px 0; opacity:0.7;
  }

  img.frame-photo{
    width:100%; display:block; object-fit:cover; border:1px solid rgba(176,141,70,0.35);
  }

  /* ---------- fixed overlay UI ---------- */
  #progress-track{
    position:fixed; top:0; left:0; right:0; height:2px; background:rgba(255,255,255,0.08); z-index:50;
  }
  #progress-bar{ height:100%; width:0%; background:linear-gradient(90deg, var(--rose), var(--rose-light)); transition:width 0.1s linear; }

  #page-counter{
    position:fixed; right:16px; bottom:16px; z-index:50;
    font-family:'Jost'; font-size:10.5px; letter-spacing:0.14em; text-transform:uppercase;
    color:var(--cream); background:rgba(32,31,29,0.88); border:1px solid rgba(176,141,70,0.5);
    padding:8px 12px; border-radius:2px; backdrop-filter:blur(4px);
    max-width:180px;
    pointer-events:none;
  }

  /* ---------- page 1 : cover ---------- */
  #page-1{
    padding:0; justify-content:center; align-items:center; text-align:center;
    background: radial-gradient(ellipse at center, rgba(247,241,228,0.35) 0%, rgba(32,31,27,0.12) 100%), url(/test/page2.png) center/cover no-repeat;
    color:var(--ink); min-height:100svh;
    overflow:visible;
  }
  #page-1 .cover-inner{
    padding:0 28px;
    position: relative;
    z-index:1;
    padding: 0 28px;
  }
  #page-1 .eyebrow{ color:var(--ink); justify-content:center; margin-bottom:18px; font-weight: 500;}
  #page-1 .eyebrow::before{ display:none; }
  #page-1 .names{ font-size:clamp(46px,15vw,66px); line-height:1; margin-bottom:10px; color:var(--ink); }
  #page-1 .amp{ display:block; font-size:0.55em; margin:2px 0; color:var(--rose); font-weight: bold;}
  #page-1 .date{
    font-family:'Jost'; letter-spacing:0.35em; font-size:13px; margin-top:14px; color:var(--ink); font-weight: 500;
  }
  #page-1 .scroll-cue{
    margin-top:38px; font-size:10px; letter-spacing:0.25em; text-transform:uppercase; opacity:0.7; color:var(--ink);
    display:flex; flex-direction:column; align-items:center; gap:8px; font-weight: 500;
  }
  #page-1 .scroll-cue span{ animation:bob 2.2s ease-in-out infinite; }
  @keyframes bob{ 0%,100%{transform:translateY(0);} 50%{transform:translateY(6px);} }

  /* ---------- page 2 : invitation ---------- */
  #page-2 p{ font-size:16.5px; line-height:1.85; }
  #page-2 .lead{ font-family:'Fraunces'; font-style:italic; font-size:20px; margin-bottom:20px; }
  #page-2 .photo-wide{
    width:80vw;
    max-width:calc(0.8 * var(--max-w)); /* ne dépasse pas 80% du frame sur desktop */
    margin:20px auto;
    display:block;
    border:1px solid rgba(176,141,70,0.35);
  }

  /* ---------- page 3 : citation ---------- */
  #page-3 .initial-frame-wrap{
  position:relative;   /* nécessaire pour que .initial-frame-text se cale dessus */
  width:80vw;
  max-width:calc(0.8 * var(--max-w));
  margin:0 auto 100px;  
}
  #page-3 .initial-frame{
    width:100%;
    display:block;
    margin:0;  
}
  #page-3 .initial-frame-text{
    position:absolute;
    top:50%; left:50%;
    transform:translate(-50%,-50%);
    font-family:'Fraunces', cursive;
    font-size:clamp(26px,6vw,38px);
    color:var(--cream);  /* à ajuster selon le contraste avec le centre de frame.png */
}
  #page-3{ align-items:center; text-align:center; }
  #page-3 blockquote{
    font-family:'Fraunces'; font-style:italic; font-weight:400; font-size:clamp(21px,6.2vw,26px);
    line-height:1.5; color:var(--cream);
  }
  #page-3 cite{ display:block; margin-top:22px; margin-bottom: 170px; font-family:'Jost'; font-style:normal; font-size:11px; letter-spacing:0.2em; text-transform:uppercase; color:var(--rose-light); }

  /* ---------- page 4/5 : portraits ---------- */
  .portrait-photo{ width:150px; height:150px; border-radius:50%; object-fit:cover; border:1px solid var(--rose); margin-bottom:26px; }
  .portrait-name{ font-size:12px; }
    #page-4 p, #page-5 p{ max-width:min(310px, 86%); margin-left:auto; margin-right:auto; }
  #page-4 p{ font-size:15.5px; line-height:1.75; font-weight: 500; color: var(--ink);}
  #page-5 p{ font-size:15.5px; line-height:1.75; font-weight: 500; color: var(--ivory);}
  #page-4{ background: url(/test/bgportrait1.png) center/cover no-repeat; align-items: center; text-align: center;}
  #page-5{ background: url(/test/bgportrait2.png) center/cover no-repeat; align-items: center; text-align: center;}

  /* ---------- page 6 : histoire (timeline) ---------- */
  .timeline{ margin-top:8px; }
  .tl-item{
    position:relative;
    padding-top:24px;
    padding-bottom:30px;
    text-align:center;
  }
  .tl-item:last-child{ padding-bottom:0; }
  .tl-item::before{ /* le point */
    content:"";
    position:absolute;
    left:50%; top:2px;
    width:9px; height:9px;
    border-radius:50%;
    background:var(--rose);
    transform:translateX(-50%);
    z-index:1;
  }
.tl-year{ font-family:'Fraunces'; font-style:italic; font-size:13px; color:var(--rose); margin-bottom:4px; }
.tl-title{ font-family:'Fraunces'; font-size:17px; margin-bottom:4px; }
.tl-item p{ max-width:300px; margin-left:auto; margin-right:auto; }

  /* ---------- page 7 : compte a rebours ---------- */
  #page-7{ text-align:center; }
  .cd-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:26px 0 30px; }
  .cd-box{ border:1px solid rgba(176,141,70,0.4); padding:14px 4px; border-radius:2px; }
  .cd-num{ font-family:'Fraunces'; font-size:clamp(22px,6vw,28px); color:var(--rose-light); line-height:1; }
  .cd-label{ font-size:9px; letter-spacing:0.14em; text-transform:uppercase; margin-top:6px; opacity:0.7; }
  .btn-row{ display:flex; flex-direction:column; gap:10px; }
  .btn{
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    font-family:'Jost'; font-size:12.5px; letter-spacing:0.1em; text-transform:uppercase;
    padding:14px 18px; border-radius:2px; text-decoration:none; cursor:pointer;
    border:1px solid var(--rose); background:transparent; color:inherit;
  }
  .btn-solid{ background:var(--rose); color:var(--ink-2); border-color:var(--rose); font-weight:500; }

  /* ---------- page 8 : horaire ---------- */
  #page-8{ align-items:center; text-align:center; background: radial-gradient(ellipse at center, rgba(247,241,228,0.35) 0%, rgba(32,31,27,0.12) 100%), url(/test/horaire.png) center/cover no-repeat; }

  .schedule-item{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:2px;
    padding:16px 0;
    border-bottom:1px solid rgba(42,37,30,0.1);
  }
  .schedule-item:last-child{ border-bottom:none; }

  .schedule-time{
    font-family:'Fraunces'; font-style:italic; font-size:15px; color:var(--rose);
    min-width:0;         /* la valeur min-width:56px n'a plus lieu d'être en mode colonne */
    margin-bottom:4px;
  }
    
  .schedule-title{ font-family:'Fraunces'; font-size:16.5px; margin-bottom:2px; }
  .schedule-sub{ font-size:13px; opacity:0.7; }

  /* ---------- page 9 : adresse / carte ---------- */
  .map-frame{ width:100%; height:220px; border:1px solid rgba(176,141,70,0.4); filter:grayscale(0.25) sepia(0.15); margin-bottom:18px; }
  .venue-name{ font-family:'Fraunces'; font-size:19px; margin-bottom:4px; }
  .venue-addr{ font-size:14px; opacity:0.75; margin-bottom:20px; }

  /* ---------- page 10 : dress code ---------- */
  #page-10{
    background: radial-gradient(ellipse at center, rgba(247,241,228,0.35) 0%, rgba(32,31,27,0.12) 100%), url(/test/horaire.png) center/cover no-repeat;
    align-items:center;
    text-align:center;
  }
  #page-10 p{ max-width:min(300px, 80%); margin-left:auto; margin-right:auto; font-weight: 500;}
  .palette{ display:flex; justify-content:center; gap:12px; margin-top:22px; }
  .swatch{ width:44px; height:44px; border-radius:50%; border:1px solid rgba(255,255,255,0.5); }
  
  /* ---------- page 11 : galerie ---------- */
  .gallery{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:20px; }
  .gallery img{ width:100%; aspect-ratio:1/1.15; object-fit:cover; cursor:pointer; border:1px solid rgba(176,141,70,0.3); }
  .gallery .tall{ grid-row:span 2; aspect-ratio:1/2.4; }
  #lightbox{
    position:fixed; inset:0; background:rgba(9,14,11,0.94); display:none; align-items:center; justify-content:center; z-index:100; padding:24px;
  }
  #lightbox img{ max-width:100%; max-height:90vh; border:1px solid var(--rose); }
  #lightbox.open{ display:flex; }
  #lightbox-close{ position:absolute; top:20px; right:20px; color:var(--cream); font-size:26px; background:none; border:none; cursor:pointer; }

  /* ---------- page 12 : rsvp ---------- */
  .field{ margin-bottom:16px; }
  .field label{ display:block; font-size:11px; letter-spacing:0.1em; text-transform:uppercase; color:var(--rose); margin-bottom:7px; }
  .field input, .field textarea{
    width:100%; background:transparent; border:none; border-bottom:1px solid rgba(42,37,30,0.35);
    padding:9px 2px; font-family:'Jost'; font-size:15px; color:inherit; outline:none;
  }
  .field textarea{ resize:vertical; min-height:64px; }
  .radio-row{ display:flex; gap:22px; }
  .radio-row label{ display:flex; align-items:center; gap:7px; font-size:14px; text-transform:none; letter-spacing:0; color:inherit; }
  #rsvp-thanks{ display:none; text-align:center; }

  /* ---------- page 13 : cadeau ---------- */
  .rib-box{ border:1px solid rgba(176,141,70,0.4); padding:18px; border-radius:2px; margin-top:20px; }
  .rib-row{ display:flex; justify-content:space-between; font-size:13px; padding:6px 0; }
  .rib-row span:first-child{ opacity:0.6; }
  .copy-feedback{ font-size:11px; color:var(--rose-light); margin-top:8px; height:14px; }

  /* ---------- page 14 : merci ---------- */
  #page-14{ text-align:center; align-items:center; background: radial-gradient(ellipse at center, rgba(247,241,228,0.35) 0%, rgba(32,31,27,0.12) 100%), url(/test/horaire.png) center/cover no-repeat;}
  #page-14 p {font-weight: 500;}
  .seal{ width:71px; height:71px; border:1px solid var(--rose); border-radius:50%; display:flex; align-items:center; justify-content:center; margin-bottom:24px; }
  .seal span{ font-family:'Mrs Saint Delafield'; font-size:24px; color:var(--rose); }
  .hashtag{ margin-top:22px; font-family:'Fraunces'; font-style:italic; color:var(--rose); font-size:15px; }
  .credit{ margin-top:60px; font-size:10px; letter-spacing:0.1em; opacity:0.4; }
  /* ---------- animation : apparition au scroll ---------- */
  .reveal{
    opacity:0;
    transform:translateY(22px);
    transition:opacity 0.9s cubic-bezier(0.2,0.7,0.2,1), transform 0.9s cubic-bezier(0.2,0.7,0.2,1);
    will-change:opacity, transform;
  }
  .reveal.in-view{
    opacity:1;
    transform:translateY(0);
  }

  /* ---------- animation : ornements flottants (branches) ---------- */
  .flourish{
    position:absolute;
    width:46px; height:46px;
    color:var(--rose);
    opacity:0.32;
    pointer-events:none;
    z-index:1;
  }
  .on-green .flourish{ opacity:0.4; color:var(--rose-light); }
  .flourish.tl{ top:26px; left:18px; animation:flourish-sway 8s ease-in-out infinite; }
  .flourish.br{ bottom:26px; right:18px; transform:rotate(180deg); animation:flourish-sway-br 8s ease-in-out infinite; }
  @keyframes flourish-sway{
    0%,100%{ transform:translateY(0) rotate(-2deg); }
    50%{ transform:translateY(-7px) rotate(3deg); }
  }
  @keyframes flourish-sway-br{
    0%,100%{ transform:rotate(180deg) translateY(0) rotate(-2deg); }
    50%{ transform:rotate(180deg) translateY(-7px) rotate(3deg); }
  }

  /* ---------- animation : étincelles ---------- */
  .sparkle{
    position:absolute;
    width:12px; height:12px;
    color:var(--rose-light);
    pointer-events:none;
    z-index:1;
    animation:sparkle-pulse 3.4s ease-in-out infinite;
  }
  @keyframes sparkle-pulse{
    0%,100%{ opacity:0; transform:scale(0.5); }
    50%{ opacity:0.95; transform:scale(1); }
  }

  /* ---------- bouton musique ---------- */
  #music-toggle{
    position:fixed; left:16px; bottom:16px; z-index:50;
    width:38px; height:38px; border-radius:50%;
    border:1px solid rgba(176,141,70,0.5);
    background:rgba(32,31,29,0.88);
    color:var(--rose-light);
    display:flex; align-items:center; justify-content:center;
    cursor:pointer; backdrop-filter:blur(4px);
    transition:transform 0.2s ease;
  }
  #music-toggle:hover{ transform:scale(1.06); }
  #music-toggle svg{ width:15px; height:15px; }
  #music-toggle .icon-pause{ display:none; }
  #music-toggle.playing .icon-play{ display:none; }
  #music-toggle.playing .icon-pause{ display:block; }
  #music-toggle.playing svg{ animation:note-bounce 1.6s ease-in-out infinite; }
  @keyframes note-bounce{
    0%,100%{ transform:scale(1); }
    50%{ transform:scale(1.15); }
  }

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

  /* ---------- page 0 : accueil / porte d'entrée ---------- */
.gate{
  position:relative;
  min-height:100svh;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:48px 32px;
  background: radial-gradient(ellipse at center, rgba(247,241,228,0.35) 0%, rgba(32,31,27,0.12) 100%), url(/test/background2.png) center/cover no-repeat;
  color:var(--ink);
}
.gate-inner{ max-width:340px; }
.gate-names{
  font-family:'Fraunces', serif; font-weight:500;
  font-size:clamp(32px,10vw,44px);
  line-height:1.15;
  margin:14px 0 22px;
  color:var(--ivory-2);
}
.gate-names .amp{
   color:var(--rose);
   font-weight: bold; 
}

.gate-text{
  font-size:15.5px; line-height:1.75; font-weight: 500;
  color: ivory;
  margin-bottom:34px;
}

.gate .eyebrow{
  color:ivory;
  font-weight: 500;
  justify-content:center; margin-bottom:18px;
}

/* ---------- verrouillage du scroll avant clic ---------- */
html.locked, body.locked{
  overflow:hidden;
  height:100%;
  overscroll-behavior:none;
}