@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:#F6F1E7;
    --ivory-2:#EFE8D8;
    --green:#1F3327;
    --green-2:#182A20;
    --gold:#B08D46;
    --gold-light:#D8C08A;
    --clay:#C1735A;
    --charcoal:#2A251E;
    --cream:#F2ECDD;
    --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:#0f1a14;
    background-image:
      radial-gradient(circle at 20% 20%, rgba(176,141,70,0.06), transparent 40%),
      radial-gradient(circle at 80% 70%, rgba(176,141,70,0.05), transparent 45%);
    color:var(--charcoal);
    -webkit-font-smoothing:antialiased;
  }

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

  @media (min-width:640px){
    body{padding:32px 16px;}
    .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: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(--green); color:var(--cream); }

  /* torn-page edge between sections */
  .edge{
    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(--green) 50%, transparent 50.5%),
      linear-gradient(-135deg, var(--green) 50%, transparent 50.5%);
  }

  .eyebrow{
    font-family:'Jost', sans-serif;
    font-size:11px;
    letter-spacing:0.32em;
    text-transform:uppercase;
    color:var(--gold);
    margin-bottom:14px;
    display:flex; align-items:center; gap:10px;
  }
  .eyebrow::before{ content:""; width:22px; height:1px; background:var(--gold); 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(--gold); 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(--gold); 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(--gold), var(--gold-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(31,51,39,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:flex-end; align-items:center; text-align:center;
    background:linear-gradient(180deg, rgba(15,23,17,0.15) 0%, rgba(12,18,14,0.55) 55%, rgba(9,14,11,0.92) 100%), url(/photos/couverture.jpg) center/cover no-repeat;
    color:var(--cream); min-height:100svh;
  }
  #page-1 .cover-inner{ padding:0 28px 70px; }
  #page-1 .eyebrow{ color:var(--gold-light); justify-content:center; margin-bottom:18px; }
  #page-1 .eyebrow::before{ display:none; }
  #page-1 .names{ font-size:clamp(46px,15vw,66px); line-height:1; margin-bottom:10px; }
  #page-1 .amp{ display:block; font-size:0.55em; margin:2px 0; color:var(--gold); }
  #page-1 .date{
    font-family:'Jost'; letter-spacing:0.35em; font-size:13px; margin-top:14px; color:rgba(242,236,221,0.85);
  }
  #page-1 .scroll-cue{
    margin-top:38px; font-size:10px; letter-spacing:0.25em; text-transform:uppercase; opacity:0.7;
    display:flex; flex-direction:column; align-items:center; gap:8px;
  }
  #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 3 : citation ---------- */
  #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; font-family:'Jost'; font-style:normal; font-size:11px; letter-spacing:0.2em; text-transform:uppercase; color:var(--gold-light); }

  /* ---------- page 4/5 : portraits ---------- */
  .portrait-photo{ width:150px; height:150px; border-radius:50%; object-fit:cover; border:1px solid var(--gold); margin-bottom:26px; }
  .portrait-name{ font-size:12px; }

  /* ---------- page 6 : histoire (timeline) ---------- */
  .timeline{ margin-top:8px; }
  .tl-item{ position:relative; padding-left:26px; padding-bottom:28px; border-left:1px solid rgba(176,141,70,0.4); }
  .tl-item:last-child{ border-color:transparent; padding-bottom:0; }
  .tl-item::before{ content:""; position:absolute; left:-4.5px; top:2px; width:9px; height:9px; border-radius:50%; background:var(--gold); }
  .tl-year{ font-family:'Fraunces'; font-style:italic; font-size:13px; color:var(--gold); margin-bottom:4px; }
  .tl-title{ font-family:'Fraunces'; font-size:17px; margin-bottom:4px; }

  /* ---------- 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(--gold-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(--gold); background:transparent; color:inherit;
  }
  .btn-solid{ background:var(--gold); color:var(--green-2); border-color:var(--gold); font-weight:500; }

  /* ---------- page 8 : horaire ---------- */
  .schedule-item{ display:flex; gap:18px; padding:14px 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(--gold); min-width:56px; }
  .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 ---------- */
  .palette{ display:flex; 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(--gold); }
  #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(--gold); 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(--gold-light); margin-top:8px; height:14px; }

  /* ---------- page 14 : merci ---------- */
  #page-14{ text-align:center; align-items:center; }
  .seal{ width:64px; height:64px; border:1px solid var(--gold); border-radius:50%; display:flex; align-items:center; justify-content:center; margin-bottom:24px; }
  .seal span{ font-family:'Mrs Saint Delafield'; font-size:26px; color:var(--gold); }
  .hashtag{ margin-top:22px; font-family:'Fraunces'; font-style:italic; color:var(--gold); 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(--gold);
    opacity:0.32;
    pointer-events:none;
    z-index:1;
  }
  .on-green .flourish{ opacity:0.4; color:var(--gold-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(--gold-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(31,51,39,0.88);
    color:var(--gold-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; }
  }