/**
 * Artisan Showcase Pro - Frontend Styles
 */

/* ==========================================================================
   Design tokens — single réalisation
   Valeurs par défaut = identité Deimat Peinture (navy/orange/Playfair+Inter).
   Sur un autre site (autre métier, autre client), surcharger ces variables
   dans le thème suffit à adapter tout le rendu — aucune modification de ce
   fichier n'est nécessaire.
   ========================================================================== */

.asp-single-realisation,
.asp-related,
.asp-cta-band,
.asp-wrapper {
    --asp-color-primary: #1e2a3a;
    --asp-color-primary-rgb: 30, 42, 58;
    --asp-color-accent: #D97B2B;
    --asp-color-accent-rgb: 217, 123, 43;
    --asp-color-bg-alt: #f7f4ef;
    --asp-font-heading: 'Playfair Display', Georgia, serif;
    --asp-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Conteneur de page unique (voir templates/single-realisation.php) : neutralise tout
   display grid/flex ou float que le thème pourrait appliquer aux enfants directs de
   #content, en ne lui laissant voir qu'un seul enfant. À l'intérieur, flux normal. */
.asp-realisation-page {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: none !important;
}

/* GeneratePress réserve 128px de padding vertical sur #content (.site-content),
   pensé pour son propre "page header" décoratif (voir .inside-page-header dans la
   même règle groupée côté thème). Notre hero (.asp-hero) joue déjà ce rôle
   visuellement : ce padding créait un espace vide au-dessus, en plus du hero.
   Ciblé uniquement sur nos pages via la classe body ajoutée nativement par
   WordPress, sans toucher au padding ailleurs sur le site. */
body.single-realisation .site-content {
    padding-top: 0 !important;
}

/* ==========================================================================
   Wrapper & Grid
   ========================================================================== */

.asp-wrapper {
    margin: 2rem 0;
}

.asp-grid {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
}

/* Columns */
.asp-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.asp-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.asp-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 1024px) {
    .asp-columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .asp-columns-3,
    .asp-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .asp-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .asp-columns-2,
    .asp-columns-3,
    .asp-columns-4 {
        grid-template-columns: 1fr;
    }
    
    .asp-grid {
        gap: 1rem;
    }
}

/* Layout: List */
.asp-layout-list {
    grid-template-columns: 1fr !important;
}

/* Layout: Masonry */
/* 
 * Note: CSS columns = ordre visuel "par colonnes" (effet journal)
 * plutôt que "ligne par ligne". Pour un ordre chronologique strict,
 * préférer le layout "grid".
 * Recommandation: masonry pour photos variées / portfolio créatif.
 */
.asp-layout-masonry {
    display: block; /* Override grid */
    column-gap: 2rem;
}

.asp-layout-masonry.asp-columns-2 {
    column-count: 2;
}

.asp-layout-masonry.asp-columns-3 {
    column-count: 3;
}

.asp-layout-masonry.asp-columns-4 {
    column-count: 4;
}

.asp-layout-masonry .asp-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 2rem;
    break-inside: avoid;
    page-break-inside: avoid; /* Fallback */
}

@media (max-width: 1024px) {
    .asp-layout-masonry.asp-columns-4 {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .asp-layout-masonry.asp-columns-3,
    .asp-layout-masonry.asp-columns-4 {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .asp-layout-masonry.asp-columns-2,
    .asp-layout-masonry.asp-columns-3,
    .asp-layout-masonry.asp-columns-4 {
        column-count: 1;
    }
}

/* ==========================================================================
   Item
   ========================================================================== */

.asp-item {
    position: relative;
    overflow: hidden;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); /* Plus subtil */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.asp-item:hover {
    transform: translateY(-6px); /* Lift plus marqué */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); /* Ombre douce mais visible */
}

.asp-item-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Image */
.asp-item-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3; /* Ratio cohérent pour look pro */
    background: #f5f5f5;
}

.asp-item-image a {
    display: block;
    height: 100%;
}

.asp-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease; /* Hover plus doux */
}

.asp-item:hover .asp-item-image img {
    transform: scale(1.08); /* Zoom subtil */
}

/* No image fallback */
.asp-item-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e9e9e9 100%);
    color: #999;
    transition: all 0.3s ease;
}

.asp-item-no-image .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.asp-no-image-text {
    font-size: 14px;
    font-weight: 500;
}

.asp-item:hover .asp-item-no-image {
    background: linear-gradient(135deg, #e9e9e9 0%, #ddd 100%);
    color: #666;
}

/* Content */
.asp-item-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.asp-item-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    line-height: 1.4;
}

.asp-item-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.asp-item-title a:hover {
    color: var(--asp-color-accent, #D97B2B);
}

.asp-item-location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #666;
}

.asp-item-location .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.asp-item-excerpt {
    flex: 1;
    margin: 0 0 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
}

