/* =========================================
   VARIABLES GLOBALES (Design System)
========================================= */
:root {
    --bg-color: #ffffff; /* Fond blanc pur */
    --text-color: #111111; /* Noir profond */
    --border-color: #111111;
    --font-main: 'Montserrat', sans-serif; /* Ta typo globale */
    --font-mono: 'Space Mono', monospace; /* Pour le code/données */
    --border-thickness: 2px; /* Lignes franches façon Nothing */
}

/* =========================================
   RESET ET BASE RESPONSIVE
========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.5;
    /* Un padding fluide qui s'adapte à l'écran : 20px sur mobile, 5% sur grand écran */
    padding: clamp(20px, 5vw, 50px); 
}

/* =========================================
   TYPOGRAPHIE
========================================= */
h1, h2, h3 {
    font-weight: 700;
    text-transform: uppercase;
}

/* =========================================
   HEADER & NAVIGATION
========================================= */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: var(--border-thickness) solid var(--border-color);
    flex-wrap: wrap; /* Passe à la ligne sur tout petit écran */
    gap: 15px;
}

.logo {
   width: 250px;
   height: auto;
   transition: all 0.2s ease;
}

.logo:hover {
    transform: scale(1.1); /* Légère mise en avant au survol */
    cursor: pointer;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    border: var(--border-thickness) solid var(--border-color);
    padding: 8px 16px;
    transition: all 0.2s ease;
}

nav a:hover {
    background-color: var(--text-color);
    color: var(--bg-color); /* Effet d'inversion des couleurs au survol */
}

/* =========================================
   SECTION INTRO & LIGNES
========================================= */
/* --- NOUVEAU HERO --- */
.hero-container {
    padding: 80px 0;
    border-bottom: var(--border-thickness) solid var(--border-color);
    margin-bottom: 50px;
}

.hero-main {
    margin-bottom: 60px;
}

.hero-glitch-text {
    font-size: clamp(2rem, 8vw, 5rem); /* Taille adaptative */
    line-height: 0.9;
    font-weight: 900;
    margin: 0;
    letter-spacing: -2px;
}

.hero-glitch-text.emphasis {
    color: #f39200; /* Le rouge pour le mot clé */
    margin-bottom: 20px;
}

.sub-intro {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: #666;
    text-transform: uppercase;
}

/* Barre de données style technique */
.hero-data-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: var(--border-thickness) solid var(--border-color);
    background-color: var(--bg-color);
}

.data-point {
    padding: 20px;
    border-right: var(--border-thickness) solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.data-point:last-child { border-right: none; }

.data-point .label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 5px;
}

.data-point .value {
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1.2rem;
}

.status-online { color: #00FF00; }

/* Responsive mobile */
@media (max-width: 768px) {
    .hero-data-bar { grid-template-columns: 1fr; }
    .data-point { border-right: none; border-bottom: var(--border-thickness) solid var(--border-color); }
    .data-point:last-child { border-bottom: none; }
}

.separator-line {
    border-bottom: var(--border-thickness) solid var(--border-color);
    margin-bottom: 40px;
}

/* =========================================
   BARRE DE RECHERCHE & TRI
========================================= */
.search-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Pour s'adapter sur téléphone */
}

.search-input {
    flex: 1; /* La barre prend toute la place restante */
    min-width: 250px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    background-color: var(--bg-color);
    border: var(--border-thickness) solid var(--border-color);
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    box-shadow: 6px 6px 0px var(--border-color);
    transform: translate(-2px, -2px);
}

.search-input::placeholder {
    color: #888;
    font-weight: 400;
}

