/* ------------------ Variables (fallbacks) ------------------ */
:root {
    --bg: #0f0f14;
    --panel: #14141c;
    --panel-2: #101018;
    --border: #232333;
    --text: #eaeaf3;
    --muted: #a4a5b8;
    --accent: #7c4dff;
    --accent-2: #b089ff;
    --radius: 16px;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
    --header-h: 64px;
    --secnav-h: 56px;
}

/* ------------------ Layout de la página de proyecto ------------------ */
.wrap-proyecto {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 20px 80px;
    color: var(--text);
}

.breadcrumb {
    margin-bottom: 18px;
}

.breadcrumb a {
    color: var(--accent-2);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ------------------ Hero del proyecto ------------------ */
.proy-hero {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 18px;
}

.proy-hero__title h1 {
    margin: 0 0 6px 0;
    line-height: 1.15;
}

.proy-hero__title .proy-subtitle {
    color: var(--muted);
    margin: 0;
}

.tech-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 18px;
    padding: 0;
    list-style: none;
}

.tech-chips li {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.98rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tech-chips li i {
    font-size: 1.04em;
    opacity: .92;
}

.visit-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.visit-actions .btn {
    padding: 11px 18px;
    font-size: 1rem;
    border-radius: 12px;
    line-height: 1.2;
    flex: 0 1 auto;
    min-height: 0;
    height: auto;
}

/* Bloque que muestra las versiones 2.0 / 1.0 del proyecto multi-marca */
.project-version-strip {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.project-version-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

/* Estilo base de los "pills" de versiones */
.project-badge,
.project-badge-current,
.project-badge-legacy {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

/* Version seleccionada (data-active="true") */
.project-badge-current[data-active="true"],
.project-badge-legacy[data-active="true"] {
    background: var(--accent, #a855f7);
    color: #fff;
}

.project-version-text {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin: 4px 0 0;
}

[data-version-block][hidden],
[data-version-content][hidden] {
    display: none !important;
}


/* ------------------ Nav por secciones (sticky) ------------------ */
.section-nav {
    position: sticky;
    top: var(--header-h);
    z-index: 20;
    background: linear-gradient(180deg, rgba(16, 16, 24, .96), rgba(16, 16, 24, .96));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    margin: 16px 0 18px;
    backdrop-filter: blur(6px);
}

.section-nav ul {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: center;
    flex-wrap: wrap;
}

.section-nav .sec-link {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-weight: 600;
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.section-nav .sec-link:hover {
    transform: translateY(-1px);
}

.section-nav .sec-link.active {
    background: var(--accent);
    border-color: transparent;
    color: #fff;
}

.section-nav__toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.section-nav__icon {
    width: 18px;
    height: 12px;
    position: relative;
}

.section-nav__icon::before,
.section-nav__icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: transform .2s ease;
}

.section-nav__icon::before {
    top: 2px;
}

.section-nav__icon::after {
    bottom: 2px;
}

.wrap-proyecto section[id] {
    scroll-margin-top: calc(var(--header-h) + var(--secnav-h) + 14px);
}

/* ------------------ Cards genéricas de sección ------------------ */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 18px;
}

.card h2 {
    margin-top: 0;
}

/* columnas reutilizables */
.cols {
    display: grid;
    gap: 20px;
}

.cols > * {
    min-width: 0;
}

.cols-2 {
    grid-template-columns: 1fr 1fr;
}

.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.mini-card {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    padding: 16px;
}

.mini-card pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mini-card code {
    white-space: inherit;
}

/* Lista con checks */
.list-check {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.list-check li {
    position: relative;
    padding-left: 28px;
    margin: 10px 0;
}

.list-check li::before {
    content: "✔";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-2);
}

/* ------------------ Galería con Tabs por marca ------------------ */
.galeria-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.brand-tabs {
    display: inline-flex;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px;
}

.tab-brand {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
}

.tab-brand:hover {
    opacity: .9;
}

.tab-brand.active {
    background: var(--accent);
    color: #fff;
}

/* panel oculto mostrado vía atributo hidden (el JS alterna) */
.brand-panel[hidden] {
    display: none;
}

/* Grid de capturas */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 18px;
}

/* Card de captura */
.shot {
    margin: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
    display: grid;
}

.shot img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 16 / 9;
}

/* Etiqueta inferior */
.shot figcaption {
    position: absolute;
    left: 12px;
    bottom: 12px;
}

.shot .tag {
    display: inline-block;
    background: rgba(16, 16, 24, .9);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
}

/* Tip/nota */
.hint {
    color: var(--muted);
    margin-top: 12px;
    font-size: .95rem;
}

/* ------------------ KPIs / Resultados ------------------ */
.kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0 0 16px;
    padding-left: 18px;
}

