/* ==========================================================================
   Mariage Faire-Part — Design system
   Palette grenat chaud sur papier clair, Fraunces (display) + Public Sans (corps)
   ========================================================================== */

:root {
    --ground: #FBF8F4;
    --ground-raised: #FFFFFF;
    --ink: #241B1D;
    --ink-soft: #6B5D5A;
    --accent: #7A2331;
    --accent-hover: #611B26;
    --accent-soft: #F0DCD9;
    --sage: #5C6B54;
    --sage-soft: #E4E9DE;
    --line: #E4DDD3;
    --dark-ground: #241B1D;
    --dark-ink: #F3ECE6;
    --error: #B3261E;
    --error-soft: #FBE7E5;
    --success: #3D6B3D;
    --success-soft: #E4EDE1;
    --shadow-sm: 0 1px 2px rgba(36, 27, 29, 0.06);
    --shadow-md: 0 1px 2px rgba(36, 27, 29, 0.06), 0 8px 24px -8px rgba(36, 27, 29, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Le site force volontairement le thème clair : un faire-part de mariage a
   une identité visuelle fixe, comme une invitation papier — elle ne doit
   pas changer selon le réglage sombre/clair du téléphone de l'invité. */

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    text-wrap: balance;
    margin: 0 0 0.4em;
    line-height: 1.15;
}

h1 { font-size: clamp(30px, 4vw, 42px); }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; font-weight: 600; }

p { margin: 0 0 1em; }

a {
    color: var(--accent);
}

.eyebrow {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

/* ---------- Layout ---------- */

.site-header {
    border-bottom: 1px solid var(--line);
}

.site-header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    font-family: "Fraunces", serif;
    font-size: 19px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
}

.logo-mark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    position: relative;
    flex-shrink: 0;
}
.logo-mark::before, .logo-mark::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    top: 2.5px;
}
.logo-mark::before { left: 1px; }
.logo-mark::after { right: 1px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-links a:not(.btn) {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
}
.nav-links a:not(.btn):hover { color: var(--ink); }

.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    flex-shrink: 0;
}
.nav-burger span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: #FBF4F1;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 8px 24px 20px;
    border-top: 1px solid var(--line);
}
.nav-mobile a {
    padding: 12px 4px;
    color: var(--ink);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid var(--line);
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a.btn { text-align: center; margin-top: 10px; border-bottom: none; }

main, .page {
    max-width: 640px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

main.wide, .page.wide {
    max-width: 1080px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 32px;
}
.blog-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    text-decoration: none;
    color: inherit;
}
.blog-card-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: var(--accent-soft);
}
.blog-card-body { padding: 20px; }
.article-cover {
    height: 280px;
    border-radius: var(--radius-lg);
    background-size: cover;
    background-position: center;
    background-color: var(--accent-soft);
    margin-bottom: 24px;
}
@media (max-width: 720px) {
    .blog-grid { grid-template-columns: 1fr; }
}

main.editor-main {
    max-width: none;
    margin: 0;
    padding: 0;
}

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 40px;
}

.site-footer-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13.5px;
    color: var(--ink-soft);
}
.site-footer-inner a { color: var(--ink-soft); text-decoration: none; }
.site-footer-inner a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */

.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    line-height: 1.2;
}
.btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary, button:not(.btn-ghost):not(.btn-text):not(.danger-small) {
    background: var(--accent);
    color: #FBF4F1;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover, button:not(.btn-ghost):not(.btn-text):not(.danger-small):hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink-soft); background: var(--accent-soft); }

.btn-text {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-weight: 600;
    box-shadow: none;
}
.btn-text:hover { text-decoration: underline; transform: none; }

.btn-block { width: 100%; }

button.danger, .danger, .btn-danger {
    background: var(--error);
    color: #FCEEED;
}
button.danger:hover, .danger:hover, .btn-danger:hover { background: #952019; }

button.danger-small {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--line);
    padding: 6px 12px;
    font-size: 13px;
    box-shadow: none;
}
button.danger-small:hover { border-color: var(--error); background: var(--error-soft); transform: none; }

/* ---------- Forms ---------- */

form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

label {
    font-weight: 600;
    font-size: 14px;
    margin-top: 14px;
    margin-bottom: 6px;
}

label:has(input[type="checkbox"]), label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

input, select, textarea {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    width: 100%;
    background: var(--ground-raised);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 0.7; }
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"], input[type="radio"] {
    width: auto;
    accent-color: var(--accent);
}
input[type="color"] {
    padding: 4px;
    height: 44px;
    width: 64px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 18px 0;
}
fieldset legend {
    font-family: "Fraunces", serif;
    font-weight: 600;
    font-size: 15px;
    padding: 0 8px;
    color: var(--accent);
}

