/* ---------- 1. RESET & VARIABLES ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Color */
    --bg-color: #050505;
    --bg-elevated: #0a0a0a;
    --border-color: #1e1e1e;
    --border-strong: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --text-dim: #666666;
    --accent: #ffffff;

    /* Tipografía — fallbacks de sistema para funcionamiento offline */
    --font-sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Space Mono', Consolas, 'Courier New', Courier, monospace;

    /* Métrica */
    --gutter: 20px;
    --max-width: 1400px;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

ul {
    list-style: none;
}

:focus-visible {
    outline: 1px solid var(--text-primary);
    outline-offset: 3px;
}

::selection {
    background: var(--text-primary);
    color: var(--bg-color);
}

/* Texto sólo para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--gutter);
    z-index: 200;
    padding: 12px 18px;
    background: var(--text-primary);
    color: var(--bg-color);
    text-decoration: none;
    font-size: 0.72rem;
    transition: top 0.2s var(--ease);
}

.skip-link:focus {
    top: 10px;
}

/* ---------- 2. BASE ---------- */
.archive-tag {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.noscript-note {
    padding: 24px var(--gutter);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-align: center;
}
/* ---------- 3. RETÍCULA VISUAL ---------- */
.grid-container {
    position: relative;
    max-width: var(--max-width);
    margin: 0 auto;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

/* Marcas de intersección (+) sobre los nodos de la retícula */
.plus {
    position: absolute;
    top: -6px;
    z-index: 6;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.plus--l { left: -6px; }
.plus--r { right: -6px; }

/* Los contenedores de sección pasan a ser el origen del marcado (+) */
.site-header,
.hero,
.site-footer,
.results-meta {
    position: relative;
}



/* ---------- 4. HEADER & NAVEGACIÓN ---------- */
.site-header {
    /* En escritorio y tablet: marca a la izquierda, contacto a la derecha. */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    gap: var(--gutter);
    padding: 18px var(--gutter);
    border-bottom: 1px solid var(--border-color);
    background: rgba(5, 5, 5, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 0;
}

/* El SVG trae su propia proporción (434×200): se manda la altura y el
   ancho se resuelve solo, sin deformar ni saltos de layout. */
.brand__logo {
    display: block;
    width: auto;
    height: 40px;
}

.cta-btn {
    position: relative;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    transition: opacity 0.2s var(--ease);
}

.cta-btn:hover {
    opacity: 0.75;
}

.cta-container {
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 2;
    width: auto;
    max-width: none;
}

.site-header .cta-btn {
    width: auto;
    text-align: center;
}

.cta-btn {
    display: inline-block;
    border: 1px solid var(--text-primary);
    padding: 11px 18px;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.cta-btn--block {
    padding: 16px 24px;
    font-size: 0.8rem;
}

.cta-btn--outline {
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.cta-btn--outline:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* ---------- 5. HERO ---------- */
.hero {
    padding: 56px var(--gutter) 44px;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-family: var(--font-sans);
    font-size: clamp(3rem, 10vw, 7.5rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 0.9;
    margin-bottom: 28px;
    text-indent: -0.02em; /* compensa el tracking negativo del borde izquierdo */
}

.hero-description {
    max-width: 500px;
    font-size: 0.76rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 36px;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.hero-tags li {
    border: 1px solid var(--border-color);
    padding: 7px 12px;
}

.video-showcase {
    padding: 48px var(--gutter) 52px;
    border-bottom: 1px solid var(--border-color);
}

.video-showcase h2 {
    font-family: var(--font-sans);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 12px;
}

.video-showcase__intro {
    max-width: 560px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.7;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 28px;
    background: var(--border-color);
}

.video-project {
    display: flex;
    min-width: 0;
    flex-direction: column;
    background: var(--bg-color);
}

.video-project__media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-elevated);
}

.video-project__media::after {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
    content: '';
    pointer-events: none;
}

.video-project__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.72;
    transition: transform 0.5s var(--ease), opacity 0.4s var(--ease);
}

.video-project:hover .video-project__media img {
    transform: scale(1.04);
    opacity: 1;
}

.video-project__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
}

.video-project__index {
    margin-bottom: 12px;
    color: var(--text-dim);
    font-size: 0.56rem;
    letter-spacing: 0.12em;
}

.video-project h3 {
    margin-bottom: 10px;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.video-project p {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.64rem;
    line-height: 1.7;
}

.video-project__link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    border: 1px solid var(--border-strong);
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.video-project__link:hover {
    border-color: var(--text-primary);
    background: var(--bg-elevated);
}

.video-project__link span {
    font-size: 0.9rem;
}


/* ---------- 6. CONTADOR ---------- */
.results-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 15px var(--gutter);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.results-meta__count {
    color: var(--text-primary);
    letter-spacing: 0.1em;
}


/* ---------- 7. GALERÍA DE CONTENIDOS ---------- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1px;
    background-color: var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.portfolio-grid:focus {
    outline: none;
}

/* El atributo hidden no gana contra display:grid: hay que reforzarlo */
.portfolio-grid[hidden] {
    display: none;
}

.portfolio-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background-color: var(--bg-color);
    cursor: pointer;
    padding: 15px;
    border: 0;
    text-align: left;
    width: 100%;
}

.portfolio-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    filter: grayscale(0.15);
    transition: transform 0.5s var(--ease), opacity 0.4s var(--ease), filter 0.4s var(--ease);
}

.portfolio-card:hover .portfolio-card__img,
.portfolio-card:focus-visible .portfolio-card__img {
    transform: scale(1.04);
    opacity: 1;
    filter: grayscale(0);
}

/* Retícula interna de la miniatura */
.portfolio-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to bottom, transparent 55%, rgba(5, 5, 5, 0.9) 100%);
    opacity: 0.9;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
}

.card-info {
    position: relative;
    z-index: 2;
    background: rgba(5, 5, 5, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    font-size: 0.66rem;
    line-height: 1.5;
    color: var(--text-secondary);
    transition: border-color 0.25s var(--ease);
}

.portfolio-card:hover .card-info,
.portfolio-card:focus-visible .card-info {
    border-color: var(--border-strong);
}

.card-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
}

/* Distintivo de tipo de archivo */
.card-badge {
    position: absolute;
    z-index: 3;
    top: 15px;
    left: 15px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    font-size: 0.56rem;
    letter-spacing: 0.16em;
    color: var(--text-primary);
    background: rgba(5, 5, 5, 0.7);
    border: 1px solid var(--border-color);
    transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.portfolio-card:hover .card-badge {
    border-color: var(--border-strong);
    background: rgba(5, 5, 5, 0.9);
}

.card-badge__dot {
    width: 5px;
    height: 5px;
    background: var(--text-primary);
}

.card-badge--video .card-badge__dot {
    border-radius: 50%;
    animation: pulso 2.4s ease-in-out infinite;
}

@keyframes pulso {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.card-index {
    position: absolute;
    z-index: 3;
    top: 15px;
    right: 15px;
    font-size: 0.56rem;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

/* Cargar más / estado vacío */
.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 40px var(--gutter);
    border-bottom: 1px solid var(--border-color);
}

.load-more {
    padding: 14px 30px;
    border: 1px solid var(--border-color);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.load-more:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.load-more[hidden] {
    display: none;
}

/* ---------- 8. FOOTER ---------- */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 60px var(--gutter) 30px;
}

.footer-cta {
    margin-bottom: 60px;
}

.footer-cta h2 {
    font-family: var(--font-sans);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1;
    margin: 10px 0 28px;
    text-indent: -0.01em;
}

.footer-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    font-size: 0.7rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.footer-info__col p + p {
    margin-top: 2px;
}

.footer-info__contacts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 18px;
}

.footer-info__col--contact {
    text-align: center;
}

.footer-info__item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.footer-info__icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    fill: currentColor;
    color: var(--text-primary);
    opacity: 0.9;
}

.footer-info a {
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.2s var(--ease);
}

.footer-info a:hover {
    opacity: 0.6;
    text-decoration: underline;
}

/* ---------- CONTACTO ---------- */
.contact-lightbox {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: grid;
    place-items: center;
    padding: var(--gutter);
}

.contact-lightbox[hidden] {
    display: none;
}

.contact-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.contact-lightbox__panel {
    position: relative;
    width: min(520px, 100%);
    padding: 42px var(--gutter) 30px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
}

.contact-lightbox__panel h2 {
    max-width: 380px;
    margin: 12px 0 26px;
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.contact-lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 12px 16px;
    background: transparent;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    cursor: pointer;
}

.contact-lightbox__close:hover {
    background: var(--text-primary);
    color: var(--bg-color);
}

.contact-lightbox__options {
    display: grid;
}

.contact-option {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.78rem;
    transition: color 0.2s var(--ease), padding 0.2s var(--ease);
}

.contact-option:hover {
    padding-inline: 8px;
    color: var(--text-secondary);
}

.contact-option__icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: currentColor;
}

