/* =============================================
   DIBUIX.CSS — Estils específics de la galeria
   La capçalera, menú i peu vénen de plantilla.css
   ============================================= */

/* COS INTERIOR — layout esquerra/dreta */
.cos_interior {
    display: flex;
    gap: clamp(20px, 2.5vw, 40px);
    height: 100%;
    overflow: hidden;
}

/* ==================== ESQUERRA ==================== */
.esquerra {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
    margin: clamp(10px, 1.8vh, 20px) 0;
    padding-bottom: 20px;
}

.caixa_texte {
    font-size: clamp(0.78rem, 0.82vw, 0.92rem);
    line-height: 1.6;
    color: #555;
    background: #fdfcfb;
    padding: clamp(10px, 1.2vh, 15px);
    border: 1px solid #e5e0d8;
    border-radius: 4px;
    overflow-y: auto;
    flex: none;
    max-height: 70%;
}

.titol_interior {
    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);
}

.descripcio_autor {
    text-align: justify;
    text-indent: 1.5em;
}

/* CERCA */
.peu_esquerra {
    margin-top: auto;
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.caixa_cerca {
    background: #faf8f4;
    padding: 12px;
    border: 1px solid #e5e0d8;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.caixa_cerca label {
    font-size: 0.78rem;
    color: #777;
    letter-spacing: 0.05em;
}

.caixa_cerca input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d5c9b8;
    background: #fff;
    font-family: Georgia, serif;
    font-size: 0.85rem;
    color: #333;
    outline: none;
}

.caixa_cerca input:focus {
    border-color: #5d2e0a;
}

/* BOTONS */
.panell_botons {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

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

#btnDescarregar {
    display: block;
    text-align: center;
    padding: 10px;
    border: 1px solid #ccc;
    background-color: #e5e5e5;
    color: #999;
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    pointer-events: none;
    cursor: default;
    transition: all 0.25s ease;
}

#btnDescarregar.actiu {
    background-color: #5d2e0a;
    color: #fff;
    border-color: #5d2e0a;
    pointer-events: auto;
    cursor: pointer;
}

#btnDescarregar.actiu:hover {
    background-color: #3a1b05;
}

/* ——— BARRA NAVEGACIÓ (visible només a 100%) ——— */
.barra-navegacio {
    display: none;
    align-items: center;
    justify-content: center;
    background: #a0622e;
    border-radius: 50px;
    padding: 5px 8px;
    gap: 2px;
}

.barra-navegacio.visible {
    display: flex;
}

.btn-nav {
    background: transparent;
    color: #f4e8dc;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.btn-nav:hover {
    background: rgba(255,255,255,0.15);
}

.nav-carrusel {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.nav-input-grup {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 5px;
    padding: 3px 10px 3px 8px;
    gap: 3px;
}

.nav-input-grup:focus-within {
    border-color: rgba(255,255,255,0.9);
    background: #fff;
}

.nav-carrusel input[type="number"] {
    width: 28px;
    padding: 0;
    border: none;
    border-radius: 0;
    font-family: Georgia, serif;
    font-size: 0.80rem;
    color: #333;
    text-align: center;
    outline: none;
    background: transparent;
    -moz-appearance: textfield;
    line-height: 1;
    vertical-align: middle;
}

.nav-carrusel input[type="number"]::-webkit-inner-spin-button,
.nav-carrusel input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.nav-seg {
    font-family: Georgia, serif;
    font-size: 0.72rem;
    color: #777;
    white-space: nowrap;
}

.nav-carrusel input[type="number"]:focus {
    outline: none;
}

.btn-play {
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 0.90rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s;
}

.btn-play:hover { background: rgba(0,0,0,0.5); }

.btn-play.actiu { background: #8b1a1a; }

/* ==================== DRETA ==================== */
.dreta {
    flex: 3;
    height: 100%;
    overflow-y: auto;
    padding-top: 20px;
}

/* GALERIA */
.vista-galeria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 28px;
    padding: 4px;
}

#galeria {
    width: 100%;
}

.item-dibuix {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.item-dibuix img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    border: 6px solid white;
    outline: 1px solid #d5c9b8;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s, outline-color 0.2s;
}

.item-dibuix:hover img {
    outline-color: #5d2e0a;
    box-shadow: 0 6px 16px rgba(93,46,10,0.15);
}

.titol-foto {
    text-align: center;
    margin-top: 7px;
    font-size: 0.78rem;
    color: #555;
}

/* VISTA GRAN */
.vista-un-sol-dibuix {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.vista-un-sol-dibuix .item-dibuix {
    height: 100%;
    width: 100%;
    justify-content: center;
}

.vista-un-sol-dibuix img {
    max-width: 100%;
    max-height: calc(100vh - 260px);
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {

    .cos_interior {
        flex-direction: column;
        overflow: visible;
        height: auto;
    }

    .esquerra {
        overflow: visible;
    }

    .caixa_texte {
        overflow: visible;
        flex: none;
    }

    .dreta {
        height: auto;
        overflow: visible;
    }

    .vista-galeria {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .item-dibuix img {
        height: 140px;
    }

    .vista-un-sol-dibuix img {
        max-height: 60vh;
    }
}