.asp-item-excerpt p:last-child {
    margin-bottom: 0;
}

.asp-item-link {
    display: inline-flex;
    align-items: center;
    color: var(--asp-color-accent, #D97B2B);
    text-decoration: none;
    font-weight: 500;
    transition: gap 0.3s ease;
}

.asp-item-link:hover {
    gap: 0.5rem;
}

/* Layout: List specific */
.asp-layout-list .asp-item-inner {
    flex-direction: row;
}

.asp-layout-list .asp-item-image {
    width: 40%;
    aspect-ratio: unset;
}

.asp-layout-list .asp-item-content {
    width: 60%;
}

@media (max-width: 768px) {
    .asp-layout-list .asp-item-inner {
        flex-direction: column;
    }
    
    .asp-layout-list .asp-item-image,
    .asp-layout-list .asp-item-content {
        width: 100%;
    }
    
    .asp-layout-list .asp-item-image {
        aspect-ratio: 4 / 3;
    }
}

/* ==========================================================================
   Filters
   ========================================================================== */

.asp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.asp-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.asp-filter-btn {
    padding: 0.5rem 1rem;
    background: #fff;
    color: var(--asp-color-primary, #1e2a3a);
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.asp-filter-btn:hover {
    background: #fff;
    border-color: var(--asp-color-accent, #D97B2B);
    color: var(--asp-color-accent, #D97B2B);
}

.asp-filter-btn.active {
    background: var(--asp-color-accent, #D97B2B);
    border-color: var(--asp-color-accent, #D97B2B);
    color: #fff;
}

.asp-filter-btn.active:hover {
    background: var(--asp-color-accent, #D97B2B);
    color: #fff;
}

.asp-filter-select {
    padding: 0.5rem 2.2rem 0.5rem 1rem;
    background: #fff;
    color: var(--asp-color-primary, #1e2a3a);
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23767268' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
}

.asp-filter-select:hover,
.asp-filter-select:focus {
    border-color: var(--asp-color-accent, #D97B2B);
    outline: none;
}

.asp-filter-btn .count {
    opacity: 0.7;
    font-size: 0.85em;
}

/* Filter animations */
.asp-item.asp-hidden {
    display: none;
}

/* ==========================================================================
   Single Realisation
   ========================================================================== */

.asp-single-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.asp-gallery-image {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 4 / 3;
}

.asp-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.asp-gallery-image:hover img {
    transform: scale(1.05);
}

.asp-single-details {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.asp-single-details h3 {
    margin-top: 0;
}

.asp-single-details dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.75rem;
    margin: 0;
}

.asp-single-details dt {
    font-weight: 600;
    color: #333;
}

.asp-single-details dd {
    margin: 0;
    color: #555;
}

@media (max-width: 768px) {
    .asp-single-details dl {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .asp-single-details dt {
        margin-top: 0.5rem;
    }
}

/* ==========================================================================
   No Results
   ========================================================================== */

.asp-no-results {
    padding: 3rem;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.asp-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.asp-lightbox.active {
    display: flex;
}

.asp-lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.asp-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    z-index: 10000;
    transition: opacity 0.3s;
}

.asp-lightbox-close:hover {
    opacity: 0.7;
}

.asp-lightbox-nav button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 30px;
    padding: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.asp-lightbox-nav button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.asp-lightbox-prev {
    left: 20px;
}

.asp-lightbox-next {
    right: 20px;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.asp-loading {
    text-align: center;
    padding: 2rem;
}

.asp-loading:after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60%, 100% {
        content: "...";
    }
}

/* ==========================================================================
   Fil d'Ariane
   ========================================================================== */

.asp-breadcrumb {
    max-width: 1100px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    font-family: var(--asp-font-body);
    font-size: 0.85rem;
    color: #767268;
}

.asp-breadcrumb a {
    color: #767268;
    text-decoration: none;
}

.asp-breadcrumb a:hover {
    color: var(--asp-color-accent);
}

.asp-breadcrumb-sep {
    margin: 0 0.5em;
}

.asp-breadcrumb-current {
    color: var(--asp-color-primary);
}

.asp-breadcrumb-plain {
    color: #767268;
}

/* Dans le hero (navy), le fil d'Ariane passe en clair sur fond sombre. Spécificité
   plus élevée que .asp-breadcrumb seul, donc s'applique sans !important. */
.asp-hero .asp-breadcrumb {
    max-width: none;
    margin: 0 0 1.75rem;
    padding: 0;
}

.asp-hero .asp-breadcrumb a {
    color: rgba(255, 255, 255, 0.55);
}

.asp-hero .asp-breadcrumb a:hover {
    color: var(--asp-color-accent);
}

.asp-hero .asp-breadcrumb-sep {
    color: rgba(255, 255, 255, 0.25);
}

.asp-hero .asp-breadcrumb-current,
.asp-hero .asp-breadcrumb-plain {
    color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   Hero (single réalisation)
   ========================================================================== */

.asp-hero {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    box-sizing: border-box;
    background: var(--asp-color-primary);
    padding: 3rem 1.5rem 3.5rem;
}

.asp-hero-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.asp-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.asp-badge {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    background: rgba(var(--asp-color-accent-rgb), 0.1);
    color: var(--asp-color-accent);
    font-family: var(--asp-font-body);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid rgba(var(--asp-color-accent-rgb), 0.4);
    transition: background 0.2s ease, color 0.2s ease;
}

a.asp-badge:hover {
    background: var(--asp-color-accent);
    color: #fff;
}

.asp-badge--location {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.2);
}

a.asp-badge--location:hover {
    background: var(--asp-color-accent);
    color: #fff;
    border-color: var(--asp-color-accent);
}

.asp-hero-title {
    font-family: var(--asp-font-heading);
    font-weight: 700;
    font-size: clamp(1.9rem, 3.5vw, 2.75rem);
    line-height: 1.2;
    color: #fff;
    margin: 0 0 1rem;
    max-width: 22ch;
}

.asp-hero-intro {
    font-family: var(--asp-font-body);
    font-size: 1.05rem;
    line-height: 1.7;
    color: #b8c0cc;
    max-width: 60ch;
    margin: 0 0 1.75rem;
}

.asp-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    background: var(--asp-color-accent);
    color: #fff;
    font-family: var(--asp-font-body);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.asp-cta-button:hover {
    background: #c26a1f;
    color: #fff;
    transform: translateY(-1px);
}

/* ==========================================================================
   Avant/après, galerie, contenu — cadrage cohérent avec le hero
   ========================================================================== */

.asp-single-realisation .baf-slider {
    max-width: 850px;
    margin: 3rem auto 2.5rem;
}

.asp-single-realisation .asp-single-gallery,
.asp-single-realisation > .entry-content {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.asp-single-realisation .asp-single-gallery {
    border-radius: 12px;
}

.asp-single-realisation .asp-gallery-image {
    border-radius: 12px;
}

.asp-single-realisation > .entry-content {
    font-family: var(--asp-font-body);
    font-size: 1.05rem;
    line-height: 1.75;
    color: #333;
}

/* ==========================================================================
   Détails du projet — restylé en fiche (cohérent avec le reste du site)
   ========================================================================== */

.asp-single-realisation .asp-single-details {
    max-width: 1100px;
    margin: 2rem auto;
    margin-left: auto;
    margin-right: auto;
    padding: 1.75rem 2rem;
    background: var(--asp-color-bg-alt);
    border-left: 3px solid var(--asp-color-accent);
    border-radius: 0 12px 12px 0;
}

.asp-single-realisation .asp-single-details h3 {
    font-family: var(--asp-font-heading);
    color: var(--asp-color-primary);
    margin-top: 0;
}

.asp-single-realisation .asp-single-details dt {
    color: var(--asp-color-primary);
}

/* Recadrage identique pour la galerie/détails quand on est hors .asp-single-realisation
   (surcharge de thème qui n'ajoute pas cette classe sur <article>) */
.asp-single-gallery,
.asp-single-details {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Réalisations similaires
   ========================================================================== */

.asp-related {
    max-width: 1100px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.asp-related-title {
    font-family: var(--asp-font-heading);
    font-size: 1.6rem;
    color: var(--asp-color-primary);
    margin: 0 0 1.5rem;
}

.asp-related .asp-wrapper {
    margin: 0;
}

/* ==========================================================================
   Bandeau CTA de fin de page
   ========================================================================== */

.asp-cta-band {
    background: var(--asp-color-primary);
    padding: 3rem 1.5rem;
    text-align: center;
    margin-top: 3rem;
}

.asp-cta-band-text {
    font-family: var(--asp-font-heading);
    font-size: 1.4rem;
    color: #fff;
    margin: 0 0 1.25rem;
}

.asp-cta-band .asp-cta-button--band {
    background: var(--asp-color-accent);
}

.asp-cta-band .asp-cta-button--band:hover {
    background: #ffffff;
    color: var(--asp-color-primary);
}

/* ==========================================================================
   Navigation précédent / suivant
   ========================================================================== */

.navigation.post-navigation {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 1.5rem 1.5rem 0;
    border-top: 1px solid #e5e1d8;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-family: var(--asp-font-body);
}

.navigation.post-navigation .nav-subtitle {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #767268;
    margin-bottom: 0.25rem;
}

.navigation.post-navigation .nav-title {
    color: var(--asp-color-primary);
    font-weight: 500;
}

.navigation.post-navigation a:hover .nav-title {
    color: var(--asp-color-accent);
}