.field-hint {
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: -2px;
    margin-bottom: 4px;
}

/* ---------- Alerts ---------- */

.error, .success {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 500;
    margin-bottom: 12px;
}
.error { background: var(--error-soft); color: var(--error); }
.success { background: var(--success-soft); color: var(--success); }

/* ---------- Cards ---------- */

.card {
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.wedding-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wedding-card {
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.wedding-card h2 {
    font-size: 19px;
    margin-bottom: 4px;
}

.wedding-card .meta {
    font-size: 13.5px;
    color: var(--ink-soft);
}

.rsvp-notice {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sage);
}
.rsvp-notice .pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sage);
    box-shadow: 0 0 0 4px var(--sage-soft);
    flex-shrink: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}
.status-pill.published { background: var(--sage-soft); color: var(--sage); }
.status-pill.draft { background: var(--line); color: var(--ink-soft); }
.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.card-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 600;
}
.card-links a { text-decoration: none; }
.card-links a:hover { text-decoration: underline; }

.empty-state {
    text-align: center;
    padding: 56px 24px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    color: var(--ink-soft);
}

/* ---------- Stats ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin: 0 0 28px;
}

.stat {
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.stat .num {
    font-family: "Fraunces", serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    display: block;
}
.stat .lbl {
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 500;
}

/* fallback for old <p><strong> stat markup */
.stats p {
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin: 0;
    font-size: 14px;
    color: var(--ink-soft);
}
.stats p strong {
    display: block;
    font-family: "Fraunces", serif;
    font-size: 24px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* ---------- Tables ---------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--ground-raised);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    background: var(--ground);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--accent-soft); }

/* ---------- Landing page ---------- */

.hero {
    max-width: 1080px;
    margin: 0 auto;
    padding: 56px 24px 60px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 56px;
    align-items: center;
}

.hero h1 { font-size: clamp(34px, 4.6vw, 52px); letter-spacing: -0.01em; }
.hero h1 em { font-style: italic; color: var(--accent); }

.hero-sub {
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink-soft);
    max-width: 46ch;
    margin: 18px 0 30px;
}

.hero-cta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-cta .secondary {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}

.trust-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 34px;
    font-size: 13.5px;
    color: var(--ink-soft);
    flex-wrap: wrap;
}
.trust-row .dot { color: var(--line); }

.hero-visual {
    position: relative;
    height: 400px;
}

.card-invite {
    position: absolute;
    width: 260px;
    background: var(--ground-raised);
    border-radius: 4px;
    box-shadow: 0 24px 60px -20px rgba(36, 27, 29, 0.35), 0 2px 8px rgba(36, 27, 29, 0.08);
    padding: 34px 26px;
    text-align: center;
    left: 50%;
}
.card-invite.back { top: 30px; transform: translateX(-50%) rotate(-7deg); opacity: 0.55; z-index: 1; }
.card-invite.front { top: 0; transform: translateX(-50%) rotate(3deg); z-index: 2; }
.card-invite .initials { font-family: "Fraunces", serif; font-style: italic; font-size: 14px; color: var(--accent); }
.card-invite .names { font-family: "Fraunces", serif; font-size: 26px; margin: 12px 0 8px; line-height: 1.15; }
.card-invite .rule { width: 28px; height: 1px; background: var(--accent); margin: 12px auto; }
.card-invite .date-line { font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); }

.badge-float {
    position: absolute;
    z-index: 3;
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 13px;
    box-shadow: var(--shadow-md);
    font-size: 12.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
}
.badge-float.rsvp { bottom: 30px; right: -6px; }
.badge-float.rsvp .pulse {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft);
}
.badge-float.count { bottom: 110px; left: -14px; flex-direction: column; align-items: flex-start; gap: 1px; }
.badge-float.count .num { font-family: "Fraunces", serif; font-size: 19px; font-weight: 600; color: var(--accent); }
.badge-float.count .lbl { font-size: 10.5px; font-weight: 500; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }

