/* ============================================================
   Thème imep — reproduction du design d'imep-cnrs.com
   CSS original ; tokens (couleurs, typos) relevés sur le site.
   ============================================================ */
@import url('fonts.css');

:root {
    --bg: #ffffff;
    --text: #424242;
    --muted: #969fa4;
    --heading: #0c0c0c;
    --link: #000000;
    --accent: #e66923;
    --accent-hover: #404040;
    --ticker-bg: #f55267;
    --ticker-text: #ffffff;
    --panel-alt: #edf7fe;
    --panel-warm: #faebd7;
    --footer-bg: #000000;
    --footer-text: #ffffff;
    --border: #e8e8e8;
    --radius: 6px;
    --font-general: 'Roboto', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, sans-serif;
    --font-heading: 'Bitter', Georgia, serif;
    --shadow: 0 2px 12px rgba(0, 0, 0, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-general);
    font-size: 19px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--heading);
    line-height: 1.25;
    margin: 0 0 .6em;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--heading); color: #fff; padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------------- Header ---------------- */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 50;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 66px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
}
.site-logo { display: flex; flex-direction: column; line-height: 1.15; }
.site-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 26px;
    color: var(--heading);
    letter-spacing: .5px;
}
.site-tagline { font-size: 12px; color: var(--muted); }
.logo-img { max-height: 48px; width: auto; }

.header-nav-row { border-top: 1px solid var(--border); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.main-nav a {
    display: block;
    padding: 9px 10px;
    font-size: 13.5px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: .2px;
    color: var(--heading);
}
.main-nav a:hover { color: var(--accent); }

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 24px;
    padding: 4px 12px;
    cursor: pointer;
    color: var(--heading);
}

.search-form { display: flex; align-items: center; }
.search-form input[type="search"] {
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 8px 12px;
    font: inherit;
    font-size: 15px;
    width: 170px;
    color: var(--text);
}
.search-form input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-form button {
    border: 1px solid var(--heading);
    background: var(--heading);
    color: #fff;
    padding: 8px 14px;
    font: inherit;
    font-size: 15px;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
}
.search-form button:hover { background: var(--accent); border-color: var(--accent); }

/* ---------------- Ticker « Dernières News » ---------------- */
.ticker {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--ticker-bg);
    color: var(--ticker-text);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin: 22px 0 8px;
    overflow: hidden;
}
.ticker-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.ticker-items { display: flex; gap: 30px; overflow: hidden; white-space: nowrap; }
.ticker-items a { color: var(--ticker-text); font-size: 16px; }
.ticker-items a:hover { text-decoration: underline; color: var(--ticker-text); }

/* ---------------- Tendances ---------------- */
.trending {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 26px;
}
.trending-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 17px;
    color: var(--heading);
    margin-right: 4px;
}
.trending-tag, .tag {
    display: inline-block;
    background: var(--panel-alt);
    color: var(--heading);
    font-size: 14px;
    font-weight: 500;
    padding: 5px 13px;
    border-radius: 999px;
}
.trending-tag:hover, .tag:hover { background: var(--accent); color: #fff; }

/* ---------------- Titres de section ---------------- */
.section-title {
    font-size: 26px;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 22px;
}
.section-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 52px; height: 3px;
    background: var(--accent);
    border-radius: 2px;
}
.section-title a { color: inherit; }
.section-title a:hover { color: var(--accent); }

/* ---------------- Cards ---------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.card-img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: var(--radius);
    transition: transform .25s ease, opacity .25s;
}
.card-link:hover .card-img { opacity: .9; transform: scale(1.02); }
.card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 12px 0 6px;
}
.card-link:hover .card-title { color: var(--accent); }
.card-feature { grid-column: span 3; }
.card-feature .card-img { aspect-ratio: 21 / 9; }
.card-feature .card-title { font-size: 30px; }
.card-meta { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.card-excerpt { font-size: 15px; color: var(--text); margin: 0; }

.home-section { margin: 44px 0; }
.latest-news { margin-top: 26px; }
.empty-state { color: var(--muted); }

/* ---------------- Article ---------------- */
.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 44px;
    margin: 30px 0 60px;
}
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

.article-title { font-size: 40px; font-weight: 700; margin-bottom: 10px; }
.article-meta { color: var(--muted); font-size: 15px; margin: 0 0 22px; }
.article-hero {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 26px;
    box-shadow: var(--shadow);
}

/* Table des matières */
.toc {
    background: var(--panel-alt);
    border: 1px solid #d8ebf8;
    border-radius: var(--radius);
    padding: 18px 24px;
    margin-bottom: 30px;
    font-size: 16px;
}
.toc-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--heading);
    font-size: 18px;
    margin: 0 0 10px;
}
.toc ol { margin: 0; padding-left: 22px; }
.toc li { margin: 5px 0; }
.toc-l3 { margin-left: 18px; list-style-type: circle; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); }

