/* Couleurs relevées sur l'invitation PDF et la photo */
:root {
    --cream: #f7e8d5;
    --cream-deep: #efdcc4;
    --paper: #fcf6ee;
    --ink: #141212;
    --text: #141212;
    --muted: #75685c;
    --line: #e2cfb6;
    --wine: #7f131f;
    --wine-dark: #5e0d17;
    --wine-soft: #f6e1dc;
    --green: #2f6b3a;
    --green-soft: #e2eedd;
    --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
    /* Neue Haas Grotesk Display Pro (Adobe Fonts), Inter en secours si le kit n'est pas configuré */
    --sans: "neue-haas-grotesk-display", "Neue Haas Grotesk Display Pro", "Inter", "Helvetica Neue", Arial, sans-serif;
    /* Graisses du projet Adobe Fonts yfs6drx : 45 Light = 400, 65 Medium = 600, 96 Black Italic = 900 */
    --w-light: 400;
    --w-medium: 600;
    --w-black: 900;
    --gutter: 20px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-weight: var(--w-light);
    font-size: 16px;
    letter-spacing: .015em; /* coupe Display : un peu d'air aux petites tailles */
    color: var(--text);
    background: var(--cream);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
code { font-size: .9em; background: rgba(0, 0, 0, .05); padding: 1px 4px; border-radius: 3px; }
.wine { color: var(--wine); }
strong, b { font-weight: var(--w-medium); }

/* Bodoni en optique « texte » : déliés plus épais, lettres et chiffres lisibles en grand */
.title, .stat-value, .panel h2, .confirm-title, .choice b, .qr-name {
    font-optical-sizing: none;
    font-variation-settings: "opsz" 11;
}

/* ---------- Décor photo ---------- */

/* Mobile : bandeau photo (verres) qui se fond dans le crème */
.scene {
    position: relative;
    height: 42vh;
    min-height: 230px;
    max-height: 420px;
    background-color: var(--cream);
    background-image: url(img/fond-mobile.jpg);
    background-image: image-set(url(img/fond-mobile.webp) type("image/webp"), url(img/fond-mobile.jpg) type("image/jpeg"));
    background-size: cover;
    background-position: 30% top;
}
.scene::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 55%;
    background: linear-gradient(to bottom, rgba(247, 232, 213, 0), var(--cream) 92%);
}

/* ---------- Page invité ---------- */

.sheet {
    position: relative;
    max-width: 560px;
    margin: -72px auto 0;
    padding: 0 var(--gutter) calc(28px + env(safe-area-inset-bottom));
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.brand img { width: 104px; }
.brand-sep { width: 1px; height: 40px; background: var(--wine); }
.brand-event {
    font-size: 10.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.35;
}

.kicker {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: var(--w-medium);
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--wine);
}

.title {
    font-family: var(--serif);
    font-weight: 800;
    font-size: clamp(34px, 10.5vw, 60px);
    line-height: .98;
    letter-spacing: -.015em;
    text-transform: uppercase;
    color: var(--ink);
    margin: 0 0 24px;
    overflow-wrap: break-word;
    hyphens: manual;
}
.title em { font-style: normal; color: var(--wine); display: block; }

.greeting { font-size: 18px; font-weight: var(--w-medium); margin: 0 0 8px; color: var(--ink); }
.intro, .lead { margin: 0 0 22px; }
.lead { color: var(--muted); }

/* Bloc date/adresse encadré de filets courts, comme sur l'invitation */
.event { position: relative; padding: 16px 0; margin: 0 0 14px; }
.event::before, .event::after {
    content: "";
    position: absolute;
    left: 0;
    width: 96px;
    height: 1px;
    background: var(--wine);
}
.event::before { top: 0; }
.event::after { bottom: 0; }
.event p { margin: 0; }
.event-date { font-weight: var(--w-medium); font-size: 17px; color: var(--ink); }

.note {
    margin: 0 0 26px;
    color: var(--wine);
    font-weight: var(--w-black);
    font-style: italic;
    font-size: 15px;
}

/* ---------- Formulaire ---------- */

.rsvp fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.rsvp legend { font-weight: var(--w-medium); color: var(--ink); margin-bottom: 10px; padding: 0; }