/* Le menu de Tri */
.sort-select {
    padding: 0 20px;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    background-color: var(--bg-color);
    border: var(--border-thickness) solid var(--border-color);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-select:hover, .sort-select:focus {
    box-shadow: 4px 4px 0px var(--border-color);
    transform: translate(-2px, -2px);
}

/* =========================================
   TAGS (Filtres de catégories)
========================================= */
.tags-container {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap; /* Passe à la ligne sur mobile */
}

.tag-btn {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 16px;
    border: var(--border-thickness) solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

/* Effet brutaliste au survol et quand le tag est actif */
.tag-btn:hover, .tag-btn.active {
    background-color: var(--text-color);
    color: var(--bg-color);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    transform: translate(-2px, -2px);
}

/* =========================================
   GRILLE D'ALIMENTS (Magie Responsive)
========================================= */
.food-grid {
    display: grid;
    /* C'est ICI que la magie opère : la grille crée autant de colonnes de 200px minimum qu'elle peut, et s'adapte à l'espace restant */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Les Cartes Aliments */
.food-card {
    border: var(--border-thickness) solid var(--border-color);
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: var(--bg-color);
}

/* L'effet "Brutaliste" au survol */
.food-card:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    transform: translateY(-5px); /* Remonte légèrement */
}

.food-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.food-name {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.food-slogan {
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* =========================================
   VUE DÉTAIL ALIMENT & TOGGLE (Switch)
========================================= */
.detail-view {
    max-width: 800px;
    margin: 0 auto; /* Centre le contenu */
    animation: fadeIn 0.3s ease; /* Petite animation fluide */
}

/* Le bouton de retour */
.btn-back {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 30px;
    border: var(--border-thickness) solid var(--border-color);
    padding: 8px 16px;
    background: var(--bg-color);
    color: var(--text-color);
}
.btn-back:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

/* Le conteneur de l'interrupteur */
.toggle-container {
    display: flex;
    border: var(--border-thickness) solid var(--border-color);
    margin: 40px 0;
}

/* Les deux moitiés de l'interrupteur */
.toggle-btn {
    flex: 1;
    padding: 15px;
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    background: var(--bg-color);
    color: var(--text-color);
    transition: all 0.2s ease;
}

/* L'état "Actif" du bouton */
.toggle-btn.active {
    background: var(--text-color);
    color: var(--bg-color);
}

/* Zone de contenu qui change */
.view-section {
    display: none; /* Caché par défaut */
    padding: 20px;
    border: var(--border-thickness) dashed var(--border-color);
}
.view-section.active {
    display: block; /* Affiché si actif */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   LA MODALE (Fenêtre Pop-up)
========================================= */
.modal-overlay {
    display: none; /* Cachée par défaut */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px); /* Effet verre dépoli */
    z-index: 1000; /* Toujours au-dessus du reste */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Quand on ajoute la classe 'active' en JS, elle passe en flexbox (visible) */
.modal-overlay.active {
    display: flex; 
}

.modal-content {
    background: var(--bg-color);
    border: var(--border-thickness) solid var(--border-color);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    position: relative;
    /* L'ombre portée brutaliste typique : nette et sans flou */
    box-shadow: 10px 10px 0px var(--border-color); 
    animation: popUp 0.3s ease-out;
}

.btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-color);
}
.btn-close:hover {
    color: red;
}

@keyframes popUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.clickable-molecule {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    padding: 10px;
    margin-bottom: 10px;
}

.clickable-molecule:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    transform: translateX(5px);
}

.clickable-molecule .mol-name {
    font-weight: bold;
    display: block;
}

.clickable-molecule .mol-surnom {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    opacity: 0.7;
}

/* =========================================
   LE "POLISH" (Finitions Design)
========================================= */

/* 1. La sélection de texte Brutaliste */
/* Quand l'utilisateur surligne du texte, au lieu du bleu par défaut, on met du noir et blanc */
::selection {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* 2. Scrollbar personnalisée (Style Tech/Notion) */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
}
::-webkit-scrollbar-thumb {
    background: var(--text-color);
}
::-webkit-scrollbar-thumb:hover {
    background: #555; /* Un peu plus clair au survol */
}

/* 3. Animation de pulsation sur le Tag Actif */
@keyframes pulseBorder {
    0% { box-shadow: 4px 4px 0px rgba(0,0,0,0.2); }
    50% { box-shadow: 6px 6px 0px rgba(0,0,0,0.4); }
    100% { box-shadow: 4px 4px 0px rgba(0,0,0,0.2); }
}
.tag-btn.active {
    animation: pulseBorder 2s infinite ease-in-out;
}

/* 4. Effet d'apparition en cascade des cartes (Micro-interaction) */
.food-card {
    animation: slideUp 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}
/* On décale l'animation pour chaque carte (effet cascade) */
.food-card:nth-child(1) { animation-delay: 0.05s; }
.food-card:nth-child(2) { animation-delay: 0.1s; }
.food-card:nth-child(3) { animation-delay: 0.15s; }
.food-card:nth-child(4) { animation-delay: 0.2s; }
.food-card:nth-child(5) { animation-delay: 0.25s; }
.food-card:nth-child(n+6) { animation-delay: 0.3s; }

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   FOOTER
========================================= */
.main-footer {
    margin-top: 80px;
    padding-bottom: 40px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo {
    width: 400px;
    height: auto;
}

.footer-text {
    font-size: 0.85rem;
    color: #555;
    font-family: var(--font-mono);
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #888;
}

/* =========================================
   BOUTON RETOUR EN HAUT
========================================= */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--text-color);
    color: var(--bg-color);
    border: var(--border-thickness) solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: none; /* Caché par défaut */
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.back-to-top:hover {
    transform: translate(-4px, -4px);
    box-shadow: 4px 4px 0px var(--border-color);
}

/* Sur mobile, on le réduit un peu */
@media (max-width: 600px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* --- MANIFESTO ENHANCEMENTS --- */
.manifesto-view {
    max-width: 900px;
    margin: 0 auto;
}

.manifesto-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}

.manifesto-badge {
    font-family: var(--font-mono);
    background: var(--text-color);
    color: var(--bg-color);
    padding: 5px 10px;
    font-size: 0.8rem;
}

.manifesto-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 40px 0;
}

.manifesto-card {
    border: 1px solid var(--border-color);
    padding: 20px;
    background: #f9f9f9;
}

.manifesto-highlight {
    background: var(--text-color);
    color: var(--bg-color);
    padding: 60px 20px;
    text-align: center;
    margin: 40px 0;
    transform: rotate(-1deg);
}

.manifesto-highlight h2 {
    font-size: 2rem;
    margin: 0;
}

.detail-block {
    margin-bottom: 40px;
    border-left: 5px solid var(--text-color);
    padding-left: 20px;
}

.manifesto-footer {
    margin-top: 60px;
    text-align: center;
    font-family: var(--font-mono);
    opacity: 0.5;
}

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

/* --- NOUVEAU SCHÉMA TECHNIQUE --- */
.flow-container {
    margin: 50px 0;
    padding: 30px;
    border: 2px solid var(--border-color);
    background: #fdfdfd;
}

.tech-title {
    padding-bottom: 20px;
    font-weight: bold;
}

.flow-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.flow-connector-h {
    width: 30px;
    height: 2px;
    background: var(--text-color);
    position: relative;
    margin-top: 20px; /* Aligne avec le milieu des boîtes */
}

.flow-connector-h::after {
    content: '';
    position: absolute;
    right: 0;
    top: -4px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid var(--text-color);
}

/* Flèche Horizontale inversée ← */
.flow-connector-h.reverse::after {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 8px solid var(--text-color);
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

.step-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #888;
    margin-bottom: 5px;
}

.step-box {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
    background: white;
}

.step-box.highlight {
    background: var(--text-color);
    color: var(--bg-color);
}

.flow-arrow {
    font-size: 1.5rem;
    font-weight: bold;
    align-self: flex-end; /* Aligne avec les boîtes, pas les labels */
    padding-bottom: 12px;
}

.flow-break {
    flex-basis: 100%;
    display: flex;
    justify-content: flex-end; /* Centre la flèche verticalement entre les lignes */
    margin: 5px 0;
    padding-right: 225px;
}

/* Flèche Verticale ↓ */
.flow-connector-v {
    width: 2px;
    height: 30px;
    background: var(--text-color);
    position: relative;
}

.flow-connector-v::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -4px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid var(--text-color);
}

/* Version mobile : on empile tout verticalement */
@media (max-width: 768px) {
    .flow-wrapper { flex-direction: column; }
    .flow-arrow { transform: rotate(90px); padding: 0; }
    .flow-break { display: none; }
    .flow-step { min-width: 100%; }
}