/* Nextgon SAS, rediseño v4 (frontend-design).
   Concepto: estudio de ingeniería de la Sabana de Bogotá. Curvas de nivel como textura de lugar,
   noche de páramo en vez de negro neutro, cian de la marca solo para acciones. */

@font-face {
    font-family: "Anybody";
    src: url("../fonts/anybody.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 50% 150%;
    font-display: swap;
}
@font-face {
    font-family: "Atkinson Next";
    src: url("../fonts/atkinson.woff2") format("woff2");
    font-weight: 200 800;
    font-display: swap;
}
@font-face {
    font-family: "Atkinson Next";
    src: url("../fonts/atkinson-italic.woff2") format("woff2");
    font-weight: 200 800;
    font-style: italic;
    font-display: swap;
}

:root {
    --paramo: #0C1716;      /* fondo */
    --musgo: #132623;       /* superficies */
    --musgo-2: #1C3531;     /* bordes y líneas */
    --niebla: #E6ECE7;      /* texto */
    --liquen: #93AA9F;      /* texto secundario */
    --senal: #37D6E3;       /* acción (cian del logo) */
    --frailejon: #E1C86A;   /* detalles mínimos */

    --display: "Anybody", "Arial Narrow", sans-serif;
    --body: "Atkinson Next", "Segoe UI", system-ui, sans-serif;

    /* escala tipográfica 1.333 */
    --t-sm: 0.875rem;
    --t-base: 1.0625rem;
    --t-md: 1.333rem;
    --t-lg: 1.777rem;
    --t-xl: clamp(2rem, 4.2vw, 3.16rem);
    --t-hero: clamp(2.2rem, 6.2vw, 6.6rem);

    --gutter: clamp(1rem, 4vw, 3rem);
    --maxw: 78rem;
    --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
    margin: 0;
    background: var(--paramo);
    color: var(--niebla);
    font-family: var(--body);
    font-size: var(--t-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1; }
p { margin: 0; }
::selection { background: var(--senal); color: var(--paramo); }

:focus-visible { outline: 2px solid var(--senal); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--senal); color: var(--paramo); padding: .6rem 1rem; font-weight: 700; }
.skip-link:focus { top: 1rem; }

/* ---------- Botones y enlaces ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 3rem; padding: .75rem 1.4rem;
    font: 700 1rem/1 var(--body);
    text-decoration: none; border-radius: 999px; border: 1.5px solid transparent;
    cursor: pointer; transition: background-color .2s, color .2s, border-color .2s;
}
.btn-sm { min-height: 2.5rem; padding: .55rem 1.1rem; font-size: .9375rem; }
.btn-block { width: 100%; }
.btn-signal { background: var(--senal); color: var(--paramo); }
.btn-signal:hover { background: #7BE6EF; }
.btn-line { border-color: var(--musgo-2); color: var(--niebla); }
.btn-line:hover { border-color: var(--liquen); }

.text-link {
    font-weight: 700; text-decoration: underline; text-decoration-color: var(--senal);
    text-decoration-thickness: 2px; text-underline-offset: .3em;
}
.text-link:hover { color: var(--senal); }
.text-link.muted { color: var(--liquen); text-decoration-color: var(--musgo-2); }

/* ---------- Encabezado ---------- */
.site-header {
    position: fixed; inset: 0 0 auto; z-index: 50;
    transition: background-color .3s, border-color .3s;
    border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { background: rgba(12, 23, 22, .88); backdrop-filter: blur(10px); border-color: var(--musgo-2); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 4.5rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-family: var(--display); font-weight: 700; font-stretch: 125%; font-size: 1.15rem; letter-spacing: .01em; }
.brand-sm { font-size: 1rem; }
.brand img { filter: invert(.93); border-radius: 50%; }
.site-nav { display: flex; align-items: center; gap: 2rem; }
.nav-link { text-decoration: none; color: var(--liquen); font-weight: 600; transition: color .2s; }
.nav-link:hover, .nav-link[aria-current="true"] { color: var(--niebla); }

.menu-toggle { display: none; }
@media (max-width: 760px) {
    .menu-toggle {
        display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
        background: none; border: 1.5px solid var(--musgo-2); border-radius: 999px; color: var(--niebla); cursor: pointer;
    }
    .bars, .bars::before, .bars::after { display: block; width: 1.1rem; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s var(--ease), opacity .2s; }
    .bars { position: relative; }
    .bars::before, .bars::after { content: ""; position: absolute; left: 0; }
    .bars::before { top: -6px; } .bars::after { top: 6px; }
    .menu-toggle[aria-expanded="true"] .bars { background: transparent; }
    .menu-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
    .menu-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

    .site-nav {
        position: fixed; inset: 4.5rem 0 auto; flex-direction: column; align-items: stretch; gap: 0;
        padding: .5rem var(--gutter) 1.5rem; background: var(--paramo); border-bottom: 1px solid var(--musgo-2);
        visibility: hidden; opacity: 0; transform: translateY(-.5rem);
        transition: opacity .2s, transform .25s var(--ease), visibility 0s .25s;
    }
    .site-nav.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity .2s, transform .25s var(--ease); }
    .site-nav .nav-link { padding: .9rem 0; border-bottom: 1px solid var(--musgo); font-size: 1.125rem; }
    .site-nav .btn { margin-top: 1rem; }
    .site-header:has(.is-open) { background: var(--paramo); }
}

/* ---------- Inicio ---------- */
.hero {
    position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end;
    padding-top: 6rem; overflow: hidden; isolation: isolate;
}
.terrain {
    position: absolute; inset: 0; z-index: -2;
    background: url("../img/sabana.svg") center / cover no-repeat;
    -webkit-mask-image: radial-gradient(120% 90% at 70% 40%, #000 30%, transparent 85%);
            mask-image: radial-gradient(120% 90% at 70% 40%, #000 30%, transparent 85%);
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-fallback { display: none; }
.no-webgl .hero-fallback, html:not(.js) .hero-fallback {
    display: block; position: absolute; right: 8%; top: 18%; width: min(34vw, 380px); opacity: .9; z-index: -1;
}

.hero-inner { padding-bottom: clamp(2rem, 6vh, 4rem); }
.hero-title {
    font-size: var(--t-hero); font-weight: 800; letter-spacing: -.01em; line-height: .86;
    display: flex; flex-direction: column; max-width: 11ch;
}
.hero-title span { display: block; font-stretch: 112%; }
.hero-title .l1 { font-size: .42em; font-weight: 500; font-stretch: 100%; color: var(--liquen); margin-bottom: .35em; line-height: 1; }
.hero-title .l2 { font-stretch: 150%; }
.hero-title .l3 { font-stretch: 62%; font-weight: 700; }

/* el único momento orquestado: el titular se estira al cargar, como un despegue */
@media (prefers-reduced-motion: no-preference) {
    .js .hero-title .l2 { animation: despegue 1.5s var(--ease) .35s both; }
    .js .hero-title .l3 { animation: aterriza 1.5s var(--ease) .5s both; }
    .js .hero-title .l1, .js .hero-foot, .js .hero-place { animation: aparece .8s ease-out 1.2s both; }
}
@keyframes despegue { from { font-stretch: 50%; opacity: 0; transform: translateY(.12em); } 40% { opacity: 1; } to { font-stretch: 150%; transform: none; } }
@keyframes aterriza { from { font-stretch: 150%; opacity: 0; } 40% { opacity: 1; } to { font-stretch: 62%; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }

.hero-foot { margin-top: clamp(1.5rem, 4vh, 2.5rem); display: grid; gap: 1.5rem; max-width: 36rem; }
.hero-sub { font-size: var(--t-md); line-height: 1.45; color: var(--niebla); }
.cta-group { display: flex; flex-wrap: wrap; gap: .75rem; }

.hero-place {
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding-block: 1rem 1.25rem; border-top: 1px solid var(--musgo-2);
    color: var(--liquen); font-size: var(--t-sm);
}
.hero-place span:first-child { color: var(--frailejon); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
    .hero { padding-top: 50vh; }
    .hero-title { max-width: none; font-size: 9.4vw; }
    .hero-sub { font-size: 1.125rem; }
    .terrain { -webkit-mask-image: linear-gradient(#000 20%, transparent 75%); mask-image: linear-gradient(#000 20%, transparent 75%); }
}

/* ---------- Secciones ---------- */
.section { padding-block: clamp(4.5rem, 11vw, 8.5rem); }
.section-title { font-size: var(--t-xl); font-stretch: 125%; font-weight: 700; letter-spacing: -.005em; margin-bottom: clamp(2rem, 5vw, 3.5rem); }

/* Servicios: filas, título a la izquierda y detalle a la derecha */
.service-rows { border-top: 1px solid var(--musgo-2); }
.service {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: .75rem 3rem;
    padding-block: clamp(1.75rem, 4vw, 2.75rem); border-bottom: 1px solid var(--musgo-2);
}
.service h3 { font-size: var(--t-lg); font-stretch: 100%; font-weight: 700; grid-row: span 2; }
.service p { max-width: 62ch; color: var(--niebla); }
.service .proof { color: var(--liquen); font-size: var(--t-sm); }
.service .proof a { color: var(--senal); font-weight: 700; }
@media (max-width: 760px) { .service { grid-template-columns: 1fr; } .service h3 { grid-row: auto; } }

/* Proyectos */
.projects { background: var(--musgo); }
.project {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center;
}
.project + .project { margin-top: clamp(4rem, 10vw, 7rem); padding-top: clamp(4rem, 10vw, 7rem); border-top: 1px solid var(--musgo-2); }
.project-geo .project-media { order: 2; }
.project-media { position: relative; aspect-ratio: 1 / 1; }
.shot { position: absolute; width: 72%; height: auto; border-radius: 14px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); }
.shot-back { right: 0; top: 0; opacity: .75; }
.shot-front { left: 0; bottom: 0; }
.geo-media { display: grid; place-items: center; background: url("../img/sabana.svg") center / 160% no-repeat; border-radius: 50%; }
.geo-icon { width: 46%; height: auto; border-radius: 22%; box-shadow: 0 24px 50px -18px rgba(0, 0, 0, .7); }

.project-client { color: var(--frailejon); font-size: var(--t-sm); font-weight: 600; margin-bottom: .75rem; }
.project h3 { font-size: var(--t-xl); font-stretch: 140%; margin-bottom: 1.25rem; }
.project-body > p:not(.project-client) { max-width: 52ch; }
.specs { margin: 1.75rem 0; display: grid; gap: 0; border-top: 1px solid var(--musgo-2); }
.specs div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding-block: .7rem; border-bottom: 1px solid var(--musgo-2); }
.specs dt { color: var(--liquen); font-size: var(--t-sm); padding-top: .15em; }
.specs dd { margin: 0; font-weight: 600; }
.project-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
@media (max-width: 760px) {
    .project { grid-template-columns: 1fr; }
    .project-geo .project-media { order: 0; }
    .project-media { max-width: 26rem; width: 100%; }
    .specs div { grid-template-columns: 6.5rem 1fr; }
}

/* Nosotros */
.about-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 3rem; }
.about-body { display: grid; gap: 1.5rem; }
.statement { font-family: var(--display); font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 500; font-stretch: 90%; line-height: 1.2; max-width: 30ch; }
.about-body > p:not(.statement) { color: var(--liquen); max-width: 55ch; }
.facts { margin: 1rem 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; border-top: 1px solid var(--musgo-2); padding-top: 1.5rem; }
.facts dt { color: var(--liquen); font-size: var(--t-sm); }
.facts dd { margin: .25rem 0 0; font-family: var(--display); font-size: var(--t-md); font-weight: 700; font-stretch: 110%; }
@media (max-width: 760px) {
    .about-grid { grid-template-columns: 1fr; gap: 0; }
    .facts { grid-template-columns: 1fr; gap: 1rem; }
}

/* Contacto */
.contact { border-top: 1px solid var(--musgo-2); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 6vw, 5rem); }
.contact-head p { color: var(--liquen); max-width: 40ch; margin-bottom: 1.5rem; }
.mail-link { font-family: var(--display); font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 700; font-stretch: 105%; text-decoration: underline; text-decoration-color: var(--senal); text-underline-offset: .25em; overflow-wrap: anywhere; }
.mail-link:hover { color: var(--senal); }
.contact-form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: .4rem; }
.field label { font-weight: 600; font-size: .9375rem; }
.field input, .field textarea {
    width: 100%; font: inherit; color: var(--niebla); background: var(--musgo);
    border: 1.5px solid var(--musgo-2); border-radius: 10px; padding: .8rem 1rem; transition: border-color .2s;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:hover, .field textarea:hover { border-color: #2B4B45; }
.field input:focus-visible, .field textarea:focus-visible { outline: none; border-color: var(--senal); }
.form-note { color: var(--liquen); font-size: var(--t-sm); }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }

.phone-link { display: block; margin-top: .75rem; color: var(--liquen); text-decoration: none; font-weight: 600; }
.phone-link:hover { color: var(--niebla); }
.consent { display: grid; grid-template-columns: auto 1fr; gap: .75rem; align-items: start; font-size: var(--t-sm); color: var(--liquen); }
.consent input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--senal); }
.consent a { color: var(--niebla); }

/* Pie */
.site-footer { border-top: 1px solid var(--musgo-2); padding-block: 3rem 1.5rem; color: var(--liquen); font-size: var(--t-sm); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: 2rem 3rem; }
.site-footer .brand { color: var(--niebla); margin-bottom: 1rem; }
.site-footer address { font-style: normal; line-height: 1.8; }
.footer-col { display: grid; align-content: start; gap: .55rem; }
.footer-col h2 { font-family: var(--body); font-size: var(--t-sm); font-weight: 700; color: var(--niebla); margin-bottom: .25rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--niebla); text-decoration: underline; }
.footer-bottom { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--musgo); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ================= v5: escenas 3D ================= */
.webgl-ready .terrain { display: none; }
.hero.logo-hover { cursor: pointer; }
.hero-place { align-items: center; }
.launch {
    font: 600 var(--t-sm)/1 var(--body); color: var(--niebla); background: none; cursor: pointer;
    border: 1px solid var(--musgo-2); border-radius: 999px; padding: .5rem .9rem;
    transition: border-color .2s, color .2s;
}
.launch:hover { border-color: var(--senal); color: var(--senal); }
.no-webgl .launch, html:not(.js) .launch { display: none; }
@media (max-width: 760px) { .hero-place { justify-content: flex-start; } .launch { order: -1; width: 100%; } }

