/* ==========================================================================
   Initium Web — Portfolio Redesign & Featured Strip Styles
   Vanilla CSS — Light/Dark Mode Compatible & CSP3 Clean
   ========================================================================== */

:root {
    --pf-azul-oscuro: #12335c;
    --pf-azul: #1b5aa3;
    --pf-teal: #1fa7a0;
    --pf-bg-strip: linear-gradient(135deg, #12335c 0%, #1b5aa3 50%, #1fa7a0 100%);
    --pf-card-bg: #ffffff;
    --pf-card-border: #e1e8ef;
    --pf-text-title: #1e293b;
    --pf-text-body: #374151;
    --pf-tag-bg: #eef4fa;
    --pf-tag-color: #1b5aa3;
    --pf-shadow: 0 8px 24px rgba(18, 51, 92, 0.08);
    --pf-shadow-hover: 0 14px 32px rgba(18, 51, 92, 0.16);
    --pf-modal-bg: #ffffff;
    --pf-overlay-bg: rgba(10, 20, 35, 0.3);
}

[data-bs-theme="dark"] {
    --pf-azul-oscuro: #8ab4f8;
    --pf-azul: #4285f4;
    --pf-teal: #20c997;
    --pf-bg-strip: linear-gradient(135deg, #0d1b2a 0%, #1b263b 50%, #12335c 100%);
    --pf-card-bg: #1e293b;
    --pf-card-border: rgba(255, 255, 255, 0.1);
    --pf-text-title: #f1f5f9;
    --pf-text-body: #94a3b8;
    --pf-tag-bg: rgba(66, 133, 244, 0.15);
    --pf-tag-color: #8ab4f8;
    --pf-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    --pf-shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.4);
    --pf-modal-bg: #1e293b;
    --pf-overlay-bg: rgba(0, 0, 0, 0.4);
}

/* ---- Sección Portafolio — adaptable modo claro y oscuro ---- */
.portfolio-featured-strip {
    background: transparent;
    color: var(--initium-text-primary);
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.portfolio-featured-strip .eyebrow {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    color: var(--initium-primary);
    font-weight: 700;
}

.portfolio-featured-strip h1,
.portfolio-featured-strip h2 {
    color: var(--initium-text-primary);
    font-weight: 800;
}

.portfolio-featured-strip p.lead-text {
    color: var(--initium-text-secondary);
    font-size: 1rem;
    max-width: 600px;
}

/* Filtros (Pills) — adaptativos al modo */
.portfolio-filters .pf-filter-btn {
    background: var(--initium-surface);
    border: 1px solid var(--bs-border-color);
    color: var(--initium-text-primary);
    padding: 8px 18px;
    border-radius: 50rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.portfolio-filters .pf-filter-btn:hover,
.portfolio-filters .pf-filter-btn.active {
    background: var(--initium-primary);
    border-color: var(--initium-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 102, 153, 0.3);
}

/* Nav Buttons Flotantes — adaptativos */
.pf-carousel-wrapper {
    position: relative;
    padding: 0 40px;
}

.pf-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--initium-surface);
    border: 1px solid var(--bs-border-color);
    color: var(--initium-text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.pf-nav-btn.prev {
    left: -10px;
}

.pf-nav-btn.next {
    right: -10px;
}

.pf-nav-btn.disabled {
    opacity: 0.2;
    pointer-events: none;
    cursor: default;
}

.pf-nav-btn:hover {
    background: var(--initium-primary, #00a09e);
    border-color: var(--initium-primary, #00a09e);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 160, 158, 0.3);
}

@media (max-width: 768px) {
    .pf-carousel-wrapper {
        padding: 0;
    }

    .pf-nav-btn {
        display: none;
        /* En móviles el swipe horizontal es suficiente y los botones estorban */
    }
}

/* Estas reglas están definidas arriba con variables adaptativas - no duplicar */

/* Controles de scroll */
.portfolio-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portfolio-controls button:hover {
    background: #1fa7a0;
    border-color: #1fa7a0;
    color: #ffffff;
    transform: scale(1.05);
}

/* Pista de Tarjetas en Carrusel */
.portfolio-track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 10px 4px 20px 4px;
    scrollbar-width: none;
    justify-content: center;
    justify-content: safe center;
}

.portfolio-track::-webkit-scrollbar {
    display: none;
}

/* Tarjeta de Proyecto */
.portfolio-card {
    flex: 0 0 320px;
    scroll-snap-align: start;
    background: var(--pf-card-bg);
    border: 1px solid var(--pf-card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--pf-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.portfolio-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--pf-shadow-hover);
}

/* Contenedor Visual de la Tarjeta */
.portfolio-visual {
    height: 160px;
    position: relative;
    overflow: hidden;
    background: var(--pf-bg-strip);
}

.portfolio-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-card:hover .portfolio-visual img {
    transform: scale(1.05);
}

/* Badge de Iniciales Fallback */
.portfolio-visual-initials {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1b5aa3 0%, #1fa7a0 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 2.2rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.portfolio-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.portfolio-cat {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #1fa7a0;
    font-weight: 700;
    margin-bottom: 6px;
}

.portfolio-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--pf-text-title);
    margin-bottom: 8px;
    line-height: 1.3;
}

.portfolio-desc {
    font-size: 0.88rem;
    color: var(--pf-text-body);
    line-height: 1.5;
    margin-bottom: 14px;
    flex-grow: 1;
}

.portfolio-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.portfolio-tag {
    font-size: 0.75rem;
    background: var(--pf-tag-bg);
    color: var(--pf-tag-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
}

.portfolio-ver-btn {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pf-azul);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

/* Indicadores Puntos */
.portfolio-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.portfolio-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.25s ease;
    cursor: pointer;
}

.portfolio-dots span.active {
    background: #1fa7a0;
    width: 24px;
    border-radius: 4px;
}

/* ---- Modal de Detalle Interactivo ---- */
.pf-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--pf-overlay-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    visibility: hidden;
    pointer-events: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    z-index: 1060;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pf-modal-overlay.active {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

.pf-modal-box {
    background: var(--pf-modal-bg);
    max-width: 680px;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--pf-card-border);
    position: relative;
    margin: auto;
    
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.pf-modal-overlay.active .pf-modal-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.pf-modal-hero {
    position: relative;
    background: transparent;
    /* Changed from var(--pf-bg-strip) to avoid bars */
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 350px;
    /* Allow it to be taller if needed, but not infinitely */
    overflow: hidden;
}

.pf-modal-hero img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain;
}

.pf-modal-hero .pf-hero-initials {
    font-size: 3.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 2px;
}

.pf-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease;
}

.pf-modal-close:hover {
    background: rgba(225, 29, 72, 0.85);
}

.pf-modal-content {
    padding: 28px 32px;
}

.pf-modal-cat {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--pf-teal);
    font-weight: 700;
}

