/* Home: capa propia sobre site.css. */

/* ---------- Hero ---------- */
.h-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: calc(100svh - 4.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(4rem, 10vh, 7rem) 0 clamp(6rem, 14vh, 9rem);
    text-align: center;
}

.h-grid,
.h-grid--lit {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 72px 72px;
    background-position: center top;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 20%, transparent 75%);
    pointer-events: none;
}
.h-grid--lit {
    background-image:
        linear-gradient(rgba(var(--color-primary-rgb), 0.55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.55) 1px, transparent 1px);
    -webkit-mask-image: radial-gradient(circle 220px at var(--mx, 50%) var(--my, 40%), #000, transparent 100%);
    mask-image: radial-gradient(circle 220px at var(--mx, 50%) var(--my, 40%), #000, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s;
}
.h-hero:hover .h-grid--lit { opacity: 1; }

.h-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.95rem 0.45rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--chip);
    backdrop-filter: blur(8px);
    color: var(--muted);
    font-size: 0.82rem;
}
.h-pill i {
    position: relative;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #22c55e;
}
.h-pill i::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: h-ping 2s ease-out infinite;
}
@keyframes h-ping { to { transform: scale(3); opacity: 0; } }

body.site .h-title {
    margin: 1.8rem auto 0;
    font-size: clamp(4.3rem, 11.5vw, 11.5rem);
    font-weight: 600;
    line-height: 0.88;
    letter-spacing: -0.065em;
}
.h-line { display: block; overflow: hidden; padding: 0.04em 0.08em 0.1em; margin: -0.04em -0.08em -0.1em; }
.h-line > span { display: inline-block; }
.js .h-line > span { animation: h-up 1.1s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes h-up { from { transform: translateY(110%); } to { transform: none; } }

.h-sub {
    max-width: 38rem;
    margin: 2rem auto 0;
    color: var(--muted);
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
}
.h-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2.4rem; }
.js .h-fade { animation: h-fade 1s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes h-fade { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.h-scroll {
    position: absolute;
    left: 50%;
    bottom: 1.6rem;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    color: var(--faint);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.h-scroll::after {
    content: "";
    width: 1px;
    height: 2.6rem;
    background: linear-gradient(var(--ink), transparent);
    animation: h-drip 2.2s var(--ease) infinite;
    transform-origin: top;
}
@keyframes h-drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Cinta de capacidades ---------- */
.h-ticker {
    overflow: hidden;
    padding: clamp(1.8rem, 4vw, 3rem) 0;
    border-block: 1px solid var(--line);
}
.h-ticker__track {
    display: flex;
    width: max-content;
    animation: hx-marquee 38s linear infinite;
}
.h-ticker__item {
    display: flex;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 3rem);
    padding-right: clamp(1.5rem, 3vw, 3rem);
    font-size: clamp(2.6rem, 7vw, 6.5rem);
    font-weight: 600;
    letter-spacing: -0.05em;
    line-height: 1;
    white-space: nowrap;
}
.h-ticker__item:nth-child(even) { color: transparent; -webkit-text-stroke: 1.5px var(--faint); }
.h-ticker__item::after {
    content: "";
    width: 0.32em;
    height: 0.32em;
    border-radius: 50%;
    background: var(--color-primary);
}

/* ---------- Manifiesto que se ilumina al hacer scroll ---------- */
.h-manifest-wrap { position: relative; height: 165vh; }
.h-manifest-pin { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; }
body.site .h-manifest {
    margin: 0;
    max-width: 23ch;
    font-size: clamp(2.2rem, 5.8vw, 5.6rem);
    font-weight: 500;
    line-height: 1.04;
    letter-spacing: -0.045em;
}
.h-manifest .w { transition: color 0.35s; }
.js .h-manifest .w { color: var(--faint); opacity: 0.55; transition: color 0.35s, opacity 0.35s; }
.js .h-manifest .w.on { color: var(--ink); opacity: 1; }
.js .h-manifest em.w.on { color: var(--accent-ink); }
.h-manifest em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.02em; }

/* ---------- Servicios apilados ---------- */
.h-stack { display: grid; gap: 1.5rem; }
.h-card {
    position: sticky;
    top: calc(6rem + var(--i) * 1.4rem);
    display: grid;
    gap: 2rem;
    min-height: clamp(22rem, 58vh, 32rem);
    padding: clamp(1.75rem, 4vw, 3.5rem);
    border: 1px solid var(--line);
    border-radius: 1.75rem;
    background: var(--bg-2);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transform-origin: 50% 0;
    transform: scale(var(--s, 1));
    transition: border-color 0.3s;
}
.h-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bg);
    opacity: calc((1 - var(--s, 1)) * 9);
    pointer-events: none;
}
.h-card:hover { border-color: var(--line-strong); }
@media (min-width: 900px) { .h-card { grid-template-columns: 1.1fr 0.9fr; align-items: stretch; } }
.h-card__body { display: flex; flex-direction: column; }
.h-card__meta { display: flex; justify-content: space-between; color: var(--faint); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.h-card__meta b { color: var(--accent-ink); font-weight: 600; }
body.site .h-card h3 {
    margin-top: auto;
    padding-top: 2rem;
    font-size: clamp(2.3rem, 5vw, 4.6rem);
    line-height: 0.95;
    letter-spacing: -0.055em;
}
.h-card p { margin: 1.2rem 0 0; max-width: 38rem; color: var(--muted); font-size: 1.08rem; line-height: 1.55; }
.h-card__go { margin-top: 1.8rem; display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 500; }
.h-card__go span {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    transition: background 0.3s, color 0.3s, transform 0.4s var(--ease), border-color 0.3s;
}
.h-card:hover .h-card__go span { background: var(--color-primary); border-color: var(--color-primary); color: #0a0a0b; transform: rotate(-45deg); }

.h-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 14rem;
    border-radius: 1.2rem;
    background:
        radial-gradient(circle at 50% 50%, rgba(var(--color-primary-rgb), 0.14), transparent 60%),
        var(--bg);
    border: 1px solid var(--line);
    overflow: hidden;
}
.h-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(circle at center, #000, transparent 70%);
    mask-image: radial-gradient(circle at center, #000, transparent 70%);
}
.h-art svg { position: relative; width: min(78%, 22rem); height: auto; overflow: visible; }
.h-art .stroke { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.h-art .accent { fill: none; stroke: var(--color-primary); stroke-width: 1.5; }
.h-art .dot { fill: var(--color-primary); }
.h-art .spin { transform-origin: 160px 120px; animation: h-spin 28s linear infinite; }
.h-art .spin--rev { animation-direction: reverse; animation-duration: 40s; }
.h-art .float { animation: h-float 6s ease-in-out infinite; }
@keyframes h-spin { to { transform: rotate(360deg); } }
@keyframes h-float { 50% { transform: translateY(-8px); } }

/* ---------- Cifras ---------- */
.h-stats { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.h-stat { padding: 2rem 1rem 0 0; }
.h-stat strong {
    display: flex;
    align-items: flex-start;
    gap: 0.04em;
    font-size: clamp(3.4rem, 9vw, 8.5rem);
    font-weight: 600;
    line-height: 0.9;
    letter-spacing: -0.07em;
    font-variant-numeric: tabular-nums;
}
.h-stat__suf {
    margin-top: 0.02em;
    font-size: 0.4em;
    font-style: normal;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    color: var(--accent-ink);
}
.h-stat__suf--pct { margin-top: 0.08em; font-size: 0.3em; }
.h-stat > span { display: block; margin-top: 0.8rem; color: var(--muted); }
@media (min-width: 900px) {
    .h-stats { grid-template-columns: repeat(4, 1fr); }
    .h-stat + .h-stat { padding-left: 1.5rem; border-left: 1px solid var(--line); }
}
@media (max-width: 899px) { .h-stat:nth-child(n+3) { margin-top: 1.5rem; border-top: 1px solid var(--line); } }

/* ---------- Trabajo ---------- */
.h-work { display: grid; gap: clamp(2.5rem, 4vw, 3.5rem) 1.5rem; }
@media (min-width: 900px) {
    .h-work { grid-template-columns: repeat(12, 1fr); }
    .h-work > :nth-child(4n+1), .h-work > :nth-child(4n) { grid-column: span 7; }
    .h-work > :nth-child(4n+2), .h-work > :nth-child(4n+3) { grid-column: span 5; }
    .h-work > :nth-child(4n+2) { margin-top: 6rem; }
    .h-work > :nth-child(4n+1) .site-media__img,
    .h-work > :nth-child(4n) .site-media__img { aspect-ratio: 16 / 11; }
}
.h-work .site-media__img { border-radius: 1.2rem; }
.site-media__img::after {
    content: "Ver proyecto";
    z-index: 2;
    position: absolute;
    left: 50%;
    top: 50%;
    display: grid;
    place-items: center;
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: #0a0a0b;
    font-size: 0.9rem;
    font-weight: 600;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s var(--ease);
}
.site-media--sol .site-media__img::after { content: "Ver solución"; }
.site-media:hover .site-media__img::after { transform: translate(-50%, -50%) scale(1); }
body.site .h-work .site-media__body h3 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); }

/* ---------- Cierre ---------- */
.h-cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(6rem, 14vw, 12rem) 0;
    border-top: 1px solid var(--line);
    text-align: center;
}
.h-cta { background: radial-gradient(ellipse 45% 55% at 50% 100%, rgba(var(--color-primary-rgb), var(--glow)), transparent 75%); }
.h-hero .h-sub, .h-cta p:not(.site-kicker) { color: color-mix(in srgb, var(--ink) 72%, transparent); }

/* Filas con títulos largos (soluciones) */
body.site .hx-list--sm .hx-row__title { font-size: clamp(1.35rem, 2.3vw, 1.95rem); line-height: 1.15; }
body.site .h-cta h2 {
    margin: 1.6rem auto 0;
    max-width: 11ch;
    font-size: clamp(3.4rem, 11vw, 10.5rem);
    line-height: 0.88;
    letter-spacing: -0.065em;
}
.h-cta p:not(.site-kicker) { max-width: 32rem; margin: 1.8rem auto 0; color: var(--muted); font-size: 1.12rem; }
.h-cta__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2.6rem; }

@media (prefers-reduced-motion: reduce) {
    .js .h-line > span, .js .h-fade { transform: none; opacity: 1; animation: none; }
    .h-ticker__track, .h-art .spin, .h-art .float, .h-scroll::after, .h-pill i::after { animation: none; }
    .h-card { position: relative; top: 0; transform: none; }
    .js .h-manifest .w { color: var(--ink); }
    .h-manifest-wrap { height: auto; }
    .h-manifest-pin { position: static; height: auto; padding: 6rem 0; }
}
