/* ==========================================================================
   GLOBAL RESET AND CORE VARIABLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8f8f8;
    --text-primary: #111111;
    --visible-cards: 4; /* Sets math bounds to split viewport into 4 parts (creates half-cut edges on 5-item layout) */
    --card-gap: 3vw;     /* Horizontal padding gap between project mockups */
}

body {
    overflow: hidden;
    background-color: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
}

h1, h3, h4, h5, h6, a {
    margin: 0;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

h2 {
    font-family: "Barlow", sans-serif;
}
/* ==========================================================================
   TITLES CANVAS LAYER (TYPOGRAPHY POSITIONING)
   ========================================================================== */
.titles-container {
    position: fixed;
    bottom: 13vh;
    left: 0;
    width: 100vw;
    height: 30px;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.title-item {
    position: absolute;
    width: 100%;
    text-align: center;
    will-change: transform, opacity;
    opacity: 0;
}       

.title-item h2 {
    font-size: 1.4rem;
    font-weight: 600;
    white-space: nowrap;
    color: rgb(27, 27, 27);
}

/* ==========================================================================
   HORIZONTAL ENDLESS GRID TRACK CONTAINER (NO IMPORTANT RULES)
   ========================================================================== */
.portfolio-container-fluid {
    position: absolute;
    width: 100vw;
    height: 55vh;
    top: -10px;
    bottom: 0;
    margin: auto;
}
:root {
    --card-gap: 80px;
}
.portfolio-fan-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}
.project-card-item {
    position: absolute;
    top: 0;
    width: 290px;
    height: 100%;
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}
.project-mockup {
    width: 100%;
    height: 100%;
    transform-origin: center center !important;
    
    /* Si no existe la variable aún (al cargar), por defecto es 1 */
    scale: var(--magnifier-scale, 1);
    
    /* Esta transición va a suavizar el cambio de la variable de forma premium */
    transition: scale 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: scale;
}
.project-mockup img {
    transform: scale(var(--lens-zoom, 1));
    /* Agrega suavidad orgánica para que no se sienta rígido */
    transition: transform 0.1s ease-out;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}
.card-lens-container {
    width: 100%;
    height: 100%;
    /* Recibe la escala desde JS de forma aislada */
    transform: scale(var(--lens-scale, 1));
    /* Movimiento ultra suave que acompaña al imán */
    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1);
}
.disabled-link {
    position: relative;
}
.disabled-link::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.disabled-link::before {
    content: "";
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.disabled-link:hover::after,
.disabled-link:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0); /* Sube suavemente a su posición final */
}

/* ==========================================================================
   RESPONSIVE LAYOUT CONSTRAINTS
   ========================================================================== */

@media (max-width: 768px) {
    .project-card-item {
        width: 100%; 
    }
    .portfolio-container-fluid {
        transform: none;
        width: 100vw;
        height: 60vh;
    }
    .title-item h2 { 
        font-size: 1.6rem; 
    }
}
@media (min-width: 768px) and (max-width: 1024px) {
    .project-card-item {
        width: 400px; 
    }
    .portfolio-container-fluid {
        transform: none;
        width: 100vw;
    }
    .title-item h2 { 
        font-size: 2rem; 
    }
    .titles-container {
        bottom: 9vh;
        height: 45px;
    }
}

/* ==========================================================================
   STATIC CORE UI INTERFACES
   ========================================================================== */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding-top: 1rem;
    pointer-events: none;
    text-align: center;
}

.site-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
}

.site-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
    padding: 0 1rem 1rem 1rem;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
}

.footer-link {
    pointer-events: auto;
    color: inherit;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
}