/* ─── Design tokens ─────────────────────────────────────────────────────── */
:root {
    --purple:       #4f3e72;
    --purple-dark:  #3a2d56;
    --purple-light: #ede9f5;
    --green:        #87c254;
    --green-dark:   #5b9024;
    --green-mid:    #74a13c;
    --text:         #353535;
    --text-soft:    #666;
    --bg:           #faf9f8;
    --bg-card:      #fff;
    --border:       #e0dcea;
    --shadow:       0 2px 12px rgba(79,62,114,.10);
    --nav-h:        64px;
    --radius:       6px;
    --serif:        georgia, 'Times New Roman', serif;
    --sans:         tahoma, verdana, arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --text:       #e8e4f0;
        --text-soft:  #aaa8b8;
        --bg:         #1c1a26;
        --bg-card:    #252235;
        --border:     #3a3452;
        --purple-light: #2a2440;
        --shadow:     0 2px 12px rgba(0,0,0,.35);
    }
}
:root[data-theme="light"] {
    --text:       #353535;
    --text-soft:  #666;
    --bg:         #faf9f8;
    --bg-card:    #fff;
    --border:     #e0dcea;
    --purple-light: #ede9f5;
    --shadow:     0 2px 12px rgba(79,62,114,.10);
}
:root[data-theme="dark"] {
    --text:       #e8e4f0;
    --text-soft:  #aaa8b8;
    --bg:         #1c1a26;
    --bg-card:    #252235;
    --border:     #3a3452;
    --purple-light: #2a2440;
    --shadow:     0 2px 12px rgba(0,0,0,.35);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
}
img { display: block; max-width: 100%; }
a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--green-dark); text-decoration: underline; }
ul { list-style: none; }

/* ─── Top bar ────────────────────────────────────────────────────────────── */
#topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--nav-h);
    background: var(--purple);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Welcome text */
.topbar-welcome {
    color: rgba(255,255,255,.90);
    font-size: 12px;
    line-height: 1.4;
    flex-shrink: 1;
}
.topbar-welcome strong { color: #fff; }

/* Nav */
#main-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}
#main-nav > ul {
    display: flex;
    align-items: center;
    gap: 2px;
}
#main-nav > ul > li { position: relative; }

#main-nav a,
#main-nav span.nav-current {
    display: block;
    padding: 8px 14px;
    color: rgba(255,255,255,.88);
    font-size: 13px;
    font-family: var(--sans);
    border-radius: var(--radius);
    transition: background .15s, color .15s;
    white-space: nowrap;
}
#main-nav a:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
#main-nav span.nav-current {
    color: #fff;
    background: rgba(135,194,84,.30);
    font-weight: bold;
    cursor: default;
}
#main-nav li.nav-parent > a { padding-right: 22px; }
#main-nav li.nav-parent > a::after {
    content: '▾';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: .7;
}

/* Dropdown */
#main-nav .subnav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--purple-dark);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    padding: 4px 0;
}
/* Bridge invisible pour couvrir le gap entre le li et le subnav */
#main-nav li.nav-parent::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 6px;
}
#main-nav li:hover > .subnav,
#main-nav li:focus-within > .subnav { display: block; }
#main-nav .subnav li a {
    padding: 7px 16px;
    font-size: 12.5px;
    color: rgba(255,255,255,.85);
    border-radius: 0;
}
#main-nav .subnav li a:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
    background: none;
    border: none;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
#hero {
    position: relative;
    height: 182px;
    background: var(--purple-dark) url('../images/visual.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    overflow: hidden;
}

#hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(58,45,86,.30) 30%, rgba(58,45,86,.00) 100%);
}
/* Logo dans le hero */
.hero-logo {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    padding: 0 32px;
    flex-shrink: 0;
}
.hero-logo img {
    height: 150px;
    width: auto;
    display: block;
}
/* Photo dans le hero */
.hero-photo {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    height: 150px;
    width: auto;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.30);
}

/* ─── Page body ──────────────────────────────────────────────────────────── */
#page-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 32px 60px;
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 40px;
    align-items: start;
}

/* ─── Main content ───────────────────────────────────────────────────────── */
#content h1, #content h2 {
    font-family: var(--sans);
    font-size: 20px;
    font-weight: bold;
    color: var(--purple);
    margin-bottom: 14px;
    line-height: 1.35;
}
#content h3 {
    font-size: 16px;
    color: var(--purple);
    margin: 18px 0 8px;
}
#content p {
    margin-bottom: 14px;
    color: var(--text);
    line-height: 1.75;
}
#content ul, #content ol {
    margin: 0 0 14px 20px;
    list-style: disc;
}
#content ol { list-style: decimal; }
#content li { margin-bottom: 4px; }
#content img { border-radius: var(--radius); margin: 12px 0; }
#content blockquote {
    border-left: 3px solid var(--green);
    padding: 8px 16px;
    margin: 16px 0;
    color: var(--text-soft);
    font-style: italic;
}

/* Quot (legacy) */
#content p.quot {
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    color: var(--green-dark);
    padding: 12px 24px;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
}
.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.sidebar-section-title {
    background: var(--purple);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 8px 14px;
}

/* Nav sidebar */
.sidebar-nav { padding: 6px 0; }
.sidebar-nav li { border-bottom: 1px solid var(--border); }
.sidebar-nav li:last-child { border-bottom: none; }
.sidebar-nav a {
    display: block;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--text);
    transition: background .12s, color .12s;
}
.sidebar-nav a:hover { background: var(--purple-light); color: var(--purple); text-decoration: none; }
.sidebar-nav li.nav-current > a,
.sidebar-nav li.nav-current > span {
    color: var(--purple);
    font-weight: bold;
    background: var(--purple-light);
    display: block;
    padding: 7px 14px;
    font-size: 13px;
}
.sidebar-subnav { border-top: 1px solid var(--border); }
.sidebar-subnav li { border-bottom: none; }
.sidebar-subnav a {
    padding: 5px 14px 5px 24px;
    font-size: 12px;
    color: var(--text-soft);
}
.sidebar-subnav a:hover { color: var(--purple); }