@media (prefers-reduced-motion: no-preference) {
    .card-invite.front { animation: float-front 7s ease-in-out infinite; }
    .card-invite.back { animation: float-back 7s ease-in-out infinite; }
    .badge-float.rsvp { animation: float-badge 5s ease-in-out infinite; }
    .badge-float.count { animation: float-badge 6s ease-in-out infinite 0.5s; }
}
@keyframes float-front { 0%, 100% { transform: translateX(-50%) rotate(3deg) translateY(0); } 50% { transform: translateX(-50%) rotate(2deg) translateY(-8px); } }
@keyframes float-back { 0%, 100% { transform: translateX(-50%) rotate(-7deg) translateY(0); } 50% { transform: translateX(-50%) rotate(-8deg) translateY(-5px); } }
@keyframes float-badge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.section {
    max-width: 1080px;
    margin: 0 auto;
    padding: 56px 24px;
}
.section-head {
    max-width: 540px;
    margin: 0 auto 52px;
    text-align: center;
}
.section-head .eyebrow { display: block; }
.section-head p { color: var(--ink-soft); font-size: 16px; margin-top: 10px; }

.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.step { background: var(--ground-raised); padding: 30px 24px; }
.step .n { font-family: "Fraunces", serif; font-style: italic; font-size: 14px; color: var(--accent); }
.step h3 { margin-top: 14px; }
.step p { font-size: 14px; color: var(--ink-soft); margin-top: 8px; margin-bottom: 0; }


.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.feature {
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--ground-raised);
}
.feature .icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    margin-bottom: 16px;
}
.feature h3 { color: var(--ink); font-size: 16px; }
.feature p { font-size: 14px; color: var(--ink-soft); margin-top: 8px; margin-bottom: 0; }

.final-cta { text-align: center; }
.final-cta .btn-primary { padding: 15px 30px; font-size: 15.5px; }
.gratuit-note { margin-top: 16px; font-size: 13px; color: var(--ink-soft); }

@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; padding-top: 20px; gap: 40px; }
    .hero-visual { height: 320px; order: -1; }
    .card-invite { width: 220px; padding: 26px 20px; }
    .card-invite .names { font-size: 22px; }
    .steps { grid-template-columns: 1fr; }
    .step { border-bottom: 1px solid var(--line); }
    .feature-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .nav-burger { display: flex; }
    .nav-mobile:not([hidden]) { display: flex; }
    .site-footer-inner { flex-direction: column; text-align: center; }
}

/* ---------- Auth pages ---------- */

.auth-page {
    max-width: 400px;
}
.auth-page .card { margin-top: 8px; }
.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14.5px;
    color: var(--ink-soft);
}

/* ---------- Public invitation page ---------- */

.invitation-page {
    text-align: center;
    max-width: 560px;
}
.invitation-page .names-display {
    font-size: clamp(32px, 6vw, 48px);
    margin-bottom: 6px;
}
.invitation-page .wedding-date {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
}
.invitation-page .wedding-venue {
    color: var(--ink-soft);
    margin-top: 8px;
}
.invitation-page .wedding-message {
    margin: 28px auto;
    max-width: 46ch;
    font-size: 16px;
    line-height: 1.7;
}
.invitation-page .rule {
    width: 40px;
    height: 1px;
    background: var(--accent);
    margin: 24px auto;
}
.rsvp-form {
    text-align: left;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--line);
}
.rsvp-form h2 { text-align: center; }
.rsvp-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 8px 0 4px;
}
.rsvp-choice label {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.rsvp-choice label:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}
.rsvp-choice input { width: auto; }

.demo-banner {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 28px;
}

.confirmation-page {
    text-align: center;
    padding-top: 80px;
}

.static-page {
    text-align: center;
}

.donation-prompt {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
    color: var(--ink-soft);
    text-align: center;
}

/* ---------- Template picker (éditeur) ---------- */

