/* ============================================================
   maresidence.org — CSS principal
   Design : blanc moderne, couleurs douces, mobile-first
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --sage:        #7BA99A;
    --sage-light:  #EBF4F1;
    --sage-dark:   #5A8A7A;
    --blush:       #E8A598;
    --blush-light: #FDF1EF;
    --sand:        #F5EFE6;
    --ink:         #1C2B2A;
    --ink-soft:    #4A5E5C;
    --ink-muted:   #8A9E9C;
    --border:      #D8E5E2;
    --white:       #FFFFFF;
    --bg:          #F8FAFA;

    /* Catégories */
    --cat-alert:   #E05252;
    --cat-info:    #3B82F6;
    --cat-survey:  #8B5CF6;
    --cat-works:   #F59E0B;
    --cat-event:   #10B981;

    /* Espacements */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;

    /* Transitions */
    --transition:  150ms ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; display: block; }
a  { color: var(--sage-dark); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--sage); }

/* ── Typographie ─────────────────────────────────────────────── */
h1, h2, h3 {
    font-family: 'DM Sans', sans-serif;
    line-height: 1.2;
    color: var(--ink);
}
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p  { color: var(--ink-soft); }

/* ── Layout ──────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 32px 16px 64px;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.container--sm  { max-width: 480px; margin: 0 auto; }
.container--md  { max-width: 680px; margin: 0 auto; }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar__inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.navbar__brand {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}
.navbar__brand-main   { color: var(--ink); }
.navbar__brand-accent { color: var(--sage); font-weight: 600; }

.navbar__nav   { display: flex; gap: 8px; margin-left: auto; }
.navbar__user  { display: flex; align-items: center; gap: 12px; }
.navbar__link  { font-size: 0.875rem; font-weight: 400; color: var(--ink-soft); padding: 4px 8px; border-radius: var(--radius-sm); }
.navbar__link:hover { background: var(--sage-light); color: var(--sage-dark); }
.navbar__link--logout { color: var(--ink-muted); }
.navbar__username { font-size: 0.875rem; font-weight: 500; color: var(--ink); }

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn--primary {
    background: var(--sage);
    color: var(--white);
}
.btn--primary:hover {
    background: var(--sage-dark);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123,169,154,0.35);
}

.btn--secondary {
    background: var(--white);
    color: var(--ink);
    border: 1.5px solid var(--border);
}
.btn--secondary:hover {
    border-color: var(--sage);
    color: var(--sage-dark);
}

.btn--danger {
    background: #FEF2F2;
    color: #DC2626;
    border: 1.5px solid #FECACA;
}
.btn--danger:hover { background: #FEE2E2; }

.btn--sm { padding: 7px 16px; font-size: 0.8rem; }
.btn--lg { padding: 14px 32px; font-size: 1rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Formulaires ─────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--ink);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--sage);
    box-shadow: 0 0 0 3px rgba(123,169,154,0.15);
}

textarea { resize: vertical; min-height: 100px; }

.form-hint {
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.form-error {
    font-size: 0.8rem;
    color: #DC2626;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 16px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card--hover {
    transition: box-shadow var(--transition), transform var(--transition);
    cursor: pointer;
}
.card--hover:hover {
    box-shadow: 0 8px 24px rgba(28,43,42,0.08);
    transform: translateY(-2px);
}

/* ── Category pills ──────────────────────────────────────────── */
.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid currentColor;
}
.cat-pill--alert  { color: var(--cat-alert);  background: #FEF2F2; }
.cat-pill--info   { color: var(--cat-info);   background: #EFF6FF; }
.cat-pill--survey { color: var(--cat-survey); background: #F5F3FF; }
.cat-pill--works  { color: var(--cat-works);  background: #FFFBEB; }
.cat-pill--event  { color: var(--cat-event);  background: #ECFDF5; }

/* ── Flash messages ──────────────────────────────────────────── */
.flash-container {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    width: calc(100vw - 32px);
}

.flash {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    animation: slideIn 200ms ease;
    box-shadow: 0 4px 16px rgba(28,43,42,0.1);
}

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.flash--success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.flash--error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.flash--info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.flash--warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

.flash__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.flash__close:hover { opacity: 1; }

/* ── Page auth (login / magic link) ─────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 32px 16px;
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.auth-card__logo {
    font-size: 1.4rem;
    font-weight: 300;
    margin-bottom: 32px;
}

.auth-card__title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.auth-card__subtitle {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 20px 16px;
    margin-top: auto;
}

.footer__inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.footer__brand { font-weight: 500; }
.footer__brand strong { color: var(--sage); }
.footer__nav { display: flex; gap: 16px; margin-left: auto; }
.footer__nav a { color: var(--ink-muted); }
.footer__nav a:hover { color: var(--sage-dark); }

/* ── Utilitaires ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--ink-muted); font-size: 0.875rem; }
.mt-4  { margin-top:    16px; }
.mt-8  { margin-top:    32px; }
.mb-4  { margin-bottom: 16px; }
.mb-8  { margin-bottom: 32px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .auth-card { padding: 32px 20px; }
    .navbar__username { display: none; }
    .navbar__inner {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }
    .navbar__nav .navbar__link { font-size: 0.8rem; padding: 4px 6px; }
    .navbar__user { gap: 8px; }
    .navbar__user .navbar__link { font-size: 0.8rem; }

    .footer__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }
    .footer__nav {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }
    .footer__copy {
        order: 3;
    }
}

@media (max-width: 500px) {
    .post-card__header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .cat-pill {
        font-size: 0.72rem;
        padding: 3px 8px;
    }
}