/* GénéaNoces — feuille de style principale. Sobre, moderne, sans framework. */

:root {
    --bg: #f7f5f1;
    --surface: #ffffff;
    --surface-2: #f1ede6;
    --text: #1f1c18;
    --muted: #6f675d;
    --border: #e4ded4;
    --accent: #7a4b24;
    --accent-hover: #643b19;
    --accent-soft: #f3e9df;
    --danger: #b3261e;
    --danger-soft: #fbeae9;
    --ok: #2e7d4f;
    --ok-soft: #e7f4ec;
    --warning-soft: #fdf4dc;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(31, 28, 24, .05), 0 4px 16px rgba(31, 28, 24, .05);
    --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
section { margin: 2.5rem 0; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 1.5rem; padding-bottom: 3rem; }
.narrow { max-width: 760px; margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* --- En-tête --------------------------------------------------------------------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 60px; }
.brand { font-family: var(--font-serif); font-weight: 700; font-size: 1.3rem; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.nav a, .nav .link { color: var(--text); padding: .4rem .7rem; border-radius: var(--radius-sm); font-size: .95rem; }
.nav a:hover, .nav .link:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--accent); font-weight: 600; }
.nav .btn { color: #fff; margin-left: .25rem; }
.nav .btn:hover { background: var(--accent-hover); }
.nav-spacer { flex: 1; }
.credits-pill { background: var(--accent-soft); color: var(--accent) !important; font-weight: 600; }
.nav-toggle, .nav-burger { display: none; }

/* --- Pied de page ------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: .875rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding-top: 1.2rem; padding-bottom: 1.2rem; }

/* --- Boutons ---------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    background: var(--accent); color: #fff; border: 1px solid var(--accent);
    padding: .6rem 1.1rem; border-radius: var(--radius-sm);
    font: 500 .95rem/1.2 var(--font); cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-small { padding: .4rem .75rem; font-size: .875rem; }
.btn-large { padding: .8rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #8f1e18; border-color: #8f1e18; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
button.link.danger { color: var(--danger); font-size: .875rem; }

/* --- Cartes, alertes, étiquettes --------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: #1d5535; border-color: #cfe7d8; }
.alert-error { background: var(--danger-soft); color: #7d1a15; border-color: #f2cdca; }
.alert-warning { background: var(--warning-soft); color: #6b4e00; border-color: #f3e3b3; }
.tag { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-locked { background: var(--accent-soft); color: var(--accent); }
.badge { position: absolute; top: 8px; right: 8px; font-size: .72rem; padding: .15rem .5rem; border-radius: 99px; }
.badge-dark { background: rgba(20, 18, 15, .7); color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }
.badge-left { right: auto; left: 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 600; color: var(--accent); margin-bottom: .6rem; }

/* --- Formulaires ------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > label:first-child { font-weight: 600; font-size: .9rem; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], select {
    width: 100%; font: inherit; color: inherit; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .7rem;
    transition: border-color .15s, box-shadow .15s;
    height: 2.6rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checkbox { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
.field-error { color: var(--danger); font-size: .85rem; margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.row-inputs { display: flex; gap: .4rem; }
.form-preview { max-height: 220px; width: auto; border-radius: var(--radius-sm); }
.dropzone {
    position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 180px; padding: 1rem; border: 2px dashed var(--border); border-radius: var(--radius);
    background: var(--surface-2); cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone img { max-height: 320px; width: auto; border-radius: var(--radius-sm); }
.auth { max-width: 420px; margin: 1.5rem auto; }
.auth h1 { text-align: center; }

/* --- Accueil ----------------------------------------------------------------------- */
.hero { text-align: center; padding: 3rem 0 1rem; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.lead { font-size: 1.1rem; color: var(--muted); }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin: 1.5rem 0; }
.hero-search { display: flex; gap: .5rem; max-width: 520px; margin: 0 auto; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.step p { color: var(--muted); font-size: .9rem; margin: 0; }
.step-num { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: .6rem; }

/* --- En-têtes de page -------------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin-bottom: .2rem; }
.page-head p { margin: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.breadcrumb { font-size: .875rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb span { margin: 0 .3rem; opacity: .6; }

/* --- Filtres ----------------------------------------------------------------------- */
.filters { display: grid; grid-template-columns: 1.2fr 1.2fr 1.2fr 1fr auto; gap: .9rem; align-items: end; margin-bottom: 1.5rem; }
.filters-actions { display: flex; gap: .4rem; }
.filters-hint { grid-column: 1 / -1; }
.search-inline { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; max-width: 640px; }
.search-inline .muted { white-space: nowrap; }

/* --- Grille de photos -------------------------------------------------------------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.photo-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); transition: transform .15s, box-shadow .15s; }
.photo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.photo-card-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.photo-card-img img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.08); }
.photo-card-body { padding: .7rem .85rem .85rem; display: flex; flex-direction: column; gap: .1rem; font-size: .9rem; }
.photo-card-body strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state.small { padding: 2.5rem 1rem; }

/* --- Pagination -------------------------------------------------------------------- */
.pagination { display: flex; justify-content: center; gap: .3rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 2.2rem; padding: .4rem .6rem; text-align: center; border-radius: var(--radius-sm); }
.pagination a { border: 1px solid var(--border); background: var(--surface); }
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; }
.pagination .gap { color: var(--muted); }

/* --- Détail d'une photo ------------------------------------------------------------ */
.photo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.75rem; align-items: start; }
.photo-stage { position: relative; width: 100%; background: #1d1a17; border-radius: var(--radius); overflow: hidden; user-select: none; }
.photo-stage img { width: 100%; height: 100%; object-fit: contain; }
.box { position: absolute; border: 2px solid rgba(255, 255, 255, .85); border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); transition: border-color .15s, background .15s; }
.box:hover, .box.highlight { border-color: #ffd28a; background: rgba(255, 210, 138, .15); text-decoration: none; }
.box-num { position: absolute; top: -1px; left: -1px; transform: translateY(-100%); background: rgba(20, 18, 15, .8); color: #fff; font-size: .7rem; font-weight: 600; padding: 0 .35rem; border-radius: 3px 3px 0 0; line-height: 1.4; }
.photo-stage.boxes-hidden .box { display: none; }
.toggle-boxes { display: inline-flex; gap: .4rem; align-items: center; margin-top: .6rem; font-size: .875rem; color: var(--muted); cursor: pointer; }
.photo-side { position: sticky; top: 80px; }
.photo-title { font-size: 1.5rem; }
.details { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0 0 1.25rem; font-size: .92rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.admin-box { margin-top: 1.25rem; padding: .8rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }

.unlock { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; background: var(--accent-soft); border-color: #ead9c8; box-shadow: none; flex-wrap: wrap; }
.unlock p { margin: .2rem 0 0; }
.unlock form { text-align: right; }
.unlock .hint { margin-top: .3rem; }
.people-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.people-list li { display: flex; align-items: center; gap: .7rem; padding: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color .15s; scroll-margin-top: 90px; }
.people-list li.highlight, .people-list li:target { border-color: var(--accent); }
.crop { flex: none; width: 48px; height: 48px; border-radius: 50%; background-repeat: no-repeat; background-color: var(--surface-2); }
.people-num { flex: none; font-size: .75rem; font-weight: 700; color: var(--muted); min-width: 1.4rem; }
.people-name { font-weight: 500; }
.name-hidden { display: inline-block; height: .9em; border-radius: 4px; background: linear-gradient(90deg, #d9d3c9, #e7e2d9); max-width: 70%; }

/* --- Éditeur de personnes ---------------------------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.editor-toolbar { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; flex-wrap: wrap; }
.editor-stage { cursor: crosshair; touch-action: none; }
.editor-stage .box { cursor: move; background: rgba(255, 255, 255, .06); }
.editor-stage .box.selected { border-color: #ffd28a; background: rgba(255, 210, 138, .18); }
.editor-stage .box.unnamed { border-style: dashed; }
.box-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent); border-radius: 50%; cursor: nwse-resize; }
.box-delete { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font-size: 13px; line-height: 20px; padding: 0; cursor: pointer; display: none; }
.editor-stage .box.selected .box-delete, .editor-stage .box:hover .box-delete { display: block; }
.box.drawing { border-style: dashed; pointer-events: none; }
.editor-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: .8rem; max-height: calc(100vh - 100px); }
.editor-side-head { display: flex; justify-content: space-between; align-items: baseline; }
.editor-side-head h2 { margin: 0; font-size: 1.15rem; }
.editor-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem; min-height: 0; }
.editor-list li { display: flex; align-items: center; gap: .5rem; padding: .4rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.editor-list li.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor-list .crop { width: 40px; height: 40px; cursor: pointer; }
.editor-list input { padding: .4rem .55rem; height: 2.2rem; }
.editor-list .remove { flex: none; border: 0; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 0 .3rem; }
.editor-list .remove:hover { color: var(--danger); }
.editor-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.editor-status.loading::before { content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .4em; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Compte, crédits ---------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.stat-value { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.pack { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pack input { position: absolute; opacity: 0; }
.pack:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pack-name { font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }
.pack-credits { font-family: var(--font-serif); font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.pack-credits small { font-size: 1rem; font-weight: 400; color: var(--muted); }
.pack-price { font-size: 1.15rem; font-weight: 600; color: var(--accent); }
.payment #paypal-buttons { max-width: 420px; margin: 1rem 0; }

/* --- Tableaux / admin --------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.table th, .table td { padding: .65rem .8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .positive { color: var(--ok); font-weight: 600; }
.table .negative { color: var(--danger); font-weight: 600; }
.table form { margin: 0; }
.row-muted td { background: #faf8f5; color: var(--muted); }
.table-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; }
.inline-form { display: flex; gap: .35rem; align-items: center; }
.inline-form input { width: 5rem; padding: .35rem .5rem; height: 2rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* --- Responsive --------------------------------------------------------------------- */
@media (max-width: 960px) {
    .photo-layout, .editor { grid-template-columns: 1fr; }
    .photo-side, .editor-side { position: static; max-height: none; }
    .filters { grid-template-columns: 1fr 1fr; }
    .filters-actions { grid-column: 1 / -1; }
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (max-width: 760px) {
    .nav-burger { display: block; margin-left: auto; width: 32px; height: 32px; cursor: pointer; position: relative; }
    .nav-burger span, .nav-burger span::before, .nav-burger span::after { position: absolute; left: 6px; right: 6px; height: 2px; background: var(--text); content: ""; }
    .nav-burger span { top: 15px; }
    .nav-burger span::before { top: -7px; left: 0; right: 0; }
    .nav-burger span::after { top: 7px; left: 0; right: 0; }
    .header-inner { flex-wrap: wrap; }
    .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .8rem; }
    .nav-toggle:checked ~ .nav { display: flex; }
    .nav-spacer { display: none; }
    .grid-2, .packs, .filters { grid-template-columns: 1fr; }
    .steps { grid-template-columns: 1fr; }
    .hero { padding-top: 1.5rem; }
    .hero-search { flex-direction: column; }
    .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
}
