/* ==========================================================================
   DMB Galería Mejorada
   Paleta: marfil + dorado (coincide con identidad de marca del sitio)
   Tipografía: Cormorant Garamond (display) + Poppins (cuerpo/labels)
   ========================================================================== */

.dmb-gal {
    --ivory: #FAF8F3;
    --ivory-deep: #EDEAE3;
    --ink: #281e00;
    --gold-deep: #614901;
    --gold: #B8860B;
    --gold-bright: #D9A300;

    background: var(--ivory);
    color: var(--ink);
    padding: clamp(48px, 8vw, 110px) 0;
    overflow: hidden;
}

.dmb-gal * {
    box-sizing: border-box;
}

/* ---------- Intro ---------- */

.dmb-gal__intro {
    max-width: 680px;
    margin: 0 auto clamp(56px, 9vw, 120px);
    padding: 0 24px;
    text-align: center;
}

.dmb-gal__intro-eyebrow {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
}

.dmb-gal__intro-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(34px, 5.5vw, 54px);
    line-height: 1.12;
    margin: 14px 0 18px;
    color: var(--ink);
}

.dmb-gal__intro-line {
    width: 120px;
    height: 10px;
    margin: 0 auto 18px;
    display: block;
}

.dmb-gal__intro-line path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.4;
    stroke-linecap: round;
}

.dmb-gal__intro-text {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 300;
    color: var(--gold-deep);
    line-height: 1.6;
    margin: 0;
}

/* ---------- Sección por tratamiento ---------- */

.dmb-gal__section {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px clamp(64px, 9vw, 130px);
}

.dmb-gal__section-head {
    max-width: 620px;
    margin: 0 0 clamp(28px, 4vw, 44px);
}

.dmb-gal__eyebrow {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 17px;
    color: var(--gold-bright);
    display: block;
    margin-bottom: 6px;
}

.dmb-gal__title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.15;
    margin: 0 0 10px;
    color: var(--ink);
}

/* Firma: línea dorada que se "dibuja" al entrar en viewport */
.dmb-gal__sig-line {
    width: 180px;
    height: 12px;
    display: block;
    margin-bottom: 14px;
}

.dmb-gal__sig-line path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 240;
    stroke-dashoffset: 240;
    transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.dmb-gal__section-head.dmb-revealed .dmb-gal__sig-line path {
    stroke-dashoffset: 0;
}

.dmb-gal__text {
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    font-size: 15.5px;
    line-height: 1.7;
    color: var(--gold-deep);
    margin: 0;
}

/* ---------- Grid de fotos ---------- */

.dmb-gal__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(10px, 1.6vw, 20px);
}

.dmb-gal__item {
    margin: 0;
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 3px;
    background: var(--ivory-deep);
    box-shadow: 0 1px 2px rgba(40, 30, 0, 0.04);
}

.dmb-gal__item-parallax {
    position: absolute;
    inset: -22% 0;
    will-change: transform;
}

.dmb-gal__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    /* Filtro leve para unificar tono/contraste entre fotos de distinta calidad/luz */
    filter: contrast(1.05) saturate(0.92) brightness(1.02);
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease;
}

.dmb-gal__item:hover img {
    transform: scale(1.045);
    filter: contrast(1.08) saturate(0.98) brightness(1.04);
}

/* Marco fino dorado al hover, gesto de "detalle cuidado" */
.dmb-gal__item::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--gold);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.dmb-gal__item:hover::after {
    opacity: 0.55;
}

/* ---------- Comparador antes/después (slider) ---------- */

.dmb-gal__item--compare {
    cursor: ew-resize;
}

.dmb-compare {
    position: absolute;
    inset: 0;
    overflow: hidden;
    user-select: none;
}

.dmb-compare__after,
.dmb-compare__before {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.dmb-compare__after img,
.dmb-compare__before img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--dmb-compare-w, 100%);
    object-fit: cover;
    object-position: center;
    display: block;
    filter: contrast(1.05) saturate(0.92) brightness(1.02);
}

.dmb-compare__before {
    width: 50%;
    border-right: 2px solid var(--ivory);
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.dmb-compare.dmb-dragging .dmb-compare__before {
    transition: none;
}

.dmb-compare__before img {
    width: 200%;
    max-width: none;
}

.dmb-compare__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--ivory);
    transform: translateX(-1px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.dmb-compare.dmb-dragging .dmb-compare__handle {
    transition: none;
}

.dmb-compare__handle-grip {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ivory);
    color: var(--gold-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(40, 30, 0, 0.25);
}

.dmb-compare__tag {
    position: absolute;
    bottom: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ivory);
    background: rgba(40, 30, 0, 0.55);
    padding: 4px 10px;
    border-radius: 3px;
    pointer-events: none;
}

.dmb-compare__tag--before {
    left: 10px;
}

.dmb-compare__tag--after {
    right: 10px;
}

/* ---------- Placeholder (slot a completar, NUNCA imagen IA) ---------- */

.dmb-gal__item--placeholder {
    background: var(--ivory-deep);
    border: 1px dashed rgba(97, 73, 1, 0.35);
}

.dmb-gal__placeholder-box {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    text-align: center;
}

.dmb-gal__placeholder-icon {
    width: 30px;
    height: 30px;
    stroke: var(--gold-deep);
    opacity: 0.5;
    margin-bottom: 4px;
}

.dmb-gal__placeholder-box span {
    font-family: 'Poppins', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--gold-deep);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dmb-gal__placeholder-box small {
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 300;
    color: var(--gold-deep);
    opacity: 0.75;
    max-width: 160px;
    line-height: 1.4;
}

/* ---------- Reveal al scroll (estado inicial) ---------- */

.dmb-reveal {
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.dmb-reveal.dmb-revealed {
    opacity: 1;
    transform: translateY(0);
}

.dmb-gal__grid .dmb-reveal:nth-child(2) { transition-delay: 0.06s; }
.dmb-gal__grid .dmb-reveal:nth-child(3) { transition-delay: 0.12s; }
.dmb-gal__grid .dmb-reveal:nth-child(4) { transition-delay: 0.18s; }
.dmb-gal__grid .dmb-reveal:nth-child(5) { transition-delay: 0.24s; }
.dmb-gal__grid .dmb-reveal:nth-child(6) { transition-delay: 0.3s; }
.dmb-gal__grid .dmb-reveal:nth-child(7) { transition-delay: 0.36s; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .dmb-gal__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .dmb-gal__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .dmb-gal__intro-title {
        font-size: 30px;
    }
}

@media (max-width: 420px) {
    .dmb-gal__grid {
        grid-template-columns: 1fr;
    }

    .dmb-gal__item {
        aspect-ratio: 5 / 4;
    }
}

/* ---------- Accesibilidad: respeta reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .dmb-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .dmb-gal__sig-line path {
        stroke-dashoffset: 0;
        transition: none;
    }

    .dmb-gal__item img {
        transition: none;
    }

    .dmb-gal__item:hover img {
        transform: none;
    }
}
