/* ============================================================
   custom.css — Bootstrap 5.3 override + composants éditoriaux
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,800;0,900;1,400;1,700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300;1,8..60,400&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables Bootstrap (override) + palette de marque ── */
:root {
    /* Pourpre (primaire) */
    --pourpre-50:  #fdf4f7;
    --pourpre-100: #fae8ef;
    --pourpre-200: #f2c6d6;
    --pourpre-300: #e699b4;
    --pourpre-400: #d46b90;
    --pourpre-500: #c05a7a;
    --pourpre-600: #a53a5e;
    --pourpre-700: #7b2544;
    --pourpre-800: #5c1f35;
    --pourpre-900: #3d1224;

    /* Papier (fond crème) */
    --papier-50:  #faf7f2;
    --papier-100: #f5efe4;
    --papier-200: #ede3d0;
    --papier-300: #dfd0b7;
    --papier-400: #c9b494;
    --papier-500: #b89870;
    --papier-600: #9c7c52;

    /* Encre (texte sombre) */
    --encre-50:  #f4f6f9;
    --encre-100: #e6eaf0;
    --encre-200: #c9d2de;
    --encre-300: #a3b1c4;
    --encre-400: #748aa3;
    --encre-500: #566d88;
    --encre-600: #3f5470;
    --encre-700: #2d3f58;
    --encre-800: #1e2d42;
    --encre-900: #0f1e2e;

    /* Cuivre (accent) */
    --cuivre-100: #fdf0e0;
    --cuivre-300: #f0c98a;
    --cuivre-500: #c8843a;
    --cuivre-700: #8a5520;

    /* Fontes */
    --font-display:   'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-editorial: 'Source Serif 4', Georgia, serif;
    --font-sans:      'Inter', system-ui, -apple-system, sans-serif;

    /* Override Bootstrap */
    --bs-primary:       var(--pourpre-700);
    --bs-primary-rgb:   123, 37, 68;
    --bs-body-font-family: var(--font-sans);
    --bs-body-bg:       var(--papier-50);
    --bs-body-color:    var(--encre-800);
    --bs-link-color:    var(--pourpre-700);
    --bs-link-hover-color: var(--pourpre-600);
    --bs-border-color:  var(--encre-200);
}

/* ── Reset typographique de base ── */
body {
    background-color: var(--papier-50);
    color: var(--encre-800);
    font-family: var(--font-sans);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
}

/* ── Navbar éditoriale ── */
#main-nav {
    background-color: rgba(250, 247, 242, 0.95) !important;
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--encre-200) !important;
    transition: box-shadow 0.3s ease;
}

#main-nav .navbar-brand {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--encre-900);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: color 0.2s;
}

#main-nav .navbar-brand:hover {
    color: var(--pourpre-700);
}

#main-nav .navbar-brand img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border: 1px solid var(--encre-300);
    transition: border-color 0.2s;
}

#main-nav .navbar-brand:hover img {
    border-color: var(--pourpre-600);
}

/* Filet décoratif en haut de la navbar */
#main-nav::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(to right, var(--pourpre-800), var(--pourpre-600), var(--cuivre-500));
}

/* Nav links */
.nav-link {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--encre-700) !important;
    padding: 0.4rem 0.75rem !important;
    transition: color 0.2s;
    display: inline-block !important;
}

.nav-link:hover {
    color: var(--pourpre-700) !important;
}

.nav-link--active {
    color: var(--pourpre-700) !important;
    border-bottom: 2px solid var(--pourpre-700);
}

/* User avatar */
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pourpre-600), var(--pourpre-700));
    color: white;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid var(--pourpre-400);
    flex-shrink: 0;
}

/* Dropdown menu Bootstrap override */
.dropdown-menu {
    border: 2px solid var(--encre-900);
    border-radius: 0;
    box-shadow: 4px 4px 0 0 rgba(15, 30, 46, 0.12);
    background-color: var(--papier-50);
    min-width: 260px;
    margin-top: 0.5rem;
}

.dropdown-header {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--encre-600);
}

.dropdown-item {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--encre-700);
    padding: 0.6rem 1rem;
    transition: background 0.15s, color 0.15s;
}

.dropdown-item:hover {
    background-color: var(--pourpre-50);
    color: var(--pourpre-700);
}

.dropdown-item i {
    color: var(--pourpre-600);
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    border-top-color: var(--encre-200);
    margin: 0.5rem 0;
}

/* Navbar toggler */
.navbar-toggler {
    border: 2px solid var(--encre-300);
    padding: 0.4rem 0.6rem;
    transition: border-color 0.2s;
}

