/* ===========================================
    Moin'Chella 2026 - Artists Castle Page
   CSS-drawn castle with window blinds
   =========================================== */

/* Custom Fonts */
@font-face {
    font-family: 'Laries';
    src: url('../fonts/laries.otf') format('opentype');
}

@font-face {
    font-family: 'MoonTime';
    src: url('../fonts/MoonTime.ttf') format('truetype');
}

@font-face {
    font-family: 'BebasNeue';
    src: url('../fonts/BebasNeue-Regular.ttf') format('truetype');
}

/* ===== Main Container ===== */
.artists-castle {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(180deg, 
        var(--festival-dark) 0%,
        var(--festival-secondary) 100%
    );
    overflow-x: hidden;
    padding-top: 0;
}

.festival-page-status-badge {
    position: fixed;
    top: calc(var(--festival-navbar-height) + 1rem);
    right: clamp(1rem, 3vw, 2rem);
    z-index: 1100;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

/* ===== Artists Background ===== */
.sun-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/fond_artistes.png');
    background-position: top center;
    background-size: 100vw auto;
    background-repeat: no-repeat;
    z-index: 1;
}

/* ===== Title Container ===== */
.artists-title-container {
    position: absolute;
    top: calc(var(--festival-navbar-height) + 5vw + 1.35rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 5; /* Lower than castle-front-overlay (z-index: 12) so text goes behind */
    text-align: center;
    pointer-events: none;
}

.artists-title {
    font-family: 'Laries', 'Poppins', sans-serif;
    font-size: clamp(2.5rem, 10vw, 10rem);
    color: white;
    text-shadow: 
        0 0 18px rgba(31, 62, 68, 0.82),
        0 0 36px rgba(47, 111, 115, 0.72),
        0 0 58px rgba(85, 143, 134, 0.52);
    margin: 0;
    line-height: 1;
    transform: rotate(-10deg);
}

.artists-date {
    font-family: 'BebasNeue', sans-serif;
    font-size: clamp(8rem, 36vw, 36rem);
    color: var(--festival-cream-light);
    position: absolute;
    top: -18%;
    left: 56%;
    transform: translateX(-50%);
    z-index: -1;
    line-height: 0.8;
    opacity: 0.7;
    text-shadow: 
        0 0 18px rgba(242, 236, 229, 0.4),
        0 0 36px rgba(217, 201, 188, 0.28);
}

/* Standard widescreen (16:9) */
@media (min-aspect-ratio: 16/9) and (max-aspect-ratio: 21/9) {
    .artists-title-container {
        top: calc(64px + 4vw + 1.3rem);
    }

    .artists-title {
        font-size: clamp(2rem, 8vw, 7.2rem);
    }

    .artists-date {
        top: -16%;
        font-size: clamp(6rem, 26vw, 22rem);
    }
}

/* Taller screens where aspect ratio drops (prevent date from growing) */
@media (max-aspect-ratio: 16/9) and (min-height: 900px) {
    .artists-date {
        font-size: clamp(6rem, 22vw, 20rem);
        top: -14%;
    }
}

/* ===== Castle Structure ===== */
.castle-structure {
    position: relative;
    /* z-index plus haut que le mur */
    z-index: 15;
    margin-top: 20vw;
}

/* ===== Castle Roof (single unified element) ===== */
.castle-roof {
    width: 100%;
    max-width: 1750px;
    margin: 0 auto;
    /* Hauteur responsive basée sur la largeur, avec min/max */
    height: clamp(300px, 44vw, 680px);
    background: linear-gradient(to top, var(--festival-dark) 0%, var(--festival-secondary) 100%);
    position: relative;
    z-index: 10;
    /* Keep roof/wall junction aligned: reduce excessive overlap into the wall block */
    margin-bottom: clamp(-368px, calc(-44vw * 0.54 - 8px), -178px);
    
    /* 
     * Forme parfaitement symétrique autour de 50%
     * Cheminées : toutes 2% de large, toutes à Y=11%
     * Points miroirs : X gauche + X droite = 100%
     */
    clip-path: polygon(
        /* === TOUR GAUCHE === */
        /* Pentes symétriques : ratio ΔY/ΔX = 2.75 (comme la pente intérieure) */
        9% 46%,           /* Coin extérieur bas */
        15% 29%,          /* Haut pente extérieure (avant cheminée 1) */
        15% 11%,          /* Cheminée 1 - montée */
        17% 11%,          /* Cheminée 1 - haut (2% large) */
        17% 23%,          /* Cheminée 1 - descente (pente continue) */
        20% 15%,          /* Toit plat - début */
        28% 15%,          /* Toit plat - fin (8% large) */
        32% 26%,          /* Pente intérieure */
        32% 11%,          /* Cheminée 2 - montée */
        34% 11%,          /* Cheminée 2 - haut (2% large) */
        34% 28%,          /* Descente vers barre */
        
        /* === BARRE CENTRALE === */
        66% 28%,          /* Barre - côté droit */
        
        /* === TOUR DROITE (miroir exact) === */
        66% 11%,          /* Cheminée 2 - montée */
        68% 11%,          /* Cheminée 2 - haut (2% large) */
        68% 26%,          /* Pente intérieure */
        72% 15%,          /* Toit plat - début */
        80% 15%,          /* Toit plat - fin (8% large) */
        83% 23%,          /* Cheminée 1 - descente (pente continue) */
        83% 11%,          /* Cheminée 1 - haut (2% large) */
        85% 11%,          /* Cheminée 1 - montée */
        85% 29%,          /* Haut pente extérieure (avant cheminée 1) */
        91% 46%,          /* Coin extérieur bas */
        
        /* === CREUX POUR LE MUR === */
        68% 46%,          /* Retour vers creux droite */
        70% 55%,          /* Creux bas droite */
        30% 55%,          /* Creux bas gauche */
        32% 46%           /* Retour vers départ */
    );
    
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

/* ===== Castle Wall ===== */
.castle-wall {
    /* Lighter gradient for wall - fades to dark at bottom */
    background: linear-gradient(180deg,
        var(--festival-sage) 0%,
        var(--festival-mist) 30%,
        var(--festival-cream-light) 70%,
        var(--festival-dark) 100%
    );
    position: relative;
    z-index: 5;
    padding: 2rem 1rem;
    /* Moins large que le toit pour que les tours dépassent */
    width: 86%;
    max-width: 1450px;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile portrait / fort zoom : mur et toit pleine largeur */
@media (max-width: 576px), (max-aspect-ratio: 3/4) {
    .castle-roof {
        /* Toit pleine largeur - ajuster le clip-path pour couvrir les bords */
        clip-path: polygon(
            /* Tours qui dépassent sur les côtés */
            0% 46%,
            6% 29%,
            6% 11%,
            8% 11%,
            8% 23%,
            12% 15%,
            22% 15%,
            27% 26%,
            27% 11%,
            29% 11%,
            29% 28%,
            71% 28%,
            71% 11%,
            73% 11%,
            73% 26%,
            78% 15%,
            88% 15%,
            92% 23%,
            92% 11%,
            94% 11%,
            94% 29%,
            100% 46%,
            /* Creux pour le mur - plus large */
            78% 46%,
            80% 55%,
            20% 55%,
            22% 46%
        );
    }
    
    .castle-wall {
        width: 100%;
        max-width: none;
    }
}

.wall-spacer {
    height: 4vw;
    min-height: 20px;
    max-height: 60px;
}

/* ===== Artist Grid ===== */
.artist-grid-container {
    width: 100%;
    padding: 0 2rem;
    box-sizing: border-box;
}

.artist-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem 8rem; /* vertical horizontal - plus d'espace horizontal pour les volets */
    max-width: 1200px;
    margin: 0 auto;
}

.artist-grid-item {
    /* Largeur fixe pour chaque artiste - max 5 par ligne */
    width: 180px;
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .festival-page-status-badge {
        top: calc(var(--festival-navbar-height) + 0.75rem);
        right: 0.75rem;
    }
}

.artist-window-trigger {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    display: block;
    cursor: pointer;
    text-align: inherit;
}

.artist-window-trigger:focus-visible,
.artist-name-below:focus-visible {
    outline: 3px solid var(--festival-primary);
    outline-offset: 4px;
}

/* Responsive grid */
@media (max-width: 768px) {
    .artist-grid {
        gap: 1.5rem;
    }
    
    .artist-grid-item {
        width: 150px;
    }
}

@media (max-width: 576px) {
    .artist-grid-container {
        padding: 0 0.25rem;
    }

    .artist-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 116px));
        justify-content: center;
        column-gap: clamp(2.5rem, 14vw, 3.5rem);
        row-gap: 1.5rem;
    }

    .artist-grid-item {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 380px) {
    .artist-grid {
        grid-template-columns: repeat(2, minmax(0, 108px));
        column-gap: clamp(2rem, 11vw, 2.6rem);
    }
}

