/* ===========================
   Thème : Sunset
   Chaud, terracotta, ivoire
   =========================== */
:root {
    --color-bg: #fef9f0;
    --color-surface: #ffffff;
    --color-border: #f0d5b8;
    --color-border-light: #f8ead4;
    --color-text: #3d1f0e;
    --color-muted: #9a6348;
    --color-accent: #c0633c;
    --color-accent-hover: #a04c2a;
    --color-accent-light: #fef2ea;
    --color-header-from: #c44b2a;
    --color-header-to: #d4954a;
    --color-header-text: #fff7ef;
    --color-header-sub: #ffd4b0;
    --color-nav-bg: #7a3520;
    --color-nav-text: #fff7ef;
    --color-nav-hover-bg: #c0633c;
    --color-footer-bg: #3d1f0e;
    --color-footer-text: #c8977a;
    --max-width: 1000px;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(192,99,60,0.1);

    --color-year: #c0633c;
    --color-art: #c0633c;
    --color-comm: #5a8a3a;
    --color-these: #6a3d8a;
    --color-hdr: #aa3d6a;
    --color-report: #c08020;
    --color-book: #2a8a70;
    --color-chap: #2a6a8a;
    --color-other: #8a7a6a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
}

header {
    background: linear-gradient(135deg, var(--color-header-from) 0%, var(--color-header-to) 100%);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-brand { flex-shrink: 0; }

.site-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-header-text);
    letter-spacing: 0.3px;
}

.site-subtitle {
    font-size: 0.85rem;
    color: var(--color-header-sub);
    margin-top: 0.1rem;
    font-weight: 600;
}

nav { background: var(--color-nav-bg); }

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

