/* =====================================================================
   homepage — style.css  (spécifique à la homepage UNIQUEMENT)
   ---------------------------------------------------------------------
   Le rendu de base (body, navbar, nav-link, theme-switcher, dropdown,
   hero, sections, cards, card-button, .btn/.btn-primary, badges, footer,
   responsive global) est fourni par global-theme.css.
   Ce fichier ne garde QUE ce que le thème global ne couvre pas, et
   pointe toutes ses couleurs vers les tokens (var(--…)).
   ===================================================================== */

/* — Lien "accueil" dans la navbar (non couvert par le thème) — */
.home-link {
    padding: 0.5rem 0.75rem;
    color: var(--text-soft);
}
.home-link svg { transition: transform var(--t-fast); }
.home-link:hover { color: var(--accent); }
.home-link:hover svg { transform: scale(1.15) translateY(-2px); }

/* — Icône LinkedIn (effet de survol propre à la homepage) — */
.linkedin-link:hover svg { transform: scale(1.1); }

/* ---------------------------------------------------------------- */
/*  THÈME AUTO — badge (deux logos imbriqués dans un petit rond)    */
/*  Le thème global affiche une icône "écran" pour l'état auto ;    */
/*  sur la homepage on la remplace par un badge qui superpose le    */
/*  soleil et la lune dans un petit rond en bas à droite.           */
/* ---------------------------------------------------------------- */

/* Le composant .auto-badge ne s'affiche QUE dans l'état auto. */
/* (global-theme.css : `:root[data-theme="auto"] .auto-icon { display:block }`) */
.auto-badge {
    position: relative;
    display: none;
    width: 20px;
    height: 20px;
    line-height: 0;
}

/* Glyphe de fond : un disque mi-clair / mi-sombre (les deux thèmes). */
.auto-badge-base {
    display: block;
    width: 20px;
    height: 20px;
    color: var(--text-soft);
    opacity: 0.9;
}

/* Le petit rond en bas à droite contenant les deux logos imbriqués. */
.auto-badge-dot {
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 15px;
    height: 15px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-pill);
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Les deux logos sont superposés (même cellule de grille) et imbriqués :
   le soleil occupe la moitié gauche, la lune la moitié droite, via clip. */
.auto-badge-dot-sun,
.auto-badge-dot-moon {
    grid-area: 1 / 1;
    width: 11px;
    height: 11px;
}
.auto-badge-dot-sun  { color: var(--warning); clip-path: inset(0 50% 0 0); }
.auto-badge-dot-moon { color: var(--accent);  clip-path: inset(0 0 0 50%); }

/* Le bouton est rond et un peu serré : on laisse le badge déborder. */
.theme-toggle { overflow: visible; }
.theme-toggle:hover .auto-badge-base { color: var(--accent); opacity: 1; }

/* ---------------------------------------------------------------- */
/*  PAGES PROJET (vue détaillée d'un projet)                        */
/* ---------------------------------------------------------------- */
.project-content { max-width: 900px; margin: 0 auto; }

.project-section {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}
.project-section h2 {
    color: var(--heading);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
}
.project-section p {
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Fonctionnalités : liste verticale lisible (une par ligne). */
.features-list { list-style: none; padding: 0; }
.features-list li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background-color: var(--accent-tint);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background var(--t-fast), transform var(--t-fast);
}
.features-list li:hover {
    background-color: var(--accent-tint);
    transform: translateX(5px);
}

/* Technologies : badges compacts, plusieurs par ligne, regroupables par thème. */
.tech-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.tech-list li {
    display: inline-flex; align-items: center;
    padding: 0.35rem 0.75rem;
    background-color: var(--accent-tint);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.85rem; font-weight: 600;
    transition: transform var(--t-fast), background var(--t-fast);
}
.tech-list li:hover {
    background-color: var(--accent-tint);
    transform: translateY(-2px);
}
/* Regroupement thématique optionnel des technologies. */
.tech-group { margin-bottom: 0.9rem; }
.tech-group:last-child { margin-bottom: 0; }
.tech-group-label {
    display: block;
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.demo-container {
    padding: 2rem;
    background-color: var(--surface-sunken);
    border-radius: var(--radius);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-strong);
}
.demo-container p { color: var(--text-muted); font-style: italic; }

/* Bouton retour en haut d'une page projet */
.project-back {
    max-width: 900px;
    margin: 0 auto 1.5rem;
}

/* Galerie de visuels d'une page projet (auto-détectés, cf. project_images()) */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.project-gallery img {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background-color: var(--surface-sunken);
}

.project-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

/* Variante de bouton non fournie par le thème (le thème a .btn / .btn-primary / .btn-ghost) */
.btn-secondary {
    background-color: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}
.btn-secondary:hover {
    background-color: var(--accent);
    color: var(--on-accent);
    transform: translateY(-2px);
}