/* ========== Lightbox (galería) ========== */
.shot {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0, 0, 0, .88);
    z-index: 9999;
    padding: 24px;
}

.lightbox.open {
    display: grid;
}

.lightbox .lb-img {
    max-width: min(96vw, 1400px);
    max-height: 86vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.lightbox .lb-close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #1e1e28;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

.lightbox .lb-close:hover {
    transform: translateY(-1px);
}

.lightbox .lb-caption {
    margin-top: 10px;
    text-align: center;
    color: #eaeaf3;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .6);
}

/* ========== Lightbox: navegación ========== */
.lightbox .lb-prev,
.lightbox .lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(30, 30, 40, 0.92);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    user-select: none;
}

.lightbox .lb-prev {
    left: 16px;
}

.lightbox .lb-next {
    right: 16px;
}

.lightbox .lb-prev:hover,
.lightbox .lb-next:hover {
    transform: translateY(-50%) scale(1.04);
}

.lightbox .lb-counter {
    position: absolute;
    bottom: 16px;
    right: 18px;
    padding: 6px 10px;
    background: rgba(30, 30, 40, 0.88);
    color: #eaeaf3;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

@media (max-width: 1024px) {
    :root {
        --header-h: 72px;
        --secnav-h: 64px;
    }

    .wrap-proyecto {
        padding: 24px 16px 70px;
    }

    .proy-hero {
        padding: 20px;
    }

    .visit-actions {
        flex-wrap: wrap;
    }

    .visit-actions .btn {
        flex: 1 1 240px;
        justify-content: center;
    }

    .cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --header-h: 112px;
        --secnav-h: 88px;
    }

    .wrap-proyecto {
        padding: 20px 14px 64px;
    }

    .breadcrumb {
        margin-bottom: 14px;
    }

    .proy-hero {
        padding: 18px;
    }

    .proy-hero__title h1 {
        font-size: clamp(1.6rem, 5vw, 2.2rem);
    }

    .proy-hero__title .proy-subtitle {
        line-height: 1.6;
    }

    .tech-chips {
        gap: 8px;
    }

    .tech-chips li {
        font-size: .94rem;
        padding: 8px 12px;
    }

    .visit-actions {
        flex-direction: column;
    }

    .visit-actions .btn {
        width: 100%;
        flex: 0 0 auto;
        padding: 10px 14px;
        font-size: .95rem;
        border-radius: 10px;
        min-height: 0;
        height: auto;
    }

    .section-nav {
        top: calc(var(--header-h) - 8px);
        padding: 12px;
        gap: 10px;
    }

    .section-nav__toggle {
        display: inline-flex;
    }

    .section-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    .section-nav.is-collapsible ul {
        display: none;
    }

    .section-nav.is-collapsible.is-open ul {
        display: flex;
    }

    .section-nav .sec-link {
        width: 100%;
        text-align: center;
    }

    .section-nav.is-open .section-nav__icon::before {
        transform: translateY(4px) rotate(45deg);
    }

    .section-nav.is-open .section-nav__icon::after {
        transform: translateY(-4px) rotate(-45deg);
    }

    .cols-2,
    .cols-3 {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .kpis {
        grid-template-columns: 1fr;
        padding-left: 12px;
    }
}

@media (max-width: 480px) {
    :root {
        --header-h: 132px;
        --secnav-h: 110px;
    }

    .wrap-proyecto {
        padding: 18px 12px 56px;
    }

    .proy-hero {
        padding: 16px;
    }

    .tech-chips {
        gap: 7px;
    }

    .tech-chips li {
        font-size: .9rem;
    }

    .section-nav {
        padding: 10px;
    }

    .section-nav__toggle {
        font-size: .95rem;
        padding: 10px 12px;
    }

    .section-nav .sec-link {
        font-size: .95rem;
        padding: 10px 12px;
    }
}