nav li a {
    display: block;
    padding: 0.6rem 1.1rem;
    color: var(--color-nav-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.15s;
}
nav li a:hover { background: var(--color-nav-hover-bg); }

.content {
    max-width: var(--max-width);
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

h1, h2, h3, h4, h5 {
    font-weight: 800;
    color: var(--color-accent);
    margin-top: 1.8rem;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}
h1 { font-size: 1.8rem; border-bottom: 2px solid var(--color-border); padding-bottom: 0.5rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { margin-bottom: 1rem; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.3rem; }

blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 0.6rem 1.2rem;
    color: var(--color-muted);
    background: var(--color-accent-light);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1rem 0;
}

code {
    font-family: "Courier New", monospace;
    font-size: 0.88em;
    background: var(--color-accent-light);
    border: 1px solid var(--color-border);
    padding: 2px 5px;
    border-radius: 4px;
}
pre {
    background: #2a1208;
    color: #ffd4a0;
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}
pre code { background: none; border: none; padding: 0; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.profile { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }
.profile-img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 3px solid var(--color-border); flex-shrink: 0; box-shadow: 0 3px 10px rgba(192,99,60,0.2); }
.profile-text { flex: 1 1 300px; }

.contact ul { list-style: none; padding: 0; }
.contact li { padding: 0.4rem 0; border-bottom: 1px solid var(--color-border-light); }

.logos { max-width: var(--max-width); margin: 1.5rem auto; padding: 0 1.5rem; display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; filter: sepia(0.2); }
.logos img { height: 65px; opacity: 0.85; transition: opacity 0.2s; }
.logos img:hover { opacity: 1; }

.pub-item { display: flex; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--color-border-light); align-items: flex-start; }
.pub-thumb { width: 65px; height: 85px; object-fit: cover; border: 1px solid var(--color-border); flex-shrink: 0; }
.pub-thumb.placeholder { background: var(--color-accent-light); }
.pub-content { flex: 1; }
.pub-title a { font-weight: 700; font-size: 1rem; color: var(--color-text); }
.pub-authors { font-size: 0.88rem; color: var(--color-muted); margin: 0.2rem 0; }
.pub-ref { font-size: 0.82rem; color: var(--color-muted); }
.pub-type, .pub-year { display: inline-block; padding: 0.15em 0.55em; font-size: 0.73rem; font-weight: 700; color: white; border-radius: 5px; margin-right: 0.3rem; }
.pub-year     { background: var(--color-year); }
.type-art         { background: var(--color-art); }
.type-comm        { background: var(--color-comm); }
.type-proceedings { background: var(--color-comm); }
.type-these       { background: var(--color-these); }
.type-hdr         { background: var(--color-hdr); }
.type-report      { background: var(--color-report); }
.type-book        { background: var(--color-book); }
.type-chap        { background: var(--color-chap); }
.type-couv        { background: var(--color-comm); }
.type-other       { background: var(--color-other); }

#liste-articles { list-style: none; padding: 0; }
.blog-item { padding: 0.7rem 0; border-bottom: 1px solid var(--color-border-light); }
.blog-date { font-size: 0.82rem; font-weight: 800; color: var(--color-accent); background: var(--color-accent-light); padding: 1px 8px; border-radius: 5px; margin-right: 0.8rem; }
.blog-titre a { color: var(--color-text); font-weight: 700; }

.grid { display: grid; gap: 1.2rem; padding: 1rem 0; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-card { position: relative; aspect-ratio: 4/3; background-size: cover; background-position: center; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); transition: transform 0.2s, box-shadow 0.2s; }
.grid-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(192,99,60,0.2); }
.grid-card a { display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; width: 100%; color: #fff; text-decoration: none; background: rgba(61,31,14,0.55); font-size: 1rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.5); padding: 0.5rem; }
.grid-section { margin: 2rem 0; }
.grid-section h1, .grid-section h2 { margin-bottom: 1rem; }
.grid-section.archive { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px dashed var(--color-border); }

footer { background: var(--color-footer-bg); color: var(--color-footer-text); text-align: center; padding: 1.2rem; margin-top: 3rem; font-size: 0.85rem; }
footer a { color: var(--color-footer-text); text-decoration: underline; }

@media (max-width: 700px) {
    nav ul { flex-direction: column; }
    .profile { flex-direction: column; align-items: center; }
    .header-inner { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   STYLES PARTAGÉS — injectés après le CSS du thème actif.
   Utilisent currentColor et font: inherit pour s'adapter
   automatiquement à tous les thèmes.
   Les variables CSS ci-dessous servent de valeurs de repli ;
   chaque thème peut les surcharger dans son propre style.css.
   ============================================================ */

:root {
  --card-gap:       1.5rem;
  --card-radius:    4px;
  --hover-scale:    1.03;
  --overlay-bg:     rgba(0, 0, 0, 0.45);
  --text-shadow:    1px 1px 4px rgba(0, 0, 0, 0.8);
  --section-padding:1rem 0;
  --archive-bg:     rgba(0, 0, 0, 0.06);
}

/* ── Grille de cartes (enseignement / software) ── */
.grid {
    display: grid;
    gap: var(--card-gap);
    padding: 1rem 0;
    grid-template-columns: repeat(auto-fit, minmax(220px, 0.45fr));
}

.grid-card {
    position: relative;
    aspect-ratio: 4 / 3;
    background-color: rgba(128,128,128,0.2);
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.grid-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-card:hover {
    transform: scale(var(--hover-scale));
}

.grid-card a {
    position: relative;
    z-index: 1;
    display: flex;
    text-align: center;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: #fff;
    text-decoration: none;
    background-color: var(--overlay-bg);
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: var(--text-shadow);
    padding: 0.5rem;
}

.grid-section {
    padding: var(--section-padding);
}

.grid-section h2 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
    border-bottom: 1px solid currentColor;
    padding-bottom: 0.4rem;
    opacity: 0.85;
}

.grid-section.archive {
    background-color: var(--archive-bg);
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-radius: var(--card-radius);
}

/* ── Liste d'articles de blog ── */
#liste-articles {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.blog-item {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid currentColor;
    opacity: 0.9;
}

.blog-item:last-child { border-bottom: none; }

.blog-date {
    font-size: 0.82rem;
    opacity: 0.55;
    white-space: nowrap;
    flex-shrink: 0;
}

.blog-titre {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.blog-titre:hover { text-decoration: underline; }

/* ── Liste de publications ── */
.pub-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pub-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* ── Barre de tri des publications ── */
.pub-sort-bar {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    margin: 1.5rem 0 1rem;
    border-bottom: 1px solid currentColor;
    opacity: 0.9;
}

.pub-sort-label {
    font-size: 0.8rem;
    opacity: 0.55;
    margin-right: 0.5rem;
    padding-bottom: 0.4rem;
}

.pub-sort-btn {
    padding: 0.35em 0.9em;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    color: inherit;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.15s, border-color 0.15s;
}

.pub-sort-btn:hover {
    opacity: 0.8;
}

.pub-sort-btn.active {
    opacity: 1;
    border-bottom-color: currentColor;
}

/* ── Groupes par type (vue "Trier par type") ── */
.pub-group {
    margin-bottom: 2rem;
}

.pub-group-title {
    font-size: 0.9rem;
    font-weight: 700;
    opacity: 0.6;
    border-bottom: 1px solid currentColor;
    padding-bottom: 0.3rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Placeholder document : icône cliquable vers le PDF ── */
a.pub-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

a.pub-thumb.placeholder::before {
    content: "📄";
    font-size: 2rem;
    opacity: 0.55;
}

/* ── Bouton de changement de thème (mode dual-thème) ── */
#swag-theme-switcher {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    z-index: 9999;
}

#swag-theme-switcher button {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 2px solid currentColor;
    background: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s, transform 0.2s;
    line-height: 1;
    padding: 0;
}

#swag-theme-switcher button:hover {
    opacity: 1;
    transform: rotate(180deg);
}