/* ---------------------------------------------------------------- */
/*  PLAN DU SITE (sitemap)                                          */
/* ---------------------------------------------------------------- */
.sitemap-list { list-style: none; padding: 0; }
.sitemap-list li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background-color: var(--accent-tint);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background var(--t-fast), transform var(--t-fast);
}
.sitemap-list li:hover { transform: translateX(5px); }
.sitemap-list a { color: var(--accent); font-weight: 500; }
.sitemap-list a:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------------------------------------------------------------- */
/*  RESPONSIVE (uniquement les éléments propres à la homepage)      */
/*  navbar / hero / cards : déjà gérés par global-theme.css         */
/* ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .project-section { padding: 1.5rem; }
    .project-section h2 { font-size: 1.5rem; }
    .project-actions { flex-direction: column; }
    .project-actions .btn { width: 100%; text-align: center; }
}

/* ---------------------------------------------------------------- */
/*  CARTES CLIQUABLES (projets perso → modale)                      */
/* ---------------------------------------------------------------- */
.card-clickable { cursor: pointer; }
.card-clickable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
/* Sur une carte cliquable, tout le bloc déclenche la modale ; seul le
   bouton "Visiter le projet" (vrai lien) reste cliquable indépendamment
   (le JS stoppe la propagation pour ne pas ouvrir la modale). */
.card-clickable .card-button-external { cursor: pointer; }

/* ---------------------------------------------------------------- */
/*  MODALE DE DÉTAILS DE PROJET                                     */
/* ---------------------------------------------------------------- */
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 2.5rem);
}
.project-modal.open { display: flex; }

/* Empêche le scroll de l'arrière-plan quand la modale est ouverte. */
body.modal-open { overflow: hidden; }

.project-modal-overlay {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, #11151c 62%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.project-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: min(88vh, 900px);
    overflow-y: auto;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.28s var(--ease) both;
}
@keyframes modalPop {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.project-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    color: var(--text-soft);
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.project-modal-close:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

/* Image en tête de modale. Si aucune image n'est fournie (ou si elle ne
   charge pas), tout le bloc média est masqué (pas de placeholder). */
.project-modal-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
}
.project-modal-media[hidden] { display: none; }

/* --- Carrousel d'images de la modale --- */
.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.35s var(--ease);
}
.carousel-slide {
    position: relative;
    flex: 0 0 100%;
    height: 100%;
    overflow: hidden;
}
/* Image affichée entière (jamais rognée), fond flouté pour combler. */
.carousel-slide-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.carousel-slide-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(18px) saturate(1.1);
    transform: scale(1.15);
    opacity: 0.45;
}
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    backdrop-filter: blur(2px);
    color: var(--text-soft);
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.carousel-nav:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.carousel-nav[hidden] { display: none; }
.carousel-prev { left: 0.85rem; }
.carousel-next { right: 0.85rem; }
.carousel-dots {
    position: absolute;
    bottom: 0.7rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    gap: 0.45rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, #11151c 45%, transparent);
}
.carousel-dots[hidden] { display: none; }
.carousel-dots button {
    width: 9px;
    height: 9px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: color-mix(in srgb, #ffffff 55%, transparent);
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast);
}
.carousel-dots button.active {
    background: #ffffff;
    transform: scale(1.25);
}

.project-modal-body { padding: clamp(1.4rem, 3vw, 2rem); }
.project-modal-body h2 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.5rem, 3vw, 1.9rem);
}
.project-modal-subtitle {
    margin: 0 0 1.2rem;
    color: var(--text-muted);
    font-size: 1.02rem;
}
.project-modal-content {
    color: var(--text-soft);
    line-height: 1.8;
    margin: 0 0 2rem;
}
/* Texte de présentation aéré : un <p> par paragraphe (retours à la ligne
   du champ 'content' de config.php, rendus par homepage.js). */
.project-modal-content p { margin: 0 0 1.1rem; }
.project-modal-content p:last-child { margin-bottom: 0; }

.project-modal-block { margin-bottom: 2rem; }
.project-modal-block[hidden] { display: none; }
.project-modal-block h3 {
    margin: 0 0 0.8rem;
    font-size: 1.05rem;
    color: var(--heading);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.4rem;
}

.project-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.5rem;
}
.project-modal-actions[hidden] { display: none; }

@media (max-width: 768px) {
    .project-modal-media { aspect-ratio: 16 / 9; }
}

/* — Sous-section "Écosystème Home Assistant" (Projets Personnels) — */
.subsection-header {
    margin: 2.5rem 0 1rem;
    padding-left: 0.9rem;
    border-left: 3px solid var(--accent);
}
.subsection-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}
.subsection-header h3 svg { color: var(--accent); }
.subsection-header .section-description { margin: 0.25rem 0 0; }

/* Carte mère : pleine largeur, bord accentué, étiquette "Projet principal" */
.ha-parent { margin-bottom: 0.4rem; }
.ha-parent .card {
    position: relative;
    width: 100%;
    border-color: var(--accent);
}
.ha-parent .card::after {
    content: 'Projet principal';
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.9;
}

/* Addons : rattachés visuellement à la carte mère par un connecteur */
.ha-children {
    position: relative;
    padding: 0.9rem 0 0 1.6rem;
}
.ha-children::before {
    content: '';
    position: absolute;
    left: 0.55rem;
    top: -0.3rem;
    bottom: 1.2rem;
    width: 2px;
    background: var(--accent);
    opacity: 0.35;
    border-radius: 2px;
}
.ha-children .card h3 { font-size: 1.02rem; }
@media (max-width: 640px) {
    .ha-children { padding-left: 1rem; }
}

/* — Contacts dans le footer — */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.85;
    transition: color var(--t-fast, 0.2s), opacity var(--t-fast, 0.2s);
}
.footer-links a:hover { color: var(--accent); opacity: 1; }
.footer-links span { opacity: 0.4; }
