/*
Theme Name: CristinaWP
Description: Tema a medida para cristinahernando.com
Version: 1.0
*/

/* ==========================================================================
   GLOBAL
   ========================================================================== */

@font-face {
    font-family: 'Algarabia';
    src: url('font/algarabia.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
}

/* ==========================================================================
   SITE LOADER (animación de entrada)
   ========================================================================== */

.site-loader {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.45s ease;
}

.site-loader.is-finished {
    opacity: 0;
    pointer-events: none;
}

.loader-center {
    position: relative;
    width: min(72vw, 520px);
    aspect-ratio: 845 / 830.52;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-20px);
}

.logo-draw {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 1;
    transform-origin: center center;
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

.logo-draw path {
    fill: none;
    stroke: #ffffff;
    stroke-opacity: 0.3;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.04));
    transition: stroke-dashoffset 0.08s linear;
}

.loader-progress {
    position: relative;
    z-index: 3;
    font-size: 18px;
    line-height: 1;
    color: #ffffff;
    text-align: center;
    min-width: 52px;
}

.loader-footer {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    text-align: center;
    font-size: 18px;
    line-height: 1.2;
    color: #ffffff;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .loader-center { width: min(78vw, 420px); }
    .loader-progress { font-size: 18px; }
    .loader-footer { font-size: 14px; bottom: 28px; white-space: normal; }
    .logo-draw path { stroke-width: 2; }
}

@media (max-width: 560px) {
    .loader-center { width: min(84vw, 340px); }
    .loader-footer { font-size: 13px; line-height: 1.35; }
}

/* ==========================================================================
   HOME (EN) — Lista / Grid de proyectos
   ========================================================================== */

body.page-template-page-home-en-php {
    overflow: hidden;
}

.home-content {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.home-content.is-ready {
    opacity: 1;
}

.main-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.view-switcher {
    position: fixed;
    top: 160px;
    left: 20px;
    z-index: 2000;
    font-size: 18px;
    color: #fff;
    mix-blend-mode: difference;
    isolation: isolate;
}

.view-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.3s ease;
    padding: 0;
    font-size: inherit;
    text-decoration: none;
}

.view-btn:hover { opacity: 1; }
.view-btn.is-active { opacity: 1; }
.separator { opacity: 0.6; }

.view-stage {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.view-panel {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(18px);
    transition:
        opacity 0.55s cubic-bezier(0.19, 1, 0.22, 1),
        transform 0.55s cubic-bezier(0.19, 1, 0.22, 1),
        visibility 0s linear 0.55s;
}

.view-panel.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition:
        opacity 0.55s cubic-bezier(0.19, 1, 0.22, 1),
        transform 0.55s cubic-bezier(0.19, 1, 0.22, 1),
        visibility 0s linear 0s;
}

.view-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

/* -------------------- LIST -------------------- */
.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 200px 20px 20px 20px;
    flex-shrink: 0;
    background: transparent;
}

.list-columns-labels {
    display: grid;
    grid-template-columns: 80px 100px 1.5fr 1fr 1fr;
    padding: 10px 30px;
    font-size: 11px;
    letter-spacing: 0.75px;
    color: #fff;
}

.projects-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 100px;
    scrollbar-width: none;
}

.projects-list::-webkit-scrollbar { display: none; }

#js-project-preview {
    width: 400px;
    height: 300px;
    position: relative;
    overflow: hidden;
    background-color: #000;
    transform: scale(0);
    transform-origin: center center;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    margin-bottom: 6px;
}

#js-project-preview.is-visible { transform: scale(1); }

.preview-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.img-incoming { z-index: 2; transform: scale(0); }
.img-active   { transform: scale(1); }

.project-item {
    display: block;
    height: 34px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    animation: staggerIn 0.6s ease forwards;
    animation-delay: calc(var(--i) * 0.05s);
    opacity: 0;
}

.project-slide-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    transition: opacity 0.35s ease;
}