/* Servicios: escenario de partículas pegado a la izquierda */
.services-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.services-stage { position: sticky; top: 5.5rem; height: min(70vh, 34rem); }
#services-canvas { width: 100%; height: 100%; display: block; }
.services-layout .service { grid-template-columns: 1fr; }
.services-layout .service h3 { grid-row: auto; color: var(--liquen); transition: color .3s; }
.services-layout .service.is-active h3 { color: var(--niebla); }
.services-layout .service p { transition: opacity .3s; }
.services-layout .service:not(.is-active) p { opacity: .7; }
@media (max-width: 760px) {
    .services-layout { grid-template-columns: 1fr; gap: 0; }
    .services-stage { top: 4.5rem; height: 16rem; z-index: 1; background: linear-gradient(var(--paramo) 80%, transparent); }
}

/* IMRD: tablets con profundidad que giran con el scroll y el puntero */
.tablets { perspective: 1400px; transform-style: preserve-3d; }
.tablets .shot { transition: transform .15s linear; will-change: transform; }
.tablets .shot-back { transform: rotateY(calc(var(--ry, 0deg) - 14deg)) rotateX(var(--rx, 0deg)) translateZ(-60px) translateY(var(--py, 0px)); }
.tablets .shot-front { transform: rotateY(calc(var(--ry, 0deg) - 14deg)) rotateX(var(--rx, 0deg)) translateZ(90px) translateY(calc(var(--py, 0px) * -1)); }
@media (prefers-reduced-motion: reduce) { .tablets .shot { transform: none; } }

/* Geo Quiz: globo */
.geo-media { background: none; border-radius: 0; position: relative; }
#globe-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
#globe-canvas.grabbing { cursor: grabbing; }
.globe-hint { position: absolute; left: 50%; bottom: .25rem; transform: translateX(-50%); color: var(--liquen); font-size: var(--t-sm); display: none; }
.geo-media.has-globe .globe-hint { display: block; }
.geo-media.has-globe .geo-icon { position: absolute; right: 4%; top: 4%; width: 22%; pointer-events: none; }
.hero-shade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(90deg, rgba(12,23,22,.82) 0%, rgba(12,23,22,.55) 38%, rgba(12,23,22,0) 62%),
                linear-gradient(0deg, rgba(12,23,22,.9) 0%, rgba(12,23,22,0) 28%); }
@media (max-width: 760px) { .hero-shade { background: linear-gradient(0deg, rgba(12,23,22,.95) 0%, rgba(12,23,22,.7) 45%, rgba(12,23,22,0) 70%); } }
