/* === KLMC Legal — Clean Professional Theme === */

/* Global justified text for body paragraphs and quotes */
.view-content p:not(.text-center):not(.text-left):not(.text-right),
.view-content blockquote:not(.text-center):not(.text-left):not(.text-right) {
    text-align: justify;
}

/* Footer transition — visual separation from content */
footer {
    border-top: 4px solid #C41230;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.08);
}

/* Profile page — constrain attorney photo height */
[data-barba-namespace="abogado"] .overflow-hidden img {
    max-height: 500px;
}

/* Lenis required CSS */
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* Mask wrapper for GSAP text reveals */
.mask-wrapper {
    overflow: hidden;
    position: relative;
    display: inline-block;
    vertical-align: top;
    padding-bottom: 0.2em;
    margin-bottom: -0.2em;
}
.mask-block-wrapper {
    overflow: hidden;
    position: relative;
    display: block;
    padding-bottom: 0.2em;
    margin-bottom: -0.2em;
}
.mask-elem {
    display: inline-block;
    will-change: transform, opacity;
}

/* Nav shimmer */
.nav-shimmer { position: relative; overflow: hidden; }
.nav-shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-20deg);
    transition: none;
    pointer-events: none;
}
.nav-shimmer:hover::after {
    left: 200%;
    transition: left 0.8s ease;
}

/* ============================================ */
/* CSS-Based Scroll Animations (No GSAP tweens) */
/* ============================================ */

/* --- Attorney Cards: slide from left --- */
.attorney-anim {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.attorney-anim.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger delays for cards within a section */
.attorney-anim:nth-child(1) { transition-delay: 0s; }
.attorney-anim:nth-child(2) { transition-delay: 0.05s; }
.attorney-anim:nth-child(3) { transition-delay: 0.1s; }
.attorney-anim:nth-child(4) { transition-delay: 0.15s; }
.attorney-anim:nth-child(5) { transition-delay: 0.2s; }
.attorney-anim:nth-child(6) { transition-delay: 0.25s; }

/* Attorney Card Overlay (moved from HTML head to fix Barba transition bug) */
.attorney-card { position: relative; overflow: hidden; }
.attorney-card .attorney-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,28,61,0.95) 0%, rgba(0,28,61,0.8) 60%, transparent 100%);
    padding: 1.5rem; 
    transform: translateY(calc(100% - 115px)); /* Increased peek to fit 3-line names and titles */
    transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
}
.attorney-card:hover .attorney-overlay,
.attorney-card.is-active .attorney-overlay { transform: translateY(0); }

.attorney-card .attorney-bio { opacity: 0; transition: opacity 0.4s ease 0.1s; }

.attorney-card:hover .attorney-bio,
.attorney-card.is-active .attorney-bio { opacity: 1; }

/* --- Section headings: fade up --- */
.view-content h2 {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.view-content h2.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Page title: slide from left --- */
.anim-title {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.anim-title.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* --- Page subtitle --- */
.anim-subtitle {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
}
.anim-subtitle.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* --- Generic section-fade --- */
.section-fade {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.section-fade.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Service cards: slide from left with stagger --- */
.service-anim {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.service-anim.is-visible {
    opacity: 1;
    transform: translateX(0);
}
.service-anim:nth-child(1) { transition-delay: 0s; }
.service-anim:nth-child(2) { transition-delay: 0.05s; }
.service-anim:nth-child(3) { transition-delay: 0.1s; }
.service-anim:nth-child(4) { transition-delay: 0.15s; }
.service-anim:nth-child(5) { transition-delay: 0.2s; }
.service-anim:nth-child(6) { transition-delay: 0.25s; }

/* ======================================================= */
/* Actualidad Jurídica — Corte de Justicia Digital de Gama  */
/* ======================================================= */

:root {
    --aj-mahogany: #3E1507;
    --aj-mahogany-deep: #2C0E04;
    --aj-midnight: #001C3D;
    --aj-red: #ED1C24;
    --aj-text: #F8F9FA;
    --aj-text-muted: #B0B8C4;
}

/* --- "El Estrado": Video Frame --- */
.tribunal-frame {
    position: relative;
    background: var(--aj-mahogany-deep);
    border: 6px solid var(--aj-mahogany-deep);
    border-radius: 0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
}
.tribunal-frame .frame-screen {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}
.tribunal-frame .frame-screen iframe {
    width: 100%; height: 100%; border: none;
}
.tribunal-frame .frame-plaque {
    background: var(--aj-midnight);
    border-top: 3px solid var(--aj-red);
    padding: 16px 24px;
    text-align: center;
}
.tribunal-frame .frame-plaque h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--aj-text);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    margin: 0;
}

/* --- "Archivo de Evidencias": IG / Feed Cards --- */
.evidence-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1/1;
    background: rgba(0,28,61,0.6);
    border-top: 4px solid var(--aj-red);
    border-radius: 0;
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1),
                box-shadow 0.4s cubic-bezier(0.16,1,0.3,1);
}
.evidence-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.evidence-card img {
    width: 100%; height: 100%; object-fit: cover;
    transition: filter 0.5s ease;
}
.evidence-card:hover img {
    filter: brightness(0.3);
}
.evidence-card .ev-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.evidence-card:hover .ev-overlay,
.evidence-card.is-active .ev-overlay { opacity: 1; }
.evidence-card .ev-overlay .gavel-icon {
    width: 44px; height: 44px;
    color: var(--aj-red);
    filter: drop-shadow(0 2px 10px rgba(237,28,36,0.5));
    margin-bottom: 12px;
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.evidence-card:hover .ev-overlay .gavel-icon,
.evidence-card.is-active .ev-overlay .gavel-icon {
    transform: rotate(-18deg) scale(1.15);
}
.evidence-card .ev-overlay span {
    color: var(--aj-text);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border: 1px solid rgba(237,28,36,0.5);
    padding: 6px 14px;
}

/* Slide-up text overlay similar to attorney cards */
.evidence-card .evidence-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0,28,61,0.95) 40%, rgba(0,28,61,1) 100%);
    pointer-events: none;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
}
.evidence-card:hover .evidence-info,
.evidence-card.is-active .evidence-info {
    transform: translateY(0);
}
.evidence-info .evidence-tag {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--aj-red);
    margin: 0 0 4px;
}
.evidence-info .evidence-title {
    font-family: 'Playfair Display', serif;
    color: var(--aj-text);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.3;
}