.template-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 8px 0 4px;
}
.template-option {
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.template-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}
.template-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.template-swatch {
    width: 100%;
    height: 36px;
    border-radius: 6px;
}
.template-preview-classique .template-swatch { background: linear-gradient(135deg, #7A2331, #F0DCD9); }
.template-preview-moderne .template-swatch { background: linear-gradient(135deg, #1A1A1A, #E8E8E8); }
.template-preview-champetre .template-swatch { background: linear-gradient(135deg, #6B7C4F, #EFE8D8); }

/* ---------- Portrait, carrousel, programme (page publique) ---------- */

.wedding-portrait {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
    box-shadow: var(--shadow-md);
    border: 3px solid var(--ground-raised);
}

.wedding-intro {
    max-width: 50ch;
    margin: 0 auto 8px;
    color: var(--ink-soft);
    font-size: 15.5px;
    line-height: 1.7;
}

.carousel {
    position: relative;
    margin: 32px auto;
    max-width: 480px;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--line);
}
.carousel-fade {
    position: relative;
    height: 100%;
}
.carousel-fade img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.1s ease;
}
.carousel-fade img.active {
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .carousel-fade img { transition: none; }
}
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}
.carousel-dots button {
    width: 7px;
    height: 7px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    box-shadow: none;
    cursor: pointer;
}
.carousel-dots button.active { background: #fff; }
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.85);
    color: var(--ink);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    box-shadow: var(--shadow-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

.program-title {
    text-align: center;
    font-size: 20px;
    margin: 40px auto 0;
}
.program-list {
    text-align: left;
    max-width: 440px;
    margin: 20px auto 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.program-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 16px;
    padding: 14px 0;
    border-left: 2px solid var(--line);
    padding-left: 20px;
    margin-left: 8px;
    position: relative;
}
.program-item::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}
.program-item .time {
    font-family: "Fraunces", serif;
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
    grid-column: 1 / -1;
}
.program-item .details h3 { font-size: 16px; margin-bottom: 2px; }
.program-item .details p { font-size: 13.5px; color: var(--ink-soft); margin: 0; }
.program-item .time + .details { grid-column: 1 / -1; }

/* ---------- Template themes (page publique) ---------- */

body.template-moderne {
    --accent: #1A1A1A;
    --accent-soft: #ECECEC;
    --sage: #4A4A4A;
}
body.template-moderne h1, body.template-moderne h2, body.template-moderne h3 {
    font-family: "Public Sans", sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}
body.template-moderne .eyebrow { letter-spacing: 0.14em; }
body.template-moderne .card-invite .names,
body.template-moderne .names-display { font-family: "Public Sans", sans-serif; font-weight: 700; }
body.template-moderne .rule { background: var(--ink); }

body.template-champetre {
    --accent: #6B7C4F;
    --accent-soft: #EFE8D8;
    --ground: #FBF7EE;
    --sage: #A6763F;
}
body.template-champetre .names-display,
body.template-champetre h1, body.template-champetre h2 { font-style: italic; }
body.template-champetre .rule { width: 60px; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 10px); }

@media (max-width: 480px) {
    main, .page { padding: 28px 18px 60px; }
    .rsvp-choice { grid-template-columns: 1fr; }
    .template-picker { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
}

/* ---------- Animation d'ouverture d'enveloppe ---------- */

#invitation-content {
    opacity: 0;
    transform: translateY(16px);
}
#invitation-content.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s ease 0.15s, transform 0.7s ease 0.15s;
}

.envelope-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    background: var(--ground);
    cursor: pointer;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}
.envelope-overlay.overlay-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.envelope-overlay:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -4px;
}

.envelope {
    position: relative;
    width: 260px;
    height: 172px;
    perspective: 900px;
}

.envelope-back {
    position: absolute;
    inset: 0;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
}

.envelope-card {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 10px;
    bottom: 10px;
    background: var(--ground-raised);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(36, 27, 29, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 16px 22px;
    text-align: center;
    z-index: 1;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.5s;
}
.envelope-card-initials {
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}
.envelope-card-names {
    font-family: "Fraunces", serif;
    font-size: 17px;
    color: var(--ink);
    line-height: 1.2;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 90px;
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    z-index: 2;
    transition: transform 0.6s cubic-bezier(0.5, 0, 0.5, 1);
    box-shadow: 0 1px 3px rgba(36, 27, 29, 0.15);
}

.envelope-seal {
    position: absolute;
    top: 68px;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ground-raised);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    z-index: 3;
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.envelope-hint {
    font-size: 13.5px;
    color: var(--ink-soft);
    margin: 0;
    animation: hint-pulse 2.2s ease-in-out infinite;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.envelope.opening .envelope-seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
}
.envelope.opening .envelope-flap {
    transform: rotateX(180deg);
}
.envelope.opening .envelope-card {
    transform: translateY(-96px) scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
    #invitation-content { opacity: 1; transform: none; }
    .envelope-overlay { display: none; }
}

@media (max-width: 480px) {
    .envelope { width: 220px; height: 148px; }
    .envelope-flap { height: 78px; }
    .envelope-seal { top: 58px; }
}

/* ---------- Installation écran d'accueil ---------- */

.install-help {
    margin-top: 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    background: var(--ground-raised);
}
.install-help summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14.5px;
}
.install-help-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}
.install-help-content h4 {
    font-size: 14px;
    margin-bottom: 8px;
}
.install-help-content ol {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 13.5px;
}
@media (max-width: 480px) {
    .install-help-content { grid-template-columns: 1fr; }
}

