/* ============================================================================
   PROYECTO: Portfolio Nico Falcón
   ARCHIVO: assets/css/layout.css
   PROPÓSITO: Estructura base, botones, hero y media queries.
   ============================================================================ */

/* --- 1. CONTENEDORES --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- 2. BOTONES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-code);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn--primary {
    background-color: var(--coral);
    color: var(--ink);
}
.btn--primary:hover {
    background-color: var(--mint);
}

.btn--ghost {
    background-color: transparent;
    border-color: var(--ink-3);
    color: var(--bone);
}
.btn--ghost:hover {
    border-color: var(--muted);
    background-color: var(--ink-2);
}

/* --- 3. UTILIDADES DE TEXTO --- */
.text-gradient {
    background: linear-gradient(90deg, var(--coral), var(--mint));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* --- 3.5. NAVEGACIÓN (TOPBAR) --- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: rgba(11, 26, 32, 0.85); /* var(--ink) al 85% */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ink-3);
}

.topbar__inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.topbar__logo {
    font-family: var(--font-code);
    font-weight: 800;
    font-size: 1.1rem;
}

.topbar__logo-name {
    color: var(--bone);
}

.topbar__menu {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.topbar__menu a {
    color: var(--bone);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.topbar__menu a:hover {
    color: var(--mint);
}

/* Botón hamburguesa: oculto en escritorio, se muestra en móvil */
.topbar__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.topbar__toggle-bar {
    display: block;
    width: 26px;
    height: 2px;
    background-color: var(--bone);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Estado abierto: las rayas forman una X */
.topbar__toggle.is-open .topbar__toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.topbar__toggle.is-open .topbar__toggle-bar:nth-child(2) {
    opacity: 0;
}
.topbar__toggle.is-open .topbar__toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- 4. HERO --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 70px; /* Compensa la topbar */
}

/* Capa de aurora: manchas de color difuminadas de fondo */
.hero__aurora {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

/* Fundido inferior: la aurora se desvanece hacia el fondo (sin máscara, no congela los blobs) */
.hero__aurora::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, var(--ink) 100%);
    pointer-events: none;
    transform: translateZ(0);
}

.hero__blob {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

/* Capa hija: solo color + blur. El padre solo se mueve. Nunca compiten. */
.hero__blob::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
}

.hero__blob--1 {
    width: 460px;
    height: 460px;
    top: -80px;
    left: 8%;
    animation: blob-float-1 18s ease-in-out infinite;
}
.hero__blob--1::after { background: var(--coral); }

.hero__blob--2 {
    width: 520px;
    height: 520px;
    bottom: -120px;
    right: 4%;
    animation: blob-float-2 22s ease-in-out infinite;
}
.hero__blob--2::after { background: var(--mint); }

.hero__blob--3 {
    width: 380px;
    height: 380px;
    top: 30%;
    left: 40%;
    animation: blob-float-3 26s ease-in-out infinite;
}
.hero__blob--3::after { background: var(--ink-3); }

.hero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
}

.hero__content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero__eyebrow {
    font-family: var(--font-code);
    color: var(--mint);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.1;
    font-weight: 800;
}

.hero__subtitle {
    color: var(--muted);
    font-size: 1.15rem;
    max-width: 600px;
}

.hero__actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Tratamiento visual de la foto */
.hero__visual {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.hero__photo-wrapper {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 4/5;
    border-radius: var(--radius-md);
    z-index: 2;
    isolation: isolate;
}

.hero__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    filter: grayscale(100%) contrast(1.1);
    transition: filter 0.5s ease;
    border: 1px solid var(--ink-3);
    position: relative;
    z-index: 2;
}

.hero__photo-wrapper:hover .hero__photo {
    filter: grayscale(0%);
}

.hero__photo-backdrop {
    position: absolute;
    inset: -15px 15px 15px -15px;
    border: 2px solid var(--ink-3);
    border-radius: var(--radius-md);
    z-index: 1;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.hero__photo-wrapper:hover .hero__photo-backdrop {
    transform: translate(-5px, 5px);
    border-color: var(--coral);
}

/* --- 5. SECCIONES GLOBALES --- */
.section {
    padding: 4rem 0;
    scroll-margin-top: 90px;
    overflow-x: hidden;
}
.section__title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 2.5rem;
    color: var(--bone);
}

.project {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-bottom: 8rem;
    align-items: center;
    perspective: 1000px;
}

/* El último proyecto no arrastra margen: la sección Skills ya trae su padding */
.project:last-of-type {
    margin-bottom: 0;
}

/* Alternancia asimétrica: los pares invierten el orden visual */
.project:nth-of-type(even) .project__content {
    order: 2;
}
.project:nth-of-type(even) .project__visual {
    order: 1;
}