/* --- Ghost Button (sharp corners) --- */
.btn-evidence {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: transparent;
    border: 2px solid var(--aj-red);
    border-radius: 0;
    color: var(--aj-red);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-evidence:hover {
    background: var(--aj-red);
    color: #fff;
}

/* --- Modal --- */
.ig-modal-backdrop {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,28,61,0.95);
    backdrop-filter: blur(16px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
}
.ig-modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.ig-modal-content {
    position: relative; width: 90%; max-width: 540px; max-height: 90vh;
    overflow-y: auto;
    background: var(--aj-midnight);
    border-top: 4px solid var(--aj-red);
    border-radius: 0;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.ig-modal-backdrop.is-open .ig-modal-content { transform: scale(1) translateY(0); }
.ig-modal-close {
    position: absolute; top: 12px; right: 12px; z-index: 10;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: 2px solid var(--aj-red);
    border-radius: 0;
    color: var(--aj-red);
    cursor: pointer;
    transition: all 0.2s;
}
.ig-modal-close:hover { background: var(--aj-red); color: #fff; }

/* --- Divider --- */
.aj-divider {
    width: 80px; height: 3px;
    background: var(--aj-red);
    margin: 0 auto;
}

/* --- Scroll animation stagger --- */
.tribunal-fade {
    opacity: 0; transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1),
                transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.tribunal-fade.is-visible { opacity: 1; transform: translateY(0); }
.tribunal-fade:nth-child(1) { transition-delay: 0s; }
.tribunal-fade:nth-child(2) { transition-delay: 0.08s; }
.tribunal-fade:nth-child(3) { transition-delay: 0.16s; }
.tribunal-fade:nth-child(4) { transition-delay: 0.24s; }
.tribunal-fade:nth-child(5) { transition-delay: 0.3s; }
.tribunal-fade:nth-child(6) { transition-delay: 0.36s; }

/* --- YouTube Facade --- */
.yt-facade { position:relative; cursor:pointer; overflow:hidden; background:#000; }
.yt-facade img { width:100%; height:100%; object-fit:cover; opacity:0.7; transition: opacity 0.3s; }
.yt-facade:hover img { opacity:0.5; }
.yt-facade .play-btn {
    position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
    width:68px; height:48px; background:#C41230; border-radius:8px;
    display:flex; align-items:center; justify-content:center;
    transition: transform 0.3s, background 0.3s;
}
.yt-facade:hover .play-btn { transform:translate(-50%,-50%) scale(1.1); background:#c41019; }
.yt-facade .play-btn::after {
    content:''; display:block; width:0; height:0;
    border-style:solid; border-width:10px 0 10px 18px;
    border-color:transparent transparent transparent #fff; margin-left:3px;
}

/* --- Interactive Video Gallery Carousel --- */
.carousel-viewport {
    overflow: hidden;
    flex: 1 1 0%;
    min-width: 0;
    position: relative;
}
#carousel-track {
    display: flex;
    width: 100%;
    gap: var(--carousel-gap, 16px);
}
.carousel-item {
    width: calc((100% - 2 * var(--carousel-gap)) / 3);
    flex-shrink: 0;
    cursor: pointer;
}
.thumb-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: all 0.3s ease;
}
.thumb-wrapper:hover img {
    opacity: 0.9;
    transform: scale(1.05);
}
.thumb-wrapper.active {
    border-color: #C41230;
    box-shadow: 0 0 15px rgba(196, 18, 48, 0.4);
}
.thumb-wrapper.active img {
    opacity: 1;
}
.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.thumb-wrapper:hover .thumb-overlay,
.thumb-wrapper.active .thumb-overlay {
    opacity: 1;
}
.thumb-play-btn {
    width: 28px;
    height: 28px;
    background: #C41230;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}
.thumb-wrapper:hover .thumb-play-btn {
    transform: scale(1);
}
.thumb-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}
.tribunal-fade:nth-child(7) { transition-delay: 0.42s; }
.tribunal-fade:nth-child(8) { transition-delay: 0.48s; }
