/* ===============================
   VARIABLES & MISE EN PAGE GLOBALES
   =============================== */
:root {
    --bg: #f7f8fb;
    --panel: #ffffff;
    --ink: #0f172a;
    --muted: #667085;
    --accent: #2563eb;
    --border: #e3e6ef;
    --shadow: 0 16px 48px rgba(15, 23, 42, .08);

    --maxw: 1100px;
    --header: 64px;
    --sidebar: 300px;
    --safe: env(safe-area-inset-bottom, 0px);

    --radius: 14px;
    --radius-lg: 18px;
    --tap: 44px;
    --space: 16px;

    --fs: clamp(14px, 1.6vw, 16px);
    --fs-sm: clamp(12px, 1.2vw, 14px);
}

/* Reset lĆ©ger / base typographique */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font: var(--fs)/1.55 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

input,
select,
button {
    font: inherit;
}

/* ===============================
   BOUTONS & CHAMPS GĆ‰NĆ‰RIQUES
   =============================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f4f7fb;
    color: var(--ink);
    cursor: pointer;
}

.btn:hover {
    border-color: #cdd4e2;
}

/* Lang switch: show/hide language variants */
html[lang="fr"] .i18n-en {
    display: none;
}

html[lang="en"] .i18n-fr {
    display: none;
}

/* ===============================
   EN-TĆTE FIXE (VISIBLE PARTOUT)
   =============================== */