/* ===== Window Frame & Blinds ===== */
.window-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    perspective: 800px;
    border: 4px solid var(--festival-dark);
    border-radius: 4px;
    background: #fff;
    overflow: visible;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(31, 62, 68, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.artist-window-trigger:hover .window-frame {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(31, 62, 68, 0.25);
}

.window-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

.artist-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.artist-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--festival-mist) 0%, var(--festival-sage) 100%);
    color: white;
    font-size: 2.5rem;
}

/* Artist Name - displayed below the window */
.artist-name-below {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.82rem, 1.45vw, 1.2rem);
    font-weight: 700;
    color: #ffffff;
    background: var(--festival-secondary);
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    text-align: center;
    text-shadow: none;
    margin-top: 0.5rem;
    margin-bottom: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.2;
    border: 0;
    cursor: pointer;
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.artist-name-below:hover {
    background: var(--festival-dark);
    transform: translateY(-2px);
}

/* Show name when blinds open */
/* Name always visible at bottom */

/* Window Blinds (Shutters) */
.blind {
    position: absolute;
    top: -4px;
    width: calc(50% + 2px);
    height: calc(100% + 8px);
    background: var(--festival-secondary);
    border: 3px solid var(--festival-dark);
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-sizing: border-box;
}

.blind-left {
    left: -4px;
    transform-origin: left center;
    border-radius: 3px 0 0 3px;
}