.navbar-toggler:hover {
    border-color: var(--pourpre-600);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(123, 37, 68, 0.12);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(30, 45, 66, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ── Séparateurs éditoriaux ── */
.filet {
    border: none;
    border-top: 1px solid var(--encre-200);
    margin: 0;
    opacity: 1;
}

.filet-epais {
    border: none;
    border-top: 2px solid var(--encre-800);
    opacity: 1;
}

.filet-double {
    border: none;
    border-top: 3px double var(--encre-700);
    opacity: 1;
}

.filet-pourpre {
    border: none;
    border-top: 3px solid var(--pourpre-700);
    opacity: 1;
}

/* ── Typographie éditoriale ── */
.kicker {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pourpre-700);
    display: block;
}

.chapo {
    font-family: var(--font-editorial);
    font-size: 1.15rem;
    color: var(--encre-600);
    line-height: 1.6;
}

.byline {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--encre-500);
    display: block;
}

.drop-cap::first-letter {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 0.8;
    float: left;
    margin-right: 0.1em;
    color: var(--pourpre-700);
}

.pull-quote {
    font-family: var(--font-editorial);
    font-size: 1.3rem;
    font-style: italic;
    color: var(--encre-700);
    border-left: 4px solid var(--pourpre-700);
    padding-left: 1.25rem;
    margin-left: 0;
    line-height: 1.55;
}

/* ── Badge éditorial ── */
.badge-editorial {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    padding: 0.15em 0.5em;
    background: transparent;
}

/* ── Surface éditoriale (carte sans border-radius) ── */
.surface-editoriale {
    background-color: white;
    border: 2px solid var(--encre-900);
    box-shadow: 4px 4px 0 0 rgba(15, 30, 46, 0.08);
}

.section-tint {
    background-color: var(--papier-100);
    border: 1px solid var(--papier-300);
}

/* ── Boutons éditoriaux ── */
.btn-editorial {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pourpre-700);
    background: transparent;
    border: 2px solid var(--pourpre-700);
    padding: 0.6rem 1.25rem;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.btn-editorial:hover {
    background-color: var(--pourpre-700);
    color: var(--papier-50);
    text-decoration: none;
}

.btn-editorial-filled {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--papier-50);
    background: var(--pourpre-700);
    border: 2px solid var(--pourpre-700);
    padding: 0.6rem 1.25rem;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
}

.btn-editorial-filled:hover {
    background-color: var(--pourpre-800);
    border-color: var(--pourpre-800);
    color: var(--papier-50);
    text-decoration: none;
}

/* ── Formulaires ── */
.form-control,
.form-select {
    border-radius: 0;
    border: 1.5px solid var(--encre-300);
    background-color: white;
    color: var(--encre-900);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.55rem 0.8rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--pourpre-600);
    box-shadow: 0 0 0 3px rgba(123, 37, 68, 0.12);
    background-color: white;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #b91c1c;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--papier-100);
    color: var(--encre-500);
}

.form-label {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--encre-600);
    margin-bottom: 0.35rem;
}

.form-text {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--encre-400);
}

.invalid-feedback {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: #b91c1c;
}

/* ── Messages / Toasts Django ── */
.message {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid transparent;
}

.message--success {
    background-color: #f0fdf4;
    border-left-color: #16a34a;
    color: #166534;
}

.message--error {
    background-color: #fef2f2;
    border-left-color: #b91c1c;
    color: #991b1b;
}

.message--warning {
    background-color: #fffbeb;
    border-left-color: #d97706;
    color: #92400e;
}

.message--info {
    background-color: #eff6ff;
    border-left-color: #2563eb;
    color: #1e40af;
}

/* ── Footer ── */
footer {
    background-color: var(--encre-900);
    position: relative;
}

footer::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(to right, var(--pourpre-800), var(--pourpre-500), var(--cuivre-500));
}

.footer-link {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--encre-300);
    text-decoration: none;
    transition: color 0.2s;
    display: block;
}

.footer-link:hover {
    color: var(--papier-50);
}

.footer-social-link {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pourpre-400);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: color 0.2s;
}

.footer-social-link:hover {
    color: var(--pourpre-300);
}

.footer-social-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--pourpre-600);
    flex-shrink: 0;
}

/* ── Cartes et articles ── */
.carte-article {
    border: 1px solid var(--encre-200);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.carte-article:hover {
    border-color: var(--pourpre-400);
    box-shadow: 2px 2px 0 0 rgba(123, 37, 68, 0.08);
}

/* ── HTMX Loading States ── */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Checkbox personnalisé */
.form-check-input {
    border-radius: 0;
    border: 1.5px solid var(--encre-300);
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.15em;
}

.form-check-input:checked {
    background-color: var(--pourpre-700);
    border-color: var(--pourpre-700);
}

.form-check-input:focus {
    border-color: var(--pourpre-600);
    box-shadow: 0 0 0 3px rgba(123, 37, 68, 0.12);
}

/* ── Utilitaires divers ── */
.text-pourpre    { color: var(--pourpre-700); }
.text-encre      { color: var(--encre-800); }
.bg-papier       { background-color: var(--papier-50); }
.font-display    { font-family: var(--font-display); }
.font-editorial  { font-family: var(--font-editorial); }

/* ── Responsive — mobile nav active ── */
@media (max-width: 767.98px) {
    .nav-link--active {
        border-bottom: none;
        border-left: 3px solid var(--pourpre-700);
        padding-left: 0.75rem !important;
    }
}