/* News sidebar */
.news-sidebar-list { padding: 6px 0; }
.news-sidebar-item { border-bottom: 1px solid var(--border); padding: 8px 14px; }
.news-sidebar-item:last-child { border-bottom: none; }
.news-sidebar-item a {
    display: block;
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
    transition: color .12s;
}
.news-sidebar-item a:hover { color: var(--purple); text-decoration: none; }
.news-sidebar-date {
    display: block;
    font-size: 11px;
    color: var(--green-dark);
    margin-bottom: 2px;
}

/* ─── News list ───────────────────────────────────────────────────────────── */
.news-list { margin-top: 8px; }
.news-list-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.news-list-item:last-child { border-bottom: none; }
.news-list-item h3 {
    font-size: 15px;
    color: var(--purple);
    margin-bottom: 4px;
}
.news-list-item h3 a { color: var(--purple); }
.news-list-item h3 a:hover { color: var(--green-dark); text-decoration: none; }
.news-date {
    font-size: 11px;
    color: var(--green-dark);
    display: block;
    margin-bottom: 6px;
}
.news-sommaire {
    font-style: italic;
    color: var(--text-soft);
    font-size: 13px;
    margin-bottom: 6px;
}

/* News detail */
.news-detail h2 {
    font-size: 20px;
    color: var(--purple);
    margin-bottom: 6px;
}
.news-detail .news-contenu p { margin-bottom: 12px; }
.news-back { margin-top: 20px; }
.news-back a {
    color: var(--purple);
    font-size: 13px;
}
.news-back a:hover { color: var(--green-dark); }

/* Articles sidebar list */
.articles-sidebar-list { padding: 6px 0; }
.articles-sidebar-item { border-bottom: 1px solid var(--border); }
.articles-sidebar-item:last-child { border-bottom: none; }
.articles-sidebar-item a,
.articles-sidebar-item span {
    display: block;
    padding: 7px 14px;
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.35;
    transition: background .12s, color .12s;
}
.articles-sidebar-item a:hover { background: var(--purple-light); color: var(--purple); text-decoration: none; }
.articles-sidebar-item.is-current a,
.articles-sidebar-item.is-current span {
    font-weight: bold;
    color: var(--purple);
    background: var(--purple-light);
}

/* ─── Contact form ───────────────────────────────────────────────────────── */
.contact-form { max-width: 500px; }
.contact-form p { margin-bottom: 16px; }
.contact-form label {
    display: block;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text);
}
.contact-form input[type=text],
.contact-form input[type=email],
.contact-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    padding: 8px 10px;
    font-family: var(--sans);
    font-size: 13px;
    border-radius: var(--radius);
    transition: border-color .15s;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(79,62,114,.12);
}
.contact-form textarea { height: 130px; resize: vertical; }
.contact-form input[type=submit] {
    background: var(--purple);
    color: #fff;
    border: none;
    padding: 9px 24px;
    font-size: 13px;
    font-family: var(--sans);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s;
}
.contact-form input[type=submit]:hover { background: var(--purple-dark); }
.msg-ok  { color: var(--green-dark); font-weight: bold; margin-bottom: 12px; }
.msg-err { color: #c0392b; margin-bottom: 12px; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
#footer {
    background: var(--purple-dark);
    color: rgba(255,255,255,.80);
    text-align: center;
    font-size: 12px;
    padding: 14px 20px;
    line-height: 1.5;
}
#footer a { color: rgba(255,255,255,.90); text-decoration: underline; }
#footer a:hover { color: var(--green); }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    #page-body {
        grid-template-columns: 1fr;
        padding: 24px 20px 48px;
        gap: 28px;
    }
    /* Move sidebar below content on small screens */
    #sidebar { position: static; order: 2; display: flex; gap: 16px; flex-wrap: wrap; }
    .sidebar-section { flex: 1 1 240px; }
    #content { order: 1; }

    .hero-photo { height: 120px; right: 16px; }
    .hero-logo img { height: 120px; }
    .hero-logo { padding: 0 16px; }

    #topbar { padding: 0 16px; }
    #main-nav { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
        background: var(--purple-dark); flex-direction: column; align-items: stretch;
        padding: 8px 0 16px; box-shadow: 0 4px 12px rgba(0,0,0,.3); gap: 0; }
    #main-nav.open { display: flex; }
    #main-nav > ul { flex-direction: column; gap: 0; }
    #main-nav > ul > li { border-bottom: 1px solid rgba(255,255,255,.08); }
    #main-nav a, #main-nav span.nav-current { border-radius: 0; padding: 10px 20px; font-size: 14px; }
    #main-nav .subnav { position: static; background: rgba(0,0,0,.18); border-radius: 0; box-shadow: none; padding: 0; }
    #main-nav li:hover > .subnav, #main-nav li:focus-within > .subnav { display: none; }
    #main-nav li.open > .subnav { display: block; }
    #main-nav .subnav li a { padding: 8px 20px 8px 36px; }
    .hamburger { display: flex; }
}

@media (max-width: 560px) {
    .hero-photo { height: 80px; right: 12px; border-radius: var(--radius); }
    #hero { height: 110px; }
    .hero-logo img { height: 90px; }
    #page-body { padding: 16px 14px 40px; }
    #sidebar { flex-direction: column; }
}