/* ---------- Éditeur visuel ---------- */

.editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--ground-raised);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.editor-toolbar-status {
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.editor-toolbar-status.is-visible {
    opacity: 1;
}
.editor-toolbar-status.is-error {
    color: var(--error);
    font-weight: 600;
}
.editor-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.editor-publish-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}
.editor-publish-toggle input {
    width: auto;
}

.editor-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    align-items: start;
}

.editor-panel {
    position: sticky;
    top: 65px;
    padding: 28px 32px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-height: calc(100vh - 65px);
    overflow-y: auto;
}
.editor-panel-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    margin-bottom: 10px;
}
.editor-panel-section .template-picker {
    grid-template-columns: 1fr 1fr;
}
.editor-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 8px;
}
.editor-toggle-row input {
    width: auto;
}
.editor-panel-hint {
    font-size: 12.5px;
    color: var(--ink-soft);
    line-height: 1.5;
}
#color-picker {
    width: 100%;
    height: 40px;
}

.editor-preview {
    padding: 48px 32px 80px;
    background: var(--ground);
    min-height: calc(100vh - 65px);
    display: flex;
    justify-content: center;
}
.editor-preview .invitation-page {
    max-width: 760px;
    width: 100%;
    background: var(--ground-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 48px 40px;
    height: fit-content;
}

.editable {
    display: inline-block;
    min-width: 20px;
    outline: none;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}
.editable:hover {
    background: var(--accent-soft);
}
.editable:focus {
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent);
}
.editable:empty::before {
    content: attr(data-placeholder);
    color: var(--ink-soft);
    font-style: italic;
}

.editor-photo-zone {
    position: relative;
    display: block;
    width: fit-content;
    margin: 0 auto 20px;
    cursor: pointer;
}
.editor-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
}
.editor-photo-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(36, 27, 29, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.editor-photo-zone:hover .editor-photo-hint {
    opacity: 1;
}

.editor-section {
    position: relative;
}

.editor-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin: 24px 0;
}
.editor-gallery-item {
    position: relative;
    aspect-ratio: 1;
}
.editor-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.editor-gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--error);
    font-size: 12px;
    box-shadow: var(--shadow-sm);
}
.editor-gallery-add {
    aspect-ratio: 1;
    background: var(--ground);
    border: 1.5px dashed var(--line);
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
}
.editor-gallery-add:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: none;
}

.editor-empty-hint {
    font-size: 13.5px;
    color: var(--ink-soft);
    text-align: center;
    padding: 16px;
}

.editor-program-item {
    position: relative;
    padding-right: 32px;
}
.editor-program-time {
    min-width: 50px;
}
.editor-program-remove {
    position: absolute;
    top: 10px;
    right: -4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    background: var(--ground);
    border: 1px solid var(--line);
    color: var(--error);
    font-size: 11px;
    box-shadow: none;
}
.editor-program-remove:hover {
    border-color: var(--error);
    background: var(--error-soft);
    transform: none;
}

.editor-rsvp-question {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
}
.editor-rsvp-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.editor-rsvp-question-remove {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--error);
    font-size: 10px;
    box-shadow: none;
}
.editor-rsvp-question-remove:hover {
    border-color: var(--error);
    background: var(--error-soft);
    transform: none;
}
.editor-rsvp-question .editable {
    display: block;
    font-weight: 600;
    font-size: 14px;
    padding: 4px 6px;
}
.editor-rsvp-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.editor-rsvp-option-input {
    font-size: 13px;
    padding: 8px 10px;
}

/* ---------- Fenêtre modale générique ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(36, 27, 29, 0.5);
    padding: 16px;
}
.modal-overlay[hidden] {
    display: none;
}
.modal-card {
    background: var(--ground-raised);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.modal-card-header h3 {
    margin-bottom: 0;
}
.modal-card-header .btn-text {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

@media (max-width: 860px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-panel {
        position: static;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    .editor-preview { padding: 32px 18px 60px; }
}