header {
    position: sticky;
    top: 0;
    min-height: var(--header);
    display: flex;
    align-items: center;
    background: color-mix(in oklab, var(--panel) 92%, transparent);
    backdrop-filter: saturate(140%) blur(6px);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

/* Conteneur interne centrĆ© */
.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    width: 100%;
    padding: 0 var(--space);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Logo / marque */
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.brand img {
    height: 26px;
    width: auto;
}

/* ===============================
   NAVIGATION PRINCIPALE (ONGLETS)
   =============================== */
nav.topnav {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.navlink {
    padding: 5px 5px;
    border-radius: 12px;
    min-height: var(--tap);
    display: inline-flex;
    align-items: center;
}

.navlink[aria-current="page"] {
    background: #eaf1ff;
    color: #2563eb;
}

/* Espace flexible pour pousser la toolbar Ć  droite */
.spacer {
    flex: 1;
}

/* ===============================
   OUTILS Dā€™EN-TĆTE (RECHERCHE, LANGUE, POLICE)
   =============================== */
.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.select,
.toolbar input {
    padding: 0px 2px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    min-height: var(--tap);
    color: var(--ink);
}

/* ===============================
   CONTENEURS DE PAGES
   =============================== */
main {
    min-height: 60vh;
}

.page {
    max-width: var(--maxw);
    margin: 24px auto;
    padding: 0 var(--space);
}

/* ===============================
   RĆ‰PERTOIRE : BARRE HAUTE & DISPOSITION
   =============================== */
.repo-topbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pill {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    min-height: 28px;
    display: inline-flex;
    align-items: center;
}

/* Layout gĆ©nĆ©ral de la zone RĆ©pertoire (sidebar + liste) */
.repo-layout {
    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
    gap: 16px;
}

@media (max-width: 960px) {
    .repo-layout {
        grid-template-columns: 1fr;
    }
}

/* Panneau latĆ©ral de filtres */
.sidebar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

/* Bloc individuel de filtres */
.facet {
    border-top: 1px dashed var(--border);
    padding: 10px 0;
}

.facet:first-child {
    border-top: none;
}

.facet h4 {
    margin: 0 0 8px;
    font-size: var(--fs-sm);
    color: #475569;
}

.facet .opt {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    min-height: 36px;
    line-height: 1.3;
    word-break: break-word;
}

/* ===============================
   GRILLE DE CARTES (LISTE DES Ć‰LĆ‰MENTS)
   =============================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
    cursor: pointer;
    min-height: 120px;
}

.card:hover {
    box-shadow: 0 14px 36px rgba(37, 99, 235, .12);
    border-color: #c7d2fe;
}

.card .title {
    font-style: italic;
    font-weight: 800;
}

.card .desc {
    color: var(--muted);
    font-size: var(--fs-sm);
    margin-top: 6px;
}

/* Image en haut de chaque carte (aperĆ§u de la technologie) */
.card-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-thumb-fallback {
    font-size: var(--fs-sm);
    color: var(--muted);
    padding: 8px;
    text-align: center;
}

/* Barre de pagination sous la grille */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.pagination-info {
    font-size: var(--fs-sm);
    color: var(--muted);
}

.pagination-btn[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* ===============================
   FICHE DĆ‰TAILLĆ‰E (MISE EN PAGE)
   =============================== */
.article {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 22px 22px 10px;
    border-bottom: 1px solid var(--border);
}

.hero h2 {
    margin: 0;
    font-size: clamp(22px, 3.2vw, 28px);
    line-height: 1.15;
    font-weight: 800;
}

.meta {
    color: var(--muted);
}

.section {
    padding: 16px 22px;
}

/* Grille principale de la fiche (description + image / mĆ©tadonnĆ©es) */
.sheet {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    padding: 16px;
}

@media (max-width: 900px) {
    .sheet {
        grid-template-columns: 1fr;
    }
}

.sheet .title {
    text-align: center;
    font-style: italic;
    font-weight: 800;
    font-size: clamp(22px, 3vw, 28px);
    margin: 6px 0 2px;
}

.sheet .keywords {
    text-align: center;
    color: #9aa3b2;
    font-size: var(--fs-sm);
    margin-bottom: 10px;
}

.sheet .line {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    color: #475569;
    margin: 12px 0 10px;
}

.sheet .label {
    color: #334155;
}

/* Bloc texte de description principale */
.sheet .desc h4 {
    margin: 0 0 8px;
    font-size: 18px;
}

.sheet .descbox {
    min-height: 200px;
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--ink);
    border: 1px solid var(--border);
    background: var(--panel);
    line-height: 1.5;
}

/* Bloc image + lĆ©gende */
.sheet .imagebox {
    border: 1px solid var(--border);
    border-radius: 16px;
    min-height: 200px;
    background: #eef1f6;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.sheet .imagebox img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.sheet .imgcap {
    color: #a0a7b2;
    font-size: 12px;
    text-align: right;
    margin-top: 6px;
}

/* Liste de mĆ©tadonnĆ©es (structure, site, langue, etc.) */
.sheet dl {
    margin: 0;
}

.sheet dt {
    float: left;
    clear: left;
    width: 120px;
    color: #5b6676;
}

.sheet dd {
    margin-left: 130px;
}

.sheet dd a {
    color: #2563eb;
    text-decoration: underline;
}

/* ===============================
   COMPORTEMENT SPĆ‰CIFIQUE Ć€ Lā€™ACCUEIL
   - Masquer la recherche du header uniquement sur lā€™accueil
   - Grande barre de recherche centrĆ©e
   =============================== */
body.home #q {
    display: none !important;
}

/* Section hĆ©ro de lā€™accueil */
.home-hero {
    display: grid;
    place-items: center;
    min-height: 58vh;
    padding: 24px;
}

.home-search {
    max-width: 720px;
    width: 100%;
    text-align: center;
}

.home-search h2 {
    font-size: clamp(24px, 3.5vw, 36px);
    margin: 0 0 12px;
    font-weight: 800;
}

.home-search p {
    color: #667085;
    margin: 0 0 18px;
}

/* Barre de recherche centrale (accueil) */
.home-search .search-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.home-search input[type="search"] {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    font-size: 16px;
}

.home-search button {
    padding: 14px 16px;
    border-radius: 14px;
}

/* ===============================
   RĆ‰PERTOIRE : FILTRES REPLIABLES
   =============================== */
.filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #eef2f7;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background .2s ease;
}