/* Corps d'article */
.article-body { font-size: 19px; }
.article-body h2 { font-size: 28px; margin: 1.6em 0 .6em; }
.article-body h3 { font-size: 22px; margin: 1.4em 0 .5em; }
.article-body h4 { font-size: 19px; margin: 1.2em 0 .5em; }
.article-body p { margin: 0 0 1.2em; }
.article-body a { text-decoration: underline; text-underline-offset: 2px; }
.article-body ul, .article-body ol { margin: 0 0 1.2em; padding-left: 28px; }
.article-body li { margin: .35em 0; }
.article-body img { border-radius: var(--radius); margin: 1em 0; }
.article-body figure { margin: 1.4em 0; }
.article-body figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 8px; }
.article-body blockquote {
    border-left: 4px solid var(--accent);
    background: #fafafa;
    margin: 1.4em 0;
    padding: 14px 22px;
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .85em;
}
.article-body pre {
    background: #f4f4f4;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
}
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.article-body sup { font-size: .7em; }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 1.4em 0; }
.article-body table {
    border-collapse: collapse;
    width: 100%;
    font-size: 16px;
    line-height: 1.45;
}
.article-body caption {
    caption-side: top;
    font-size: 14px;
    color: var(--muted);
    text-align: left;
    padding-bottom: 8px;
}
.article-body th, .article-body td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
}
.article-body thead th, .article-body table tr:first-child th {
    background: var(--heading);
    color: #fff;
    font-weight: 500;
}
.article-body tbody tr:nth-child(even) { background: #f7f9fb; }

/* Encadrés éditoriaux */
.encadre, .encadre-info, .encadre-attention {
    border-radius: var(--radius);
    padding: 16px 22px;
    margin: 1.4em 0;
}
.encadre, .encadre-info { background: var(--panel-alt); border: 1px solid #d8ebf8; }
.encadre-attention { background: var(--panel-warm); border: 1px solid #eed9bc; }

/* Tags d'article */
.article-tags { margin: 26px 0; display: flex; flex-wrap: wrap; gap: 8px; }

/* Vous aimerez aussi */
.related { margin-top: 44px; border-top: 1px solid var(--border); padding-top: 30px; }
.related h2 { font-size: 24px; }

/* ---------------- Sidebar ---------------- */
.sidebar { min-width: 0; }
.widget {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 26px;
}
.widget h2 {
    font-size: 19px;
    padding-bottom: 8px;
    margin-bottom: 14px;
    position: relative;
}
.widget h2::after {
    content: '';
    position: absolute; left: 0; bottom: 0;
    width: 40px; height: 3px;
    background: var(--accent);
    border-radius: 2px;
}
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.recent-list li:last-child { border-bottom: 0; }
.recent-thumb {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
}
.recent-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.recent-text a { font-size: 15px; font-weight: 500; line-height: 1.35; }
.recent-date { font-size: 13px; color: var(--muted); }

/* ---------------- Taxonomies / recherche ---------------- */
.taxonomy, .search-results, .static-page, .error-page { margin: 30px 0 60px; }
.term-description { color: var(--muted); margin: -10px 0 26px; max-width: 760px; }
.result-count { color: var(--muted); font-size: 15px; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.result-list a { font-family: var(--font-heading); font-weight: 700; font-size: 19px; }
.result-list a:hover { color: var(--accent); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin: 40px 0 10px;
    font-size: 16px;
}
.pagination a {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 18px;
    font-weight: 500;
}
.pagination a:hover { background: var(--heading); border-color: var(--heading); color: #fff; }
.page-info { color: var(--muted); font-size: 14px; }

/* ---------------- Pages statiques / formulaire ---------------- */
.static-page { max-width: 820px; }
.contact-form { display: flex; flex-direction: column; gap: 16px; margin-top: 26px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 16px; }
.contact-form input, .contact-form textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font: inherit;
    color: var(--text);
}
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hp-field { position: absolute; left: -9999px; }
.btn {
    display: inline-block;
    background: var(--heading);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    padding: 11px 26px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-start;
}
.btn:hover { background: var(--accent); color: #fff; }
.flash-public { border-radius: var(--radius); padding: 14px 20px; margin: 20px 0; }
.flash-ok { background: #e6f6ea; border: 1px solid #bfe3c9; }
.flash-err { background: #fdeaea; border: 1px solid #f2c4c4; }
.preview-banner {
    background: var(--panel-warm);
    border: 1px solid #eed9bc;
    border-radius: var(--radius);
    padding: 10px 18px;
    margin: 20px 0;
    font-size: 15px;
}

/* ---------------- Footer ---------------- */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    margin-top: 60px;
    padding: 34px 0;
    text-align: center;
    font-size: 15px;
}
.footer-nav {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 22px;
}
.site-footer a { color: var(--footer-text); }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.copyright { margin: 0; color: #cfcfcf; }

/* ---------------- Scroll top ---------------- */
.scroll-top {
    position: fixed;
    right: 24px; bottom: 24px;
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 0;
    background: var(--heading);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 60;
}
.scroll-top:hover { background: var(--accent); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
    .card-grid, .card-grid-4 { grid-template-columns: repeat(3, 1fr); }
    .article-layout { grid-template-columns: 1fr; }
    .sidebar { max-width: 640px; }
}
@media (max-width: 768px) {
    body { font-size: 17px; }
    .header-top { gap: 12px; }
    .menu-toggle { display: block; margin-left: auto; }
    .header-nav-row { border-top: 0; }
    .main-nav { display: none; }
    .main-nav.open { display: block; border-top: 1px solid var(--border); }
    .main-nav ul { flex-direction: column; }
    .main-nav a { padding: 10px 6px; border-bottom: 1px solid var(--border); }
    .search-form { flex-basis: 100%; margin-bottom: 10px; }
    .search-form input[type="search"] { flex: 1; }
    .card-grid, .card-grid-3, .card-grid-4 { grid-template-columns: repeat(2, 1fr); gap: 18px; }
    .card-feature { grid-column: span 2; }
    .card-feature .card-title { font-size: 22px; }
    .article-title { font-size: 28px; }
    .article-body { font-size: 17px; }
    .ticker-items a { font-size: 14px; }
}
@media (max-width: 480px) {
    .card-grid, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
    .card-feature { grid-column: span 1; }
    .section-title { font-size: 22px; }
}