.projects-list.list-is-hovered .project-item .project-slide-container { opacity: 0.2; }
.projects-list.list-is-hovered .project-item.row-is-active .project-slide-container { opacity: 1; }
.projects-list.list-is-hovered .project-item.row-is-active .layer span { color: var(--hover-color, #fff); }

.layer {
    height: 100%;
    display: grid;
    grid-template-columns: 80px 100px 1.5fr 1fr 1fr;
    align-items: center;
    padding: 0 30px;
}

.layer-hover { display: none; }
.layer-rest  { background-color: transparent; }

.layer span {
    font-size: 18px;
    transition: color 0.35s ease;
    color: #fff;
}

.layer span:first-child { font-size: 11px; letter-spacing: 0.75px; }

.col-date { font-size: 11px !important; letter-spacing: 0.75px; }
.col-title, .col-role, .col-cat { font-size: 18px; }
.col-cat { text-align: left; }

/* Mobile card — oculto en escritorio */
.mobile-item-inner { display: none; }

/* -------------------- GRID -------------------- */
.grid-view {
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 200px 16px 40px 16px;
}

.grid-view::-webkit-scrollbar { display: none; }

.grid-shell {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 12px;
    align-items: start;
    min-height: calc(100vh - 180px);
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    will-change: transform;
}

.grid-card {
    display: block;
    position: relative;
    overflow: hidden;
    background: #111;
    text-decoration: none;
    color: #fff;
}

.grid-card-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #111;
    isolation: isolate;
}

.grid-card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: opacity 0.35s ease, filter 0.35s ease;
}

.grid-column-center .grid-card img { aspect-ratio: 16 / 9; }

.grid-card-duotone-base,
.grid-card-duotone-tint {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.grid-card-duotone-base { background: #000; mix-blend-mode: lighten; z-index: 1; }
.grid-card-duotone-tint { background: var(--hover-color, #fff); mix-blend-mode: multiply; z-index: 2; }

.grid-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 12px;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    z-index: 3;
}

.grid-card-title { font-size: 18px; line-height: 0.95; }
.grid-card-year  { font-size: 11px; letter-spacing: 0.75px; align-self: flex-start; }

.grid-card.no-thumb { background: #111; border: 1px solid rgba(255,255,255,0.08); }
.grid-card.no-thumb .grid-card-media { aspect-ratio: 4 / 3; display: flex; align-items: flex-end; background: var(--hover-color, #fff); }
.grid-column-center .grid-card.no-thumb .grid-card-media { aspect-ratio: 16 / 9; }
.grid-card.no-thumb .grid-card-overlay { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
    .grid-card:hover img { filter: grayscale(100%) invert(100%) contrast(1.1); }
    .grid-card:hover .grid-card-duotone-base,
    .grid-card:hover .grid-card-duotone-tint,
    .grid-card:hover .grid-card-overlay { opacity: 1; }
}

@keyframes staggerIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════
   MOBILE ≤ 900px
════════════════════════════════ */
@media (max-width: 900px) {
    body.page-template-page-home-en-php {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
    }

    .main-wrapper,
    .view-stage,
    .view-content {
        height: auto;
        min-height: auto;
    }

    .view-switcher {
        position: relative;
        top: auto; left: auto;
        z-index: 20;
        padding: 110px 20px 18px 20px;
        font-size: 16px;
        mix-blend-mode: normal;
        isolation: auto;
    }

    .view-stage { overflow: visible; }

    .view-panel {
        position: relative;
        inset: auto;
        display: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition: none;
    }

    .view-panel.is-active { display: block; }

    .projects-header { padding: 10px 20px 12px 20px; align-items: flex-start; }
    .list-columns-labels { display: none; }

    .projects-list {
        overflow: visible;
        height: auto;
        max-height: none;
        padding: 0 0 40px 0;
    }

    .project-item {
        height: auto;
        overflow: visible;
    }

    .project-item .project-slide-container { display: none; }

    .mobile-item-inner {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        padding: 18px 20px;
        gap: 12px;
    }

    .mobile-item-body {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .mobile-item-top {
        display: flex;
        align-items: baseline;
        gap: 8px;
        line-height: 1.1;
    }

    .mobile-item-num {
        font-size: 18px;
        color: #fff;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .mobile-item-title {
        font-size: 18px;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-item-meta {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .mobile-item-cat,
    .mobile-item-role {
        font-size: 12px;
        letter-spacing: 0.75px;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-item-arrow {
        font-size: 18px;
        color: #fff;
        flex-shrink: 0;
        opacity: 0.5;
        padding-top: 1px;
        transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    }

    .project-item:active .mobile-item-arrow {
        opacity: 1;
        transform: translateX(4px);
    }

    .grid-view {
        overflow: visible;
        height: auto;
        max-height: none;
        padding: 20px 16px 30px 16px;
    }

    .grid-shell { grid-template-columns: 1fr; gap: 10px; min-height: auto; }
    .grid-column { transform: none !important; }

    .grid-card img,
    .grid-column-center .grid-card img { aspect-ratio: 4 / 3; opacity: 1; filter: none; }

    .grid-card-duotone-base,
    .grid-card-duotone-tint { display: none; }

    .grid-card-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.45), rgba(0,0,0,0.0) 55%);
    }

    #js-project-preview { display: none; }

    html.menu-open .view-switcher,
    body.menu-open .view-switcher { display: none; }
}