.blind-right {
    right: -4px;
    transform-origin: right center;
    border-radius: 0 3px 3px 0;
}

/* Slats pattern */
.blind-slats {
    width: 70%;
    height: 75%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 5px,
        var(--festival-dark) 5px,
        var(--festival-dark) 7px
    );
    opacity: 0.3;
}

/* Blind open states */
.window-frame.blinds-open .blind-left,
.window-frame:hover .blind-left {
    transform: rotateY(-120deg);
}

.window-frame.blinds-open .blind-right,
.window-frame:hover .blind-right {
    transform: rotateY(120deg);
}

/* Mobile */
@media (hover: none) {
    .window-frame:hover .blind-left,
    .window-frame:hover .blind-right {
        transform: none;
    }
    
    .window-frame.blinds-open .blind-left {
        transform: rotateY(-120deg);
    }

    .window-frame.blinds-open .blind-right {
        transform: rotateY(120deg);
    }
}

/* ===== Artist Modal ===== */
.artist-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.artist-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.artist-modal-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(199, 53, 45, 0.25), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(31, 62, 68, 0.3), transparent 40%),
        rgba(7, 16, 19, 0.78);
    backdrop-filter: blur(5px);
}

.artist-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(980px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    background:
        linear-gradient(120deg, rgba(31, 62, 68, 0.97) 0%, rgba(44, 88, 95, 0.95) 48%, rgba(247, 239, 214, 0.97) 100%);
}

