/* ============================================================
   Maison Beaussier - Socle graphique
   Palette : rouge profond (parcimonie), noir, creme, pierre.
   Typographie : serif classique pour les titres, sans-serif pour l'interface.
   ============================================================ */

:root {
    --mb-red: #be1c2d;
    --mb-red-dark: #8e1220;
    --mb-red-light: #d94656;
    --mb-red-wash: rgba(190, 28, 45, 0.07);

    --mb-ink: #1a1614;
    --mb-text: #2a2521;
    --mb-muted: #6d635c;
    --mb-faint: #9a908a;

    --mb-cream: #faf7f2;
    --mb-paper: #ffffff;
    --mb-stone: #e8e1d7;
    --mb-stone-dark: #d4cabd;
    --mb-wood: #8a6f4f;

    --mb-ok: #2f6b47;
    --mb-ok-wash: rgba(47, 107, 71, 0.08);
    --mb-warn: #9a6414;
    --mb-warn-wash: rgba(154, 100, 20, 0.09);
    --mb-danger: #a3182b;
    --mb-danger-wash: rgba(163, 24, 43, 0.08);

    --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --radius-sm: 3px;
    --radius: 6px;
    --radius-lg: 10px;

    --shadow-sm: 0 1px 2px rgba(26, 22, 20, 0.06), 0 1px 3px rgba(26, 22, 20, 0.05);
    --shadow: 0 2px 8px rgba(26, 22, 20, 0.07), 0 8px 24px rgba(26, 22, 20, 0.06);
    --shadow-lg: 0 10px 40px rgba(26, 22, 20, 0.12);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;

    --header-height: 4.5rem;
}

/* --- Reset mesure ------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--mb-text);
    background: var(--mb-cream);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--mb-ink);
    line-height: 1.2;
    margin: 0 0 var(--space-3);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.85rem, 5vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 var(--space-4); }

a {
    color: var(--mb-red);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover { color: var(--mb-red-dark); }

hr {
    border: 0;
    border-top: 1px solid var(--mb-stone);
    margin: var(--space-6) 0;
}

small { font-size: 0.85rem; }

code, .mono {
    font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

/* --- Accessibilite ------------------------------------------------ */
:focus-visible {
    outline: 2px solid var(--mb-red);
    outline-offset: 2px;
    border-radius: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--mb-ink);
    color: #fff;
    padding: var(--space-3) var(--space-4);
    z-index: 100;
}

.skip-link:focus {
    left: var(--space-3);
    top: var(--space-3);
    color: #fff;
}

/* --- Conteneurs --------------------------------------------------- */
.container {
    width: 100%;
    max-width: 68rem;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container--narrow { max-width: 44rem; }
.container--wide { max-width: 84rem; }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

/* --- Logo --------------------------------------------------------- */
.logo {
    display: inline-block;
    line-height: 0;
}

.logo img {
    width: auto;
    height: auto;
    max-height: 100%;
}

.logo--header img { max-width: 15rem; }
.logo--hero img { max-width: 22rem; margin: 0 auto; }
.logo--compact img { max-width: 11rem; }

/* --- Boutons ------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.85rem 1.5rem;
    min-height: 3rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.08s ease;
    background: var(--mb-paper);
    color: var(--mb-text);
}

.btn:active { transform: translateY(1px); }

.btn[disabled],
.btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn--primary {
    background: var(--mb-red);
    border-color: var(--mb-red);
    color: #fff;
}

.btn--primary:hover {
    background: var(--mb-red-dark);
    border-color: var(--mb-red-dark);
    color: #fff;
}

.btn--dark {
    background: var(--mb-ink);
    border-color: var(--mb-ink);
    color: #fff;
}

.btn--dark:hover { background: #000; color: #fff; }

.btn--outline {
    background: transparent;
    border-color: var(--mb-stone-dark);
    color: var(--mb-text);
}

.btn--outline:hover {
    border-color: var(--mb-ink);
    color: var(--mb-ink);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--mb-muted);
    padding: 0.5rem 0.75rem;
    min-height: 2.25rem;
    font-size: 0.9rem;
}

.btn--ghost:hover { color: var(--mb-ink); background: rgba(26, 22, 20, 0.04); }

.btn--danger {
    background: transparent;
    border-color: rgba(163, 24, 43, 0.35);
    color: var(--mb-danger);
}

.btn--danger:hover { background: var(--mb-danger-wash); }

.btn--block { width: 100%; }
.btn--sm { padding: 0.45rem 0.85rem; min-height: 2.25rem; font-size: 0.875rem; }
.btn--lg { padding: 1.05rem 2.25rem; min-height: 3.5rem; font-size: 1.075rem; }

/* --- Formulaires -------------------------------------------------- */
.field { margin-bottom: var(--space-4); }

.field label,
.label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mb-muted);
    margin-bottom: var(--space-2);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="url"],
