/* Identité visuelle : ivoire, encre chaude, accent or patiné. Mobile d'abord. */

@font-face { font-family: 'Cormorant'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-weight: 500; font-style: italic; font-display: swap; src: url('../fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-weight: 600; font-style: italic; font-display: swap; src: url('../fonts/cormorant-garamond-latin-600-italic.woff2') format('woff2'); }

:root {
  --bg: #faf6ef;
  --surface: #fffdf9;
  --ink: #2f2a24;
  --muted: #7d7366;
  --line: #e6dccb;
  --accent: #9a7b4f;
  --accent-dark: #7a5c2e;
  --sage: #6f7d62;
  --danger: #a4433a;
  --success: #4f6b45;
  --radius: 10px;
  --serif: 'Cormorant', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; }
a { color: var(--accent-dark); }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.container.wide { max-width: 1280px; padding-top: 24px; padding-bottom: 48px; }
.narrow { max-width: 560px; }
.center { text-align: center; padding-top: 18vh; }
.muted { color: var(--muted); }
.ornament { color: var(--accent); font-size: 1.6rem; margin: 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 44px; padding: .6em 1.3em; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent-dark); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .15s, color .15s; }
.btn:hover { background: var(--accent); color: #fff; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-small { min-height: 32px; padding: .25em .8em; font-size: .875rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.light { border-color: rgba(255,255,255,.7); color: #fff; }
.btn.light:hover { background: #fff; color: var(--accent-dark); }
button.link { background: none; border: 0; padding: 0; color: var(--accent-dark); font: inherit; text-decoration: underline; cursor: pointer; }

.flash { padding: .75em 1em; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.flash.success { border-color: #c5d3bd; background: #f1f6ee; color: var(--success); }
.flash.error { border-color: #e4c0bb; background: #fbf0ee; color: var(--danger); }
.flash.info { border-color: #e2d3b5; background: #fbf6ea; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; margin: 24px 0; box-shadow: 0 1px 2px rgba(47,42,36,.04); }

/* ---- Page invité ---- */
.hero { text-align: center; color: #fff; padding: 56px 16px 48px; background: radial-gradient(ellipse at top, #b39469 0%, #8a6d45 55%, #6b5434 100%); }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .8rem; margin: 0 0 12px; opacity: .9; }
.script { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(2.4rem, 11vw, 4.2rem); margin: 0 0 8px; }
.hero .welcome { font-family: var(--serif); font-size: 1.6rem; margin: 0 0 16px; }
.hero .greeting { max-width: 34em; margin: 0 auto 24px; opacity: .92; }
.countdown { display: flex; justify-content: center; gap: 10px; margin: 0 auto 28px; font-family: var(--serif); }
.countdown-fallback { font-size: 2rem; }
.countdown-unit { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 8px 6px; border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius); background: rgba(255,255,255,.08); }
.countdown-value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown-label { font-family: var(--sans); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; opacity: .85; }

.section-title { text-align: center; margin-top: 40px; }
.section-title::after { content: '✦'; display: block; color: var(--accent); font-size: 1rem; margin-top: 4px; }
.events { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 16px; }
.event-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.event-card h3 { font-size: 1.5rem; margin-bottom: 4px; }
.event-card .when { margin: 0; font-weight: 500; }
.event-card .where { margin: 0 0 14px; color: var(--muted); }

.rsvp-form { display: grid; gap: 16px; }
.choice { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 14px; margin: 0; }
.choice legend { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; padding: 0 6px; }
.choice label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.choice input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); }

.recap-list { margin: 0 0 16px; }
.recap-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recap-list dt { font-family: var(--serif); font-size: 1.2rem; }
.recap-list dd { margin: 0; font-weight: 600; }
.yes { color: var(--success); }
.no { color: var(--danger); }
.na { color: var(--muted); }

.privacy { font-size: .85rem; color: var(--muted); margin: 32px 0; }
.privacy h2 { font-size: 1.1rem; color: var(--ink); }
.footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 24px 16px 40px; border-top: 1px solid var(--line); }

@media (min-width: 640px) {
  .events { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 32px; }
  .countdown-unit { min-width: 84px; }
  .countdown-value { font-size: 2.4rem; }
}

/* ---- Admin ---- */
.admin-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; text-decoration: none; color: var(--ink); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.admin-nav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.admin-nav a[aria-current=page] { border-color: var(--accent); color: var(--ink); }
.logout { margin-left: auto; font-size: .9rem; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.page-head small { font-size: 1rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin: 0; border-top: 1px solid var(--line); }
.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 16px 0; }
.filters label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 4px; font-weight: 500; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 40px; padding: .5em .7em; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 200px; resize: vertical; }
.filters select { width: auto; }
input.mono { width: 100%; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
table.data th { background: #f4eee3; font-weight: 600; position: sticky; top: 0; }
table.data tbody tr:hover { background: #fbf8f2; }
.row-warn { background: #fbf0ee; }
.row-actions { display: flex; gap: 12px; }
code.json { white-space: pre-wrap; word-break: break-all; display: block; max-width: 360px; font-size: .78rem; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; border: 1px solid var(--line); background: #fff; }
.badge.full { border-color: #d9c6a3; background: #f8f0e0; }
.badge.ceremonie_cocktail { border-color: #c9d2bf; background: #eef3ea; }
.badge.queued { background: #fbf6ea; }
.badge.sent { border-color: #c5d3bd; color: var(--success); }
.badge.error { border-color: #e4c0bb; color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; }
.stat-value { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--muted); }

.split { display: grid; gap: 24px; }
@media (min-width: 960px) { .split { grid-template-columns: 1fr 1fr; } }
.mail-preview iframe { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: var(--radius); background: #f7f3ec; }
.history { padding-left: 1.2em; }
.history li { margin-bottom: 10px; }
.danger-zone { border-color: #e4c0bb; }
details { margin: 12px 0; }

/* ---- Page d'accueil publique ---- */
.home { position: relative; min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column;
  background:
    radial-gradient(60vmax 60vmax at 15% 10%, rgba(214, 182, 140, .35), transparent 60%),
    radial-gradient(50vmax 50vmax at 90% 30%, rgba(232, 196, 190, .35), transparent 60%),
    radial-gradient(60vmax 60vmax at 50% 110%, rgba(170, 186, 152, .30), transparent 60%),
    var(--bg);
  background-size: 140% 140%; animation: home-glow 18s ease-in-out infinite alternate; }
@keyframes home-glow { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }

.home-main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 680px; margin: 0 auto;
  padding: 56px 16px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.home .eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .78rem; color: var(--accent-dark); margin: 0 0 14px; }
.ornament-line { width: min(240px, 70vw); height: 24px; color: var(--accent); margin-bottom: 8px; }
.home-names { font-family: var(--serif); font-style: italic; font-weight: 500; line-height: 1.02; margin: 8px 0 12px;
  font-size: clamp(2.8rem, 13vw, 5.4rem); color: var(--ink); display: flex; flex-direction: column; align-items: center; }
.home-names .amp { font-size: .55em; color: var(--accent); margin: .05em 0; }
.home-welcome { font-family: var(--serif); font-size: clamp(1.5rem, 6vw, 2.1rem); margin: 0; color: var(--accent-dark); }
.home-place { margin: 4px 0 28px; color: var(--muted); letter-spacing: .04em; }

.home .countdown { margin-bottom: 32px; }
.home .countdown-unit { border-color: var(--line); background: rgba(255, 253, 249, .75); box-shadow: 0 6px 18px rgba(122, 92, 46, .08); color: var(--ink); }
.home .countdown-label { color: var(--muted); }
.home .countdown-fallback { color: var(--accent-dark); }

.home-card { width: 100%; background: rgba(255, 253, 249, .85); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px 20px; box-shadow: 0 10px 30px rgba(122, 92, 46, .10); backdrop-filter: blur(4px); }
.home-card p { margin: 0 0 10px; }
.home-card p:last-child { margin-bottom: 0; }
.home-lead { font-family: var(--serif); font-size: 1.4rem; color: var(--accent-dark); }
.home-footer { position: relative; z-index: 1; border-top: 0; }

/* Apparition en cascade */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.r1 { animation-delay: .1s; } .r2 { animation-delay: .35s; } .r3 { animation-delay: .6s; } .r4 { animation-delay: .85s; }
.r5 { animation-delay: 1.15s; } .r6 { animation-delay: 1.45s; } .r7 { animation-delay: 1.75s; }
@keyframes reveal { to { opacity: 1; transform: none; } }
.home-names .amp.reveal { animation-name: reveal, amp-pulse; animation-duration: .9s, 4s; animation-delay: .6s, 2s;
  animation-iteration-count: 1, infinite; animation-fill-mode: forwards, none; }
@keyframes amp-pulse { 0%, 100% { transform: none; } 50% { transform: scale(1.08); } }

/* Pétales qui tombent doucement */
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petals span { position: absolute; top: -40px; width: 12px; height: 16px; border-radius: 80% 0 80% 0; opacity: .7;
  background: linear-gradient(135deg, #f1d3cc, #d9a99e); animation: fall 16s linear infinite, sway 4s ease-in-out infinite alternate; }
.petals span:nth-child(3n) { background: linear-gradient(135deg, #f3e3c3, #cfae78); width: 9px; height: 12px; }
.petals span:nth-child(4n) { background: linear-gradient(135deg, #e3ead9, #a9b996); }
.petals span:nth-child(1)  { left: 4%;  animation-duration: 15s, 4s;   animation-delay: -2s, 0s; }
.petals span:nth-child(2)  { left: 12%; animation-duration: 19s, 5s;   animation-delay: -9s, -1s; }
.petals span:nth-child(3)  { left: 20%; animation-duration: 14s, 3.5s; animation-delay: -5s, -2s; }
.petals span:nth-child(4)  { left: 28%; animation-duration: 21s, 4.5s; animation-delay: -14s, 0s; }
.petals span:nth-child(5)  { left: 36%; animation-duration: 17s, 5.5s; animation-delay: -1s, -3s; }
.petals span:nth-child(6)  { left: 44%; animation-duration: 23s, 4s;   animation-delay: -11s, -1s; }
.petals span:nth-child(7)  { left: 52%; animation-duration: 16s, 3.8s; animation-delay: -7s, -2s; }
.petals span:nth-child(8)  { left: 60%; animation-duration: 20s, 5s;   animation-delay: -3s, 0s; }
.petals span:nth-child(9)  { left: 68%; animation-duration: 18s, 4.2s; animation-delay: -12s, -1s; }
.petals span:nth-child(10) { left: 76%; animation-duration: 22s, 4.8s; animation-delay: -6s, -2s; }
.petals span:nth-child(11) { left: 84%; animation-duration: 15s, 3.6s; animation-delay: -10s, 0s; }
.petals span:nth-child(12) { left: 92%; animation-duration: 19s, 5.2s; animation-delay: -4s, -3s; }
.petals span:nth-child(13) { left: 8%;  animation-duration: 25s, 4.4s; animation-delay: -17s, -1s; }
.petals span:nth-child(14) { left: 72%; animation-duration: 24s, 4.6s; animation-delay: -20s, -2s; }
@keyframes fall { to { top: 105vh; transform: rotate(540deg); } }
@keyframes sway { from { margin-left: -18px; } to { margin-left: 18px; } }

@media (min-width: 640px) {
  .home-main { padding-top: 12vh; }
  .home-card { padding: 28px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .home { animation: none; }
  .petals { display: none; }
  .reveal, .home-names .amp.reveal { opacity: 1; transform: none; animation: none; }
}

/* ---- Photo du couple dans une arche (portail d'église) ---- */
.arch { position: relative; width: min(64vw, 280px); margin: 18px auto 22px; padding: 10px; }
/* Cadre extérieur : double filet doré en arche */
.arch::before { content: ''; position: absolute; inset: 0; border: 1px solid var(--accent); border-radius: 999px 999px 6px 6px; }
.arch::after { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(154, 123, 79, .45); border-radius: 999px 999px 4px 4px; }
.arch picture, .arch img { display: block; width: 100%; }
.arch img { aspect-ratio: 3 / 4; height: auto; object-fit: cover; object-position: 50% 20%;
  border-radius: 999px 999px 2px 2px; box-shadow: 0 14px 34px rgba(80, 58, 28, .22); }
.arch-keystone { position: absolute; z-index: 1; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 0 8px; background: var(--bg); color: var(--accent); font-size: 1rem; line-height: 22px; }
.arch picture { position: relative; z-index: 1; }
.home .arch-keystone { background: transparent; text-shadow: 0 0 6px var(--bg), 0 0 10px var(--bg); }

/* Variante sur le bandeau doré des pages invité */
.arch-light { width: min(54vw, 220px); margin-top: 6px; }
.arch-light::before { border-color: rgba(255, 255, 255, .75); }
.arch-light::after { border-color: rgba(255, 255, 255, .35); }
.arch-light img { box-shadow: 0 14px 34px rgba(0, 0, 0, .28); }
.arch-light .arch-keystone { background: transparent; color: #fff; text-shadow: 0 0 8px rgba(107, 84, 52, .9); }

@media (min-width: 640px) {
  .arch { width: 280px; }
  .arch-light { width: 240px; }
}

/* ---- Bannières illustrées des encadrés d'événement ---- */
.event-card { overflow: hidden; padding-top: 0; }
.event-banner { margin: 0 -20px 14px; border-bottom: 1px solid var(--line); background: #fbf6ee; }
.event-banner img { display: block; width: 100%; height: auto; aspect-ratio: 320 / 140; }
.event-card:hover .event-banner img { transform: scale(1.03); }
.event-banner img { transition: transform .6s ease; }

/* ---- Pétales sur la page invité : au premier plan, sans gêner les clics ---- */
.guest .petals { z-index: 5; }
.guest .petals span { opacity: .55; }
@media (min-width: 640px) {
  .events > li:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 8px); }
}

/* ---- Message de remerciement après réponse ---- */
.thanks-toast { position: fixed; z-index: 20; left: 50%; top: 16px; width: min(420px, calc(100% - 32px));
  transform: translateX(-50%); text-align: center; padding: 22px 20px 18px; border-radius: 18px;
  background: var(--surface); border: 1px solid #e2d3b5; box-shadow: 0 18px 50px rgba(80, 58, 28, .25);
  animation: thanks-in .6s cubic-bezier(.2, .9, .3, 1.2) both; overflow: hidden; }
.thanks-toast.is-leaving { animation: thanks-out .5s ease forwards; }
.thanks-toast p { margin: 0 0 4px; }
.thanks-icon { font-size: 2rem; color: #c97f74; line-height: 1; animation: thanks-beat 1.2s ease-in-out .6s 3; }
.thanks-title { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--accent-dark); }
.thanks-sub { font-size: .92rem; }
.thanks-close { margin-top: 10px; }
.thanks-toast:focus { outline: none; }
@keyframes thanks-in { from { opacity: 0; transform: translate(-50%, -24px) scale(.94); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes thanks-out { to { opacity: 0; transform: translate(-50%, -20px) scale(.96); } }
@keyframes thanks-beat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.25); } 60% { transform: scale(.95); } }

/* Confettis qui jaillissent du cœur */
.thanks-confetti { position: absolute; left: 50%; top: 38px; width: 0; height: 0; pointer-events: none; }
.thanks-confetti span { position: absolute; width: 7px; height: 10px; border-radius: 2px; opacity: 0;
  background: #c9a46a; animation: confetti 1.4s ease-out .35s forwards; }
.thanks-confetti span:nth-child(3n) { background: #d9a99e; border-radius: 50%; width: 7px; height: 7px; }
.thanks-confetti span:nth-child(3n+1) { background: #a9b996; }
.thanks-confetti span:nth-child(1)  { --dx: -120px; --dy: -10px; }
.thanks-confetti span:nth-child(2)  { --dx: -95px;  --dy: 40px; }
.thanks-confetti span:nth-child(3)  { --dx: -70px;  --dy: -30px; }
.thanks-confetti span:nth-child(4)  { --dx: -45px;  --dy: 60px; }
.thanks-confetti span:nth-child(5)  { --dx: -20px;  --dy: -36px; }
.thanks-confetti span:nth-child(6)  { --dx: 10px;   --dy: 70px; }
.thanks-confetti span:nth-child(7)  { --dx: 25px;   --dy: -34px; }
.thanks-confetti span:nth-child(8)  { --dx: 50px;   --dy: 55px; }
.thanks-confetti span:nth-child(9)  { --dx: 75px;   --dy: -24px; }
.thanks-confetti span:nth-child(10) { --dx: 100px;  --dy: 45px; }
.thanks-confetti span:nth-child(11) { --dx: 125px;  --dy: 0px; }
.thanks-confetti span:nth-child(12) { --dx: -130px; --dy: 20px; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(260deg); }
}
/* Mise en valeur du récapitulatif */
.recap { scroll-margin-top: 24px; }

@media (prefers-reduced-motion: reduce) {
  .thanks-toast, .thanks-toast.is-leaving, .thanks-icon { animation: none; }
  .thanks-confetti { display: none; }
}