.pf-modal-title {
    color: var(--pf-text-title);
    font-size: 1.5rem;
    font-weight: 800;
    margin: 6px 0 14px;
}

.pf-modal-body-text {
    color: var(--pf-text-body);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 20px;
}

/* Galería de Diapositivas en el Modal */
.pf-gallery-section {
    padding: 0 32px 24px;
    margin-top: -10px;
}

.pf-gallery-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--pf-text-body);
    font-weight: 700;
    margin-bottom: 12px;
}

/* Viewport: solo centra, no recorta ni colorea */
.pf-slides-viewport {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 0 28px; /* espacio para los botones */
}

/* Inner: se encoge al tamaño de la imagen activa */
.pf-slide-inner {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.pf-slide-img {
    display: none;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 8px;
    vertical-align: middle;
    opacity: 0;
}

.pf-slide-img.active {
    display: block;
    animation: pfFadeInImage 0.6s ease-in-out forwards;
}

@keyframes pfFadeInImage {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* ========================================= */
/* LIGHTBOX PANTALLA COMPLETA                */
/* ========================================= */
.pf-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.pf-lightbox-overlay.active {
    display: flex;
    opacity: 1;
}
.pf-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#pfLightboxImage {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    user-select: none;
    transition: transform 0.2s ease-out;
}
.pf-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s, transform 0.2s;
}
.pf-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}
.pf-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s, transform 0.2s;
    user-select: none;
}
.pf-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}
.pf-lightbox-nav.prev { left: 20px; }
.pf-lightbox-nav.next { right: 20px; }
.pf-lightbox-counter {
    color: white;
    margin-top: 15px;
    font-size: 0.9rem;
    letter-spacing: 1px;
    opacity: 0.8;
}
@media (max-width: 768px) {
    .pf-lightbox-nav { 
        font-size: 20px; 
        width: 34px; 
        height: 34px; 
    }
    .pf-lightbox-nav.prev { left: 10px; }
    .pf-lightbox-nav.next { right: 10px; }
    #pfLightboxImage { max-width: 95vw; max-height: 80vh; }
}

.pf-slide-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    transition: background 0.2s ease;
    z-index: 5;
}

.pf-slide-nav:hover {
    background: var(--pf-teal);
}

.pf-slide-nav.prev {
    left: -18px;
}

.pf-slide-nav.next {
    right: -18px;
}

.pf-gallery-thumbs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.pf-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.6;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.pf-thumb.active,
.pf-thumb:hover {
    opacity: 1;
    border-color: var(--pf-teal);
}

/* Footer Modal / Action */
.pf-modal-footer {
    padding: 0 32px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pf-modal-cta {
    background: linear-gradient(135deg, var(--pf-azul), var(--pf-teal));
    color: #ffffff;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 99px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.pf-modal-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(31, 167, 160, 0.35);
    color: #ffffff;
}

@media (max-width: 768px) {
    .pf-modal-box {
        margin: 10px;
    }

    .pf-modal-hero {
        max-height: 300px;
    }

    .pf-modal-hero img {
        max-height: 300px;
    }

    .pf-modal-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 0 20px 20px;
    }

    .pf-modal-content {
        padding: 24px 20px;
    }

    .pf-gallery-section {
        padding: 0 20px 24px;
    }

    .pf-slides-viewport {
        border-radius: 8px;
    }
}