input[type="file"],
select,
textarea {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    color: var(--mb-text);
    background: var(--mb-paper);
    border: 1px solid var(--mb-stone-dark);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
    min-height: 2.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--mb-red);
    box-shadow: 0 0 0 3px var(--mb-red-wash);
    outline: none;
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    min-height: 0;
    accent-color: var(--mb-red);
    margin: 0;
}

.check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.95rem;
    cursor: pointer;
}

.check label,
.check span {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--mb-text);
    margin: 0;
    font-size: 0.95rem;
}

.hint {
    font-size: 0.83rem;
    color: var(--mb-muted);
    margin-top: var(--space-2);
    line-height: 1.5;
}

.field-row {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: 40rem) {
    .field-row--2 { grid-template-columns: 1fr 1fr; }
    .field-row--3 { grid-template-columns: repeat(3, 1fr); }
}

/* --- Cartes ------------------------------------------------------- */
.card {
    background: var(--mb-paper);
    border: 1px solid var(--mb-stone);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.card--flat { box-shadow: none; }
.card--tight { padding: var(--space-4); }

.card__title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    margin: 0 0 var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* --- Alertes ------------------------------------------------------ */
.alert {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--mb-stone);
    background: var(--mb-paper);
    font-size: 0.95rem;
    line-height: 1.55;
}

.alert .icon { flex: none; margin-top: 2px; }
.alert--success { border-color: rgba(47, 107, 71, 0.3); background: var(--mb-ok-wash); color: #1f4d33; }
.alert--error { border-color: rgba(163, 24, 43, 0.3); background: var(--mb-danger-wash); color: #7e1322; }
.alert--warning { border-color: rgba(154, 100, 20, 0.3); background: var(--mb-warn-wash); color: #6f480f; }
.alert--info { border-color: var(--mb-stone-dark); background: var(--mb-cream); }

/* --- Etiquettes --------------------------------------------------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--mb-stone-dark);
    color: var(--mb-muted);
    background: var(--mb-paper);
    white-space: nowrap;
}

.tag--ok { color: var(--mb-ok); border-color: rgba(47, 107, 71, 0.35); background: var(--mb-ok-wash); }
.tag--warn { color: var(--mb-warn); border-color: rgba(154, 100, 20, 0.35); background: var(--mb-warn-wash); }
.tag--danger { color: var(--mb-danger); border-color: rgba(163, 24, 43, 0.35); background: var(--mb-danger-wash); }
.tag--neutral { color: var(--mb-muted); }

/* --- Tableaux ----------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--mb-stone);
    border-radius: var(--radius-lg);
    background: var(--mb-paper);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

thead th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--mb-muted);
    background: var(--mb-cream);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--mb-stone);
    white-space: nowrap;
}

tbody td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--mb-stone);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(232, 225, 215, 0.25); }

.table-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    flex-wrap: wrap;
}

.empty {
    text-align: center;
    padding: var(--space-7) var(--space-4);
    color: var(--mb-muted);
}

/* --- Pagination --------------------------------------------------- */
.pagination {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-5);
}

.pagination a,
.pagination span {
    min-width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.6rem;
    border: 1px solid var(--mb-stone-dark);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--mb-text);
    background: var(--mb-paper);
    font-size: 0.9rem;
}

.pagination .is-current {
    background: var(--mb-ink);
    border-color: var(--mb-ink);
    color: #fff;
    font-weight: 600;
}

.pagination .is-disabled { opacity: 0.4; }

/* --- Divers ------------------------------------------------------- */
.icon { flex: none; vertical-align: middle; }
.text-muted { color: var(--mb-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-serif { font-family: var(--font-serif); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.divider-rule {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--mb-faint);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.divider-rule::before,
.divider-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--mb-stone-dark);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}