.filters-toggle:hover {
    background: #e2e8f0;
}

/* Variation de layout selon que la sidebar est visible ou non */
.repo-layout.with-filters {
    grid-template-columns: var(--sidebar) 1fr;
}

.repo-layout.no-filters {
    grid-template-columns: 1fr;
}

/* Sidebar masquĆ©e */
.sidebar.hidden {
    display: none;
}

/* ===============================
   PIED DE PAGE (NOUVELLE VERSION)
   =============================== */
.footer {
    background: #2a78a6;
    color: #fff;
    padding: 40px 60px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    border-radius: 20px;
    margin-top: 50px;
}

/* Colonnes du footer */
.footer-section h3 {
    margin-bottom: 12px;
    font-size: 22px;
    font-weight: bold;
}

.footer-section p,
.footer-section ul {
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 6px;
}

.footer-section ul li a {
    color: #e8f4fb;
    text-decoration: none;
}

.footer-section ul li a:hover {
    text-decoration: underline;
}

/* Lien Ā« retour en haut Ā» dans le footer */
.footer-top-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-sm);
    text-decoration: underline;
    margin-top: 12px;
    color: #f9fafb;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(249, 250, 251, 0.9);
    background: transparent;
}

.footer-top-link:hover {
    background: rgba(249, 250, 251, 0.12);
}

/* Bandeau infĆ©rieur du site */
.footer-bottom {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #4a4a4a;
}

/* ===============================
   MODALE Ā« SOUMETTRE UNE TECHNOLOGIE Ā»
   =============================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal.hidden {
    display: none;
}

/* BoĆ®te centrale de la modale */
.modal-box {
    background: white;
    padding: 32px;
    border-radius: 14px;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

/* Boutons de la modale */
.modal-box button,
#closeModal {
    padding: 10px 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.modal-box button:hover {
    opacity: 0.95;
}

/* ===============================
   FORMULAIRE Ā« SOUMETTRE Ā» (VERSION ID)
   =============================== */
#soumettreForm {
    max-width: 700px;
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

#soumettreForm h3 {
    margin-top: 30px;
    margin-bottom: 10px;
}

#soumettreForm label {
    display: grid;
    grid-template-columns: 220px 1fr;
    align-items: center;
    gap: 16px;
    font-weight: 600;
    color: #0d1722;
}

#soumettreForm input,
#soumettreForm textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #C8D0D8;
    font-size: 15px;
}

#soumettreForm textarea {
    height: 110px;
    resize: none;
}

/* Checkbox pleine largeur dans #soumettreForm */
#soumettreForm label.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: center;
}

/* ===============================
   FORMULAIRE Ā« SOUMETTRE Ā» (VERSION .soumettre-form)
   - Variante plus gĆ©nĆ©rique, liĆ©e Ć  la classe
   =============================== */
.soumettre-form {
    max-width: 720px;
    margin: 0 auto 40px;
    display: grid;
    row-gap: 16px;
}

.soumettre-form h3 {
    margin: 24px 0 8px;
}

.soumettre-form label {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 16px;
    align-items: center;
    font-weight: 600;
}

.soumettre-form input[type="text"],
.soumettre-form input[type="url"],
.soumettre-form input[type="email"],
.soumettre-form textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    font: inherit;
}

.soumettre-form textarea {
    min-height: 120px;
    resize: vertical;
}

/* Ligne de checkbox dans la version .soumettre-form */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

.checkbox-row input[type="checkbox"] {
    margin: 0;
}

.checkbox-row span {
    line-height: 1.4;
}

/* Ligne de validation (bouton envoyer) */
.submit-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.submit-btn {
    padding: 10px 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    width: auto;
}

.submit-btn:hover {
    opacity: 0.95;
}