.artist-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(7, 16, 19, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.artist-modal-close:hover {
    background: var(--festival-primary);
    transform: scale(1.08);
}

.artist-modal-content {
    display: grid;
    grid-template-columns: minmax(230px, 320px) 1fr;
    gap: 2.2rem;
    padding: clamp(1.3rem, 2.4vw, 2.6rem);
}

.artist-modal-identity {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.artist-modal-image-shell {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(44, 88, 95, 0.95), rgba(31, 62, 68, 0.95));
    border: 2px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 14px 30px rgba(5, 10, 12, 0.4);
    position: relative;
}

.artist-modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.artist-modal-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 3rem;
}

.artist-modal-name {
    margin: 0;
    font-family: 'BebasNeue', sans-serif;
    letter-spacing: 0.06em;
    font-size: clamp(1.8rem, 2.7vw, 2.5rem);
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 0 18px rgba(0, 0, 0, 0.3);
}

.artist-modal-description {
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1rem, 1.15vw, 1.14rem);
    line-height: 1.75;
    white-space: pre-line;
    margin-top: 0.25rem;
    padding: 0.5rem 0;
}

.artist-modal-description.is-empty {
    color: rgba(255, 255, 255, 0.78);
    font-style: italic;
}

body.artist-modal-open {
    overflow: hidden;
}

/* ===== Sun Reflection ===== */
.sun-reflection {
    position: relative;
    z-index: 2;
    margin-top: -3vw;
}

.sun-reflection img {
    width: 100%;
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .castle-structure {
        margin-top: 30vw;
    }

    .artists-title {
        font-size: clamp(2.5rem, 10vw, 8rem);
    }
}

/* Ultrawide screens (21:9 and wider) */
@media (min-aspect-ratio: 21/9) {
    .artists-title-container {
        top: calc(52px + 2.5vw + 1.3rem);
    }

    .artists-date {
        top: -15%;
        font-size: clamp(6rem, 28vw, 24rem);
    }
}

@media (max-width: 768px) {
    .castle-structure {
        margin-top: 35vw;
    }

    .artists-title-container {
        top: calc(60px + 5vw + 1.55rem);
    }

    .window-frame {
        border-width: 3px;
        max-width: 150px;
    }

    .blind {
        border-width: 2px;
    }
}

@media (max-width: 576px), (max-aspect-ratio: 3/4) {
    .castle-structure {
        margin-top: 40vw;
    }

    .wall-spacer {
        height: 3vw;
        min-height: 15px;
    }

    .artist-placeholder {
        font-size: 1.8rem;
    }
    
    .window-frame {
        max-width: 116px;
    }
}

@media (max-width: 576px) {
    .window-frame {
        max-width: none;
    }

    .blind {
        top: -3px;
        width: calc(50% + 1px);
        height: calc(100% + 6px);
    }

    .window-frame.blinds-open .blind-left {
        transform: rotateY(-104deg);
    }

    .window-frame.blinds-open .blind-right {
        transform: rotateY(104deg);
    }

    .artist-name-below {
        font-size: 0.78rem;
        padding: 0.42rem 0.55rem;
    }
}

@media (max-width: 380px) {
    .artist-name-below {
        font-size: 0.74rem;
        padding: 0.38rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .artist-modal-dialog {
        width: calc(100% - 1.2rem);
        border-radius: 18px;
    }

    .artist-modal-content {
        grid-template-columns: 1fr;
        gap: 1.35rem;
        padding-top: 3.2rem;
    }

    .artist-modal-identity {
        align-items: center;
        text-align: center;
    }

    .artist-modal-image-shell {
        max-width: min(260px, 74vw);
    }

    .artist-modal-description {
        margin-top: 0;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.24);
    }
}

/* ===== Castle Front Overlay (for text parallax) ===== */
.castle-front-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/chato_header_front.png');
    background-position: top center;
    background-size: 100vw auto;
    background-repeat: no-repeat;
    z-index: 12;
    pointer-events: none;
}

/* ===== Parallax Animation ===== */
.sun-background {
    will-change: background-position;
}

.castle-front-overlay {
    will-change: background-position;
}

.artists-title-container {
    will-change: transform;
}

