/* =============================================
   SALA4.CSS — Exposició Audiovisual i Més
   ============================================= */

/* ——— LAYOUT ——— */
.cos_interior {
    display: flex;
    gap: 5%;
    height: 100%;
    overflow: hidden;
    padding: clamp(32px, 4.5vh, 52px) 0 clamp(10px, 1.8vh, 20px);
}

/* ——— ESQUERRA ——— */
.esquerra {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: clamp(6px, 1vh, 10px);
    overflow-y: auto;
    margin: clamp(10px, 1.8vh, 20px) 0;
}

.caixa-titol {
    font-size: clamp(0.78rem, 0.85vw, 0.92rem);
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5d2e0a;
    text-align: center;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e0d8;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    margin-top: clamp(8px, 1.2vh, 16px);
    margin-bottom: clamp(10px, 1.5vh, 18px);
    text-indent: 0 !important;
}

.caixa-text {
    background: #fdfcfb;
    padding: clamp(10px, 1.2vh, 15px);
    border-radius: 4px;
    border: 1px solid #e5e0d8;
    font-size: clamp(0.78rem, 0.82vw, 0.92rem);
    line-height: 1.6;
    color: #555;
    text-align: left;
    text-indent: 0;
    flex: none;
}

.caixa-text p { margin-bottom: 10px; }
.caixa-text p:last-child { margin-bottom: 0; }

/* ——— BOTONS SECCIÓ ——— */
.seccions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.boto-seccio {
    display: block;
    text-align: left;
    padding: 8px 12px;
    border: 1px solid #d5c9b8;
    border-radius: 4px;
    background-color: #faf8f4;
    color: #5d2e0a;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.80rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

.boto-seccio:hover {
    background-color: #f0e6da;
    border-color: #b8ac9e;
}

.boto-seccio.actiu {
    background-color: #5d2e0a;
    color: #fff;
    border-color: #5d2e0a;
}

/* ——— BOTONS NAVEGACIÓ ——— */
.botons {
    flex-shrink: 0;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.boto {
    display: block;
    text-align: center;
    padding: 7px 10px;
    border: 1px solid #d5c9b8;
    border-radius: 4px;
    background-color: #faf8f4;
    color: #5d2e0a;
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    transition: background 0.15s;
}

.boto:hover {
    background-color: #f0e6da;
    border-color: #b8ac9e;
}

/* ——— CENTRE ——— */
.centre {
    flex: 3;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.seccio {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* ——— VÍDEOS ——— */
.videos-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 8px;
    height: 100%;
    min-height: 0;
}

.video-bloc {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-height: 0;
}

.video-titol {
    font-size: 0.82rem;
    font-weight: bold;
    color: #5d2e0a;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0;
}

.video-bloc video {
    width: 100%;
    height: 100%;
    flex: 1;
    border: 2px solid #d5c9b8;
    border-radius: 4px;
    background: #1a1a1a;
    object-fit: contain;
}

/* ——— GRAELLA MAPES ——— */
.graella {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    overflow-y: auto;
    padding: 8px;
    height: 100%;
    align-content: start;
}

.graella::-webkit-scrollbar { width: 5px; }
.graella::-webkit-scrollbar-thumb { background: #d5c9b8; border-radius: 3px; }

.miniatura {
    width: 100%;
    height: auto;
    display: block;
    border: 2px solid #d5c9b8;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    background: #f0ece6;
}

.miniatura:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    border-color: #a08060;
}

/* ——— VISOR IMATGE ——— */
.visor {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
}

.visor-imatge {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
    background: #ffffff;
}

.visor-imatge img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 12px solid #fff;
    outline: 2px solid #d5c9b8;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    transform-origin: center center;
    user-select: none;
    pointer-events: none;
}

.botons-visor {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-tancar {
    flex-shrink: 0;
    align-self: center;
    padding: 6px 20px;
    border: 1px solid #d5c9b8;
    border-radius: 4px;
    background: #faf8f4;
    color: #5d2e0a;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-tancar:hover { background: #f0e6da; }

/* ——— LLIBRES ——— */
.llibres-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 8px;
    overflow-y: auto;
    align-content: start;
}

.llibre {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.llibre-portada {
    width: 100%;
    aspect-ratio: 2/3;
    background: linear-gradient(145deg, #7a3e10, #5d2e0a);
    color: #f4e8dc;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(0.7rem, 0.9vw, 1rem);
    line-height: 1.4;
    border-radius: 3px 6px 6px 3px;
    box-shadow: -3px 3px 8px rgba(0,0,0,0.3), inset -4px 0 8px rgba(0,0,0,0.2);
    padding: 12px;
    cursor: default;
    border-left: 6px solid #3a1b05;
}

.llibre-titol {
    font-size: 0.75rem;
    font-weight: bold;
    color: #5d2e0a;
    text-align: center;
    margin: 0;
}

.llibre-rol {
    font-size: 0.70rem;
    color: #999;
    text-align: center;
    margin: 0;
    font-style: italic;
}

/* ——— CURSOR ESPERA ——— */
body.carregant,
body.carregant * {
    cursor: wait !important;
}

/* ——— RESPONSIVE ——— */
@media (max-width: 768px) {
    .cos_interior {
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding: 16px 0;
    }

    .esquerra { flex: none; width: 100%; }
    .centre { height: 80vh; }
    .graella { grid-template-columns: repeat(2, 1fr); }
    .llibres-grid { grid-template-columns: repeat(2, 1fr); }
}
