/* ================================
   Style pour la page Habitats ET les archives portfolio
   S'applique UNIQUEMENT aux listes, pas aux fiches individuelles
   ================================ */

/* Masquer le titre automatique du thème Brok */
.page-template-page-habitats .qodef-page-title,
body.tax-portfolio-category .qodef-page-title {
    display: none !important;
}

/* Masquer le titre WordPress par défaut */
.page-template-page-habitats .entry-title,
.page-template-page-habitats .page-title,
.page-template-page-habitats .entry-header,
body.tax-portfolio-category .entry-title,
body.tax-portfolio-category .page-title,
body.tax-portfolio-category .entry-header {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Supprimer l'espace du conteneur de titre */
body.page-template-page-habitats .entry-header,
body.page-template-page-habitats .page-header-wrapper,
body.page-template-page-habitats .hero-section,
body.tax-portfolio-category .entry-header,
body.tax-portfolio-category .page-header-wrapper,
body.tax-portfolio-category .hero-section {
    display: none !important;
}

/* S'assurer que le contenu commence en haut */
.page-template-page-habitats .entry-content,
.page-template-page-habitats .site-content,
.page-template-page-habitats article,
.page-template-page-habitats main,
body.tax-portfolio-category .entry-content,
body.tax-portfolio-category .site-content,
body.tax-portfolio-category article,
body.tax-portfolio-category main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Supprimer tout padding/margin en haut du wrapper */
.page-template-page-habitats .entry-content > *:first-child,
body.tax-portfolio-category .entry-content > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.habitats-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* En-tête de la page */
.page-header {
    text-align: center;
}

.page-header h1 {
    font-size: 3em;
    margin-bottom: 15px;
    color: #333;
    margin-top: 0;
}

.page-header p {
    font-size: 1.2em;
    color: #666;
}

/* Navigation interne avec ancres */
.habitats-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    position: sticky;
    top: 80px; /* Ajuste selon la hauteur de ton header */
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.habitats-nav .nav-link {
    padding: 12px 30px;
    background: white;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 2px solid transparent;
}

.habitats-nav .nav-link:hover {
    background: #333;
    color: white;
    border-color: #333;
}

/* Sections de catégories */
.habitat-section {
    margin-bottom: 80px;
    padding-top: 40px; /* Espace pour le scroll avec ancre */
}

.habitat-section h2 {
    font-size: 2.5em;
    margin-bottom: 40px;
    color: #333;
    border-bottom: 3px solid #333;
    padding-bottom: 15px;
}

/* Grille des projets portfolio */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.portfolio-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.portfolio-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.portfolio-thumbnail {
    width: 100%;
    height: 400px;
    overflow: hidden;
    background: #f0f0f0;
}

.portfolio-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: high-quality;
}

.portfolio-item h3 {
    padding: 20px 20px 10px;
    font-size: 1.4em;
    color: #333;
    margin: 0;
}

.portfolio-excerpt {
    padding: 0 20px 20px;
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .habitats-nav {
        flex-direction: column;
        position: static;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header h1 {
        font-size: 2em;
    }
    
    .habitat-section h2 {
        font-size: 1.8em;
    }
}

/* Smooth scroll pour les ancres */
html {
    scroll-behavior: smooth;
}

/* Ajustement pour le scroll avec offset (header fixe) */
.habitat-section {
    scroll-margin-top: 140px; /* Ajuste selon la hauteur de ton header + nav */
}