.contact-option__arrow {
    margin-left: auto;
}

/* ---------- 9. LIGHTBOX ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: var(--gutter);
}

.lightbox[hidden] {
    display: none;
}

.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: aparecer 0.25s var(--ease);
}

.lightbox__panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    width: min(1100px, 100%);
    max-height: 88vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    animation: aparecer 0.3s var(--ease);
}

@keyframes aparecer {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox__figure {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 0;
    background: var(--bg-color);
    border-right: 1px solid var(--border-color);
}

.lightbox__figure img,
.lightbox__figure iframe {
    max-height: 88vh;
    width: 100%;
    object-fit: contain;
}

.lightbox__figure iframe {
    aspect-ratio: 16 / 9;
    border: 0;
    background: #000;
    min-height: 320px;
}

.lightbox__meta {
    padding: 28px var(--gutter);
    overflow-y: auto;
    align-self: start;
}

.lightbox__meta h2 {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 8px;
}

.lightbox__line {
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.lightbox__specs {
    display: grid;
    gap: 12px;
}

.lightbox__specs > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.66rem;
    border-bottom: 1px dotted var(--border-color);
    padding-bottom: 10px;
}

.lightbox__specs dt {
    color: var(--text-dim);
    letter-spacing: 0.12em;
}

.lightbox__specs dd {
    color: var(--text-primary);
    text-align: right;
}

.lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 12px 16px;
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s var(--ease);
}

.lightbox__close:hover {
    background: var(--text-primary);
    color: var(--bg-color);
}

body.lb-abierto {
    overflow: hidden;
}


/* ---------- 10. RESPONSIVE ---------- */
@media (max-width: 1080px) {
    .lightbox__panel {
        grid-template-columns: 1fr;
        max-height: 92vh;
        overflow-y: auto;
    }

    .lightbox__figure {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .lightbox__figure img,
    .lightbox__figure iframe {
        max-height: 46vh;
    }

}

@media (max-width: 768px) {
    :root {
        --gutter: 14px;
    }

    body {
        font-size: 13px;
    }

    /* Las marcas (+) viven en el canal exterior del contenedor: sin holgura no hay lugar */
    .plus {
        display: none;
    }

    .site-header {
        padding: 14px var(--gutter);
    }

    .hero {
        padding: 40px var(--gutter) 32px;
    }

    .hero h1 {
        font-size: clamp(2.5rem, 13vw, 5rem);
        margin-bottom: 22px;
    }

    .hero-description {
        font-size: 0.72rem;
        margin-bottom: 28px;
    }

    .video-showcase {
        padding: 38px var(--gutter) 42px;
    }

    .video-showcase h2 {
        font-size: 1.65rem;
    }

    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .portfolio-card {
        aspect-ratio: 3 / 4;
        padding: 10px;
    }

    .card-badge {
        top: 10px;
        left: 10px;
        padding: 4px 7px;
        font-size: 0.5rem;
    }

    .card-index {
        top: 10px;
        right: 10px;
    }

    .card-info {
        padding: 8px 9px;
        font-size: 0.58rem;
    }

    .card-info strong {
        font-size: 0.62rem;
    }

    .site-footer {
        padding: 40px var(--gutter) 24px;
    }

    .footer-cta {
        margin-bottom: 40px;
    }

    .footer-info {
        flex-direction: column;
        align-items: center;
        gap: 18px;
        text-align: center;
    }

    .footer-info__col {
        width: 100%;
        text-align: center;
    }

    .footer-info__contacts {
        width: 100%;
    }
}

/* En móvil, el logotipo gana presencia y el botón conserva toda la fila. */
@media (max-width: 560px) {
    .site-header {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        justify-items: center;
        gap: 12px;
    }

    .brand {
        justify-content: center;
        width: 100%;
    }

    .brand__logo {
        height: 48px;
    }

    .cta-container {
        justify-content: center;
        width: 100%;
        max-width: 320px;
    }

    .site-header .cta-btn {
        width: 100%;
    }

    .cta-container .cta-btn {
        padding: 9px 12px;
        font-size: 0.62rem;
        white-space: nowrap;
    }
}

@media (max-width: 360px) {
    .site-header {
        gap: 8px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .brand__logo {
        height: 42px;
    }

    .cta-container .cta-btn {
        padding: 8px 9px;
        font-size: 0.56rem;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .portfolio-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Accesibilidad: respeta la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Impresión: el archivo en papel */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .site-header,
    .load-more-wrap,
    .lightbox,
    .card-badge,
    .card-index {
        display: none !important;
    }

    .portfolio-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}