.choices { display: grid; gap: 10px; }
.choices-row { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

/* grid : la case s'étire à la hauteur de sa voisine (Oui / Non alignés même si un texte passe sur 2 lignes) */
.choice { position: relative; display: grid; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
    padding: 12px 14px 12px 48px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.3;
    background: rgba(255, 255, 255, .72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1.5px solid var(--line);
    border-radius: 3px;
    position: relative;
    transition: border-color .15s, background-color .15s, color .15s;
}
.choice b {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--ink);
}
.choice span::before {
    content: "";
    position: absolute;
    left: 16px; top: 50%;
    width: 20px; height: 20px;
    margin-top: -10px;
    border-radius: 50%;
    border: 1.5px solid var(--muted);
    background: #fff;
    transition: all .15s;
}
.choice:hover span { border-color: var(--wine); }
.choice input:checked + span { border-color: var(--wine); background: var(--wine-soft); color: var(--wine-dark); }
.choice input:checked + span b { color: var(--wine); }
.choice input:checked + span::before { border-color: var(--wine); background: var(--wine); box-shadow: inset 0 0 0 4px #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--wine); outline-offset: 2px; }

.btn {
    display: inline-block;
    font: inherit;
    font-weight: var(--w-medium);
    font-size: 15px;
    color: #fff;
    background: var(--wine);
    border: 1.5px solid var(--wine);
    border-radius: 3px;
    padding: 11px 18px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
    transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--wine-dark); border-color: var(--wine-dark); }
.btn-block {
    display: block;
    width: 100%;
    padding: 17px 20px;
    font-size: 15px;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.btn-ghost { background: rgba(255, 255, 255, .6); color: var(--wine); }
.btn-ghost:hover { background: var(--wine-soft); border-color: var(--wine); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-danger { background: transparent; color: #a32020; border-color: #e6c6c2; }
.btn-danger:hover { background: #fbecea; border-color: #a32020; }

.hint { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.alert { background: var(--wine-soft); color: var(--wine-dark); border-left: 3px solid var(--wine); padding: 10px 14px; margin: 0 0 16px; }
.flash { background: var(--green-soft); color: var(--green); border-left: 3px solid var(--green); padding: 10px 14px; margin: 0 0 16px; }

#reponse { scroll-margin-top: 16px; }
html { scroll-behavior: smooth; }

.confirm {
    padding: 22px 20px;
    background: rgba(255, 255, 255, .6);
    border-left: 3px solid var(--wine);
}
.confirm p { margin: 0 0 10px; }
.confirm-title { font-family: var(--serif); font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--wine); }
.link { color: var(--wine); font-weight: var(--w-medium); text-underline-offset: 3px; }

.signature { margin: 28px 0 0; color: var(--ink); }
.signature span { color: var(--wine); font-weight: var(--w-medium); }

.legal { margin-top: 32px; font-size: 11px; color: var(--muted); }

/* Desktop : photo plein écran, texte sur la partie claire à gauche */
@media (min-width: 900px) {
    .scene {
        position: fixed;
        inset: 0;
        height: auto;
        max-height: none;
        background-image: url(img/fond-large.jpg);
        background-image: image-set(url(img/fond-large.webp) type("image/webp"), url(img/fond-large.jpg) type("image/jpeg"));
        background-position: right top;
    }
    .scene::after {
        top: 0;
        height: auto;
        background: linear-gradient(90deg,
            rgba(247, 232, 213, .97) 0,
            rgba(247, 232, 213, .93) 660px,
            rgba(247, 232, 213, .5) 800px,
            rgba(247, 232, 213, 0) 980px);
    }
    .sheet {
        max-width: 540px;
        min-height: 100vh;
        margin: 0 0 0 clamp(48px, 8vw, 140px);
        padding: 56px 0 40px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .brand { margin-bottom: 40px; }
    .brand img { width: 116px; }
}

@media (max-width: 360px) {
    :root { --gutter: 16px; }
    .choice span { padding-left: 42px; }
    .choice span::before { left: 13px; }
}

/* ---------- Backoffice ---------- */

body.admin { padding: 0 0 48px; }
.login { padding-bottom: 48px; }
.login .field { margin-bottom: 16px; }
.login .btn { width: 100%; padding: 14px 18px; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: var(--w-medium); color: var(--muted); }
.field input, .field select, textarea, select, input[type="search"] {
    font: inherit;
    font-size: 16px; /* évite le zoom auto sur iOS */
    font-weight: var(--w-light);
    color: var(--ink);
    padding: 10px 12px;
    border: 1.5px solid var(--line);
    border-radius: 3px;
    background: #fff;
    width: 100%;
}
.field input:focus, select:focus, textarea:focus, input[type="search"]:focus { outline: none; border-color: var(--wine); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

.admin-hero {
    background-color: var(--cream);
    background-image:
        linear-gradient(90deg, rgba(247, 232, 213, .97) 0%, rgba(247, 232, 213, .9) 45%, rgba(247, 232, 213, .25) 75%, rgba(247, 232, 213, 0) 100%),
        url(img/fond-large.jpg);
    background-image:
        linear-gradient(90deg, rgba(247, 232, 213, .97) 0%, rgba(247, 232, 213, .9) 45%, rgba(247, 232, 213, .25) 75%, rgba(247, 232, 213, 0) 100%),
        image-set(url(img/fond-large.webp) type("image/webp"), url(img/fond-large.jpg) type("image/jpeg"));
    background-size: cover;
    background-position: right 20%;
    border-bottom: 3px solid var(--wine);
    margin-bottom: 24px;
}
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding-top: 28px; padding-bottom: 24px; }
.topbar-brand { display: flex; align-items: center; gap: 18px; }
.topbar-brand img { width: 98px; padding-right: 18px; border-right: 1px solid var(--wine); }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.topbar-actions form { margin: 0; }
.eyebrow { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--wine); font-weight: var(--w-medium); }
.title-sm { font-size: 34px; line-height: 1.05; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--paper); border-radius: 3px; padding: 16px 18px; display: flex; flex-direction: column; }
.stat-value { font-family: var(--serif); font-size: 38px; font-weight: 800; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat-main { background: var(--wine); }
.stat-main .stat-value { color: #fff; }
.stat-main .stat-label { color: rgba(255, 255, 255, .82); }

.panel { background: var(--paper); border-radius: 3px; padding: 20px; margin-bottom: 20px; }
.panel h2 { font-family: var(--serif); font-size: 24px; font-weight: 800; color: var(--ink); margin: 0 0 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.toolbar input[type="search"] { flex: 1 1 260px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; padding: 8px 13px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--text); cursor: pointer; }
.chip.is-active { background: var(--wine); color: #fff; border-color: var(--wine); }

.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1.5px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.list td { border-bottom: 1px solid var(--line); padding: 11px 10px; vertical-align: top; }
.list .who strong { color: var(--ink); }
.list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list .actions { white-space: nowrap; }
.list .actions > * { vertical-align: middle; }
.list .actions select { width: auto; padding: 5px 8px; font-size: 13px; }
form.inline { display: inline; margin: 0; }

.badge { display: inline-block; font-size: 12px; font-weight: var(--w-medium); padding: 2px 10px; border-radius: 999px; background: #efe5d8; color: var(--muted); }
.badge-oui { background: var(--green-soft); color: var(--green); }
.badge-non { background: var(--wine-soft); color: var(--wine); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; }
.grid-2 .panel { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-wide { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 12px; }
.mail-test { margin-top: 20px; }
.mail-test-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.mail-test-form .field { flex: 1 1 260px; }
textarea { font-family: ui-monospace, Consolas, monospace !important; font-size: 13px !important; resize: vertical; }

.qr-dialog { border: 0; border-top: 3px solid var(--wine); border-radius: 3px; padding: 24px; width: min(360px, calc(100vw - 32px)); text-align: center; background: var(--paper); }
.qr-dialog::backdrop { background: rgba(30, 12, 12, .55); }
.qr-name { font-family: var(--serif); font-size: 20px; font-weight: 800; margin: 0 0 12px; }
.qr-code { display: flex; justify-content: center; background: #fff; padding: 12px; }
.qr-code img, .qr-code canvas { width: 260px !important; height: auto !important; max-width: 100%; }
.qr-url { word-break: break-all; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Tablette / mobile : la liste passe en cartes */
@media (max-width: 760px) {
    .admin-hero {
        background-image:
            linear-gradient(180deg, rgba(247, 232, 213, .55) 0%, rgba(247, 232, 213, .94) 45%, var(--cream) 100%),
            url(img/fond-mobile.jpg);
        background-image:
            linear-gradient(180deg, rgba(247, 232, 213, .55) 0%, rgba(247, 232, 213, .94) 45%, var(--cream) 100%),
            image-set(url(img/fond-mobile.webp) type("image/webp"), url(img/fond-mobile.jpg) type("image/jpeg"));
        background-position: center 30%;
    }
    .topbar { padding-top: 22px; padding-bottom: 18px; }
    .topbar-brand { gap: 14px; align-items: flex-end; }
    .topbar-brand img { width: 82px; padding-right: 14px; }
    .topbar-actions { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .topbar-actions .btn { width: 100%; padding: 9px 4px; font-size: 12.5px; background: rgba(255, 255, 255, .8); }
    .title-sm { font-size: 28px; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-main { grid-column: 1 / -1; }
    .stat-value { font-size: 32px; }
    .panel { padding: 16px; }

    .list thead { display: none; }
    .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
    .list tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
    .list td { border: 0; padding: 3px 0; text-align: left; display: flex; justify-content: space-between; gap: 12px; }
    .list td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
    .list td.who { display: block; padding-bottom: 6px; font-size: 15px; }
    .list td:empty, .list td.small:empty { display: none; }
    .list .actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; white-space: normal; }
    .list .actions > * { flex: 1 1 auto; }
    .list .actions .btn { padding: 9px 10px; }
    .list .actions .set-form { order: 5; flex-basis: 100%; }
    .list .actions select { width: 100%; padding: 8px 10px; }
    .form-grid { grid-template-columns: 1fr; }
}

@media print {
    body { background: #fff; padding: 0; }
    .no-print, .scene { display: none !important; }
    .admin-hero { background: none; border-bottom: 2px solid #000; }
    .panel, .stat { background: #fff; padding: 0; }
    .stat-main { background: #fff; }
    .stat-main .stat-value, .stat-main .stat-label { color: var(--ink); }
    .list tr[hidden] { display: none; }
}