.project__visual {
    position: relative;
    border-radius: var(--radius-md);
    background-color: rgba(237, 231, 217, 0.04);
    border: 1px solid rgba(237, 231, 217, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Interacción 3D del proyecto (el JS controla el giro en tiempo real) */
.project__visual {
    transform-style: preserve-3d;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
    will-change: transform;
    transform: translateY(var(--parallax-y, 0));
}

.project:hover .project__visual {
    border-color: rgba(237, 231, 217, 0.2);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

/* Placeholder temporal hasta que subas las capturas en /img */
.project__visual::before {
    content: "Mockup / Captura";
    font-family: var(--font-code);
    color: var(--muted);
}

/* La captura cubre todo el cuadro y tapa el placeholder */
.project__visual img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Excepción: Noray es un dashboard 4:3, el cuadro se adapta a su forma */
.project__visual-contain {
    object-fit: contain;
}

.project__content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.project__name {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--bone);
}

.project__stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-chip {
    background-color: rgba(104, 224, 180, 0.1);
    color: var(--mint);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-family: var(--font-code);
    font-size: 0.8rem;
    border: 1px solid rgba(104, 224, 180, 0.2);
}

.project__desc {
    color: var(--muted);
    font-size: 1.05rem;
}

.project__links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* --- 6. SKILLS --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    max-width: 1000px;
    margin: 0 auto; /* Esto centra el bloque entero */
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-md);
    background-color: rgba(237, 231, 217, 0.04);
    border: 1px solid rgba(237, 231, 217, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    color: var(--muted);
    cursor: default;
}

.skill-item i {
    font-size: 3.5rem;
    transition: transform 0.3s ease;
}

.skill-item span {
    font-family: var(--font-code);
    font-size: 0.85rem;
    font-weight: 500;
}

.skill-item:hover {
    background-color: rgba(237, 231, 217, 0.08);
    border-color: rgba(237, 231, 217, 0.2);
    color: var(--bone);
    transform: translateY(-5px);
}

.skill-item:hover i {
    transform: scale(1.15);
}

/* --- 7. TRAYECTORIA (TIMELINE) --- */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    border-left: 2px solid var(--ink-3);
    padding-left: 2.5rem;
    margin-left: 1rem;
}

/* Barra de progreso que se rellena según scrolleas */
.timeline__progress {
    position: absolute;
    left: -2px;
    top: 0;
    width: 2px;
    height: var(--timeline-fill, 0%);
    background: linear-gradient(180deg, var(--coral), var(--mint));
    transition: height 0.1s linear;
}

.timeline__item {
    position: relative;
}

.timeline__item::before {
    content: '';
    position: absolute;
    left: -2.85rem; /* Ajuste para centrar el punto sobre el borde */
    top: 0.3rem;
    width: 14px;
    height: 14px;
    background-color: var(--ink);
    border: 2px solid var(--coral);
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.timeline__item:hover::before {
    background-color: var(--coral);
}

.timeline__date {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--mint);
    margin-bottom: 0.5rem;
}

.timeline__role {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--bone);
}

.timeline__company {
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.timeline__desc {
    color: var(--muted);
    font-size: 1rem;
    max-width: 700px;
}

/* --- 8. CONTACTO Y FOOTER --- */
.contact-box {
    position: relative;
    background-color: rgba(237, 231, 217, 0.04);
    border: 1px solid rgba(237, 231, 217, 0.08);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 4rem 2rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

/* Halo de luz que gira sin parar detrás del cristal */
.contact-box::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140%;
    aspect-ratio: 1;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 106, 69, 0.15) 90deg,
        transparent 180deg,
        rgba(104, 224, 180, 0.15) 270deg,
        transparent 360deg
    );
    transform: translate(-50%, -50%);
    animation: contact-rotate 12s linear infinite;
    z-index: 0;
    pointer-events: none;
}

/* El contenido va por encima del halo */
.contact-box > * {
    position: relative;
    z-index: 1;
}

.contact-box .section__title {
    margin-bottom: 1.5rem;
    color: var(--coral);
}

.contact-box__text {
    color: var(--muted);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-box__actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.footer {
    border-top: 1px solid var(--ink-3);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.footer__text {
    font-family: var(--font-code);
    color: var(--muted);
    font-size: 0.85rem;
}

/* --- 9. CERTIFICACIONES --- */
.certs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.cert-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 2rem;
    border-radius: var(--radius-md);
    background-color: rgba(237, 231, 217, 0.04);
    border: 1px solid rgba(237, 231, 217, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

/* Halo que sigue al puntero (posición vía --mx/--my desde JS) */
.cert-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        400px circle at var(--mx, 50%) var(--my, 50%),
        rgba(104, 224, 180, 0.12),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.cert-card:hover::before {
    opacity: 1;
}

.cert-card:hover {
    transform: translateY(-5px);
    border-color: rgba(104, 224, 180, 0.3);
}

.cert-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cert-card__tag {
    font-family: var(--font-code);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--coral);
}

.cert-card__date {
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--muted);
}

.cert-card__title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--bone);
}

.cert-card__org {
    color: var(--muted);
    font-size: 0.95rem;
}

.cert-card__meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cert-card__badge {
    background-color: rgba(104, 224, 180, 0.1);
    color: var(--mint);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-family: var(--font-code);
    font-size: 0.8rem;
    border: 1px solid rgba(104, 224, 180, 0.2);
}

/* --- 10. LIGHTBOX / GALERÍA --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200; /* por encima de la topbar (101) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: rgba(11, 26, 32, 0.92); /* var(--ink) al 92% */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox__stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox__img {
    max-width: 90vw;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--ink-3);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lightbox__caption {
    font-family: var(--font-code);
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
}

.lightbox__close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--ink-3);
    border-radius: var(--radius-sm);
    color: var(--bone);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.lightbox__close:hover {
    border-color: var(--coral);
    color: var(--coral);
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(23, 56, 66, 0.6); /* var(--ink-3) translúcido */
    border: 1px solid var(--ink-3);
    border-radius: 50%;
    color: var(--bone);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lightbox__nav:hover {
    background-color: var(--ink-3);
    border-color: var(--mint);
    color: var(--mint);
}

.lightbox__nav--prev { left: 1.5rem; }
.lightbox__nav--next { right: 1.5rem; }

/* Con una sola imagen, el JS oculta las flechas y el contador */
.lightbox.is-single .lightbox__nav,
.lightbox.is-single .lightbox__counter {
    display: none;
}

.lightbox__counter {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--muted);
}