/* ==========================================================================
   Home — Studio Magenta
   ========================================================================== */

/* ---- Hero: altura fija al viewport (no sigue “subiendo” al scroll) ---- */

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    height: calc(100dvh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    margin-top: var(--header-height);
    background: var(--color-bg);
    overflow: hidden;
}

.home-hero-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem clamp(1.5rem, 4vw, 4rem);
    background: var(--color-bg);
    position: relative;
    z-index: 1;
    min-height: 0;
    overflow: auto;
}

.home-hero-panel::after {
    display: none;
}

.home-hero-slogan {
    font-family: var(--font-display);
    font-size: clamp(1.85rem, 3.8vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--color-ink);
    margin: 0 0 1rem;
    max-width: 16ch;
    position: relative;
    padding-bottom: 1rem;
}

.home-hero-slogan::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 4.5rem;
    height: 3px;
    background: var(--color-magenta);
    border-radius: 2px;
    transform-origin: left center;
}

.home-hero-kicker {
    margin: 0 0 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-magenta);
}

.home-hero-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--color-muted);
    margin: 1.15rem 0 1.75rem;
    max-width: 32rem;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-outline {
    background: transparent;
    color: var(--color-ink);
    border: 1.5px solid rgba(26, 26, 26, 0.22);
}

.btn-outline:hover {
    border-color: var(--color-magenta);
    color: var(--color-magenta);
    background: transparent;
    transform: translateY(-1px);
}

.home-hero-visual {
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%);
    background: #1a1518;
}

.home-hero-visual .hero-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 1s ease, transform 6s ease;
    display: block;
}

.home-hero-visual .hero-slide.is-active {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
}

.home-hero-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(90deg, rgba(235, 230, 234, 0.4) 0%, transparent 28%);
    pointer-events: none;
}

.hero-slide-dots {
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 3;
    display: flex;
    gap: 0.45rem;
}

.hero-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
}

.hero-dot.is-active,
.hero-dot:hover {
    background: var(--color-magenta);
    transform: scale(1.15);
}

/* Entrada al cargar */
.home-hero-kicker,
.home-hero-slogan,
.home-hero-text,
.home-hero-actions,
.home-hero-visual {
    opacity: 0;
}

.home-hero.is-ready .home-hero-kicker {
    animation: heroIn 0.7s ease 0.1s forwards;
}

.home-hero.is-ready .home-hero-slogan {
    animation: heroIn 0.8s ease 0.22s forwards;
}

.home-hero.is-ready .home-hero-slogan::after {
    animation: lineGrow 0.55s ease 0.55s both;
}

.home-hero.is-ready .home-hero-text {
    animation: heroIn 0.75s ease 0.38s forwards;
}

.home-hero.is-ready .home-hero-actions {
    animation: heroIn 0.75s ease 0.5s forwards;
}

.home-hero.is-ready .home-hero-visual {
    animation: heroVisualIn 1s ease 0.15s forwards;
}

@keyframes heroIn {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes lineGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes heroVisualIn {
    from {
        opacity: 0;
        transform: translateX(28px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- Historia / Timeline ---- */

.home-historia {
    padding: 5.5rem 0 4.5rem;
    background: var(--color-surface);
}

.home-historia-inner {
    width: var(--container);
    margin: 0 auto;
}

.home-historia-head {
    margin-bottom: 2.75rem;
    max-width: 36rem;
}

.timeline {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0 1rem;
    align-items: start;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: center;
}

.timeline-item figure {
    position: relative;
    margin: 0 0 1.1rem;
    aspect-ratio: 5 / 4;
    overflow: hidden;
    background: var(--color-bg);
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(22, 19, 20, 0.1);
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: transform 0.4s ease, box-shadow 0.4s ease, outline-color 0.4s ease;
}

.timeline-item:nth-child(odd) figure {
    transform: rotate(-1.5deg);
}

.timeline-item:nth-child(even) figure {
    transform: rotate(1.5deg);
}

.timeline-item figure::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.timeline-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.timeline-item:hover figure {
    transform: rotate(0deg) translateY(-4px);
    box-shadow: 0 16px 36px rgba(237, 0, 140, 0.18);
    outline-color: rgba(237, 0, 140, 0.35);
}

.timeline-item:hover img {
    transform: scale(1.06);
}

.timeline-marker {
    position: relative;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.timeline-marker::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-magenta);
    transform: translateY(-50%);
}

.timeline-item:first-child .timeline-marker::before {
    left: 50%;
}

.timeline-item:last-child .timeline-marker::before {
    right: 50%;
}

.timeline-dot {
    position: relative;
    z-index: 1;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-magenta);
    border: 3px solid var(--color-surface);
    box-shadow: 0 0 0 2px var(--color-magenta);
}

.timeline-year {
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 1.5vw, 1.35rem);
    font-weight: 700;
    color: var(--color-magenta);
    margin: 0 0 0.25rem;
}

.timeline-label {
    margin: 0;
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    line-height: 1.35;
    color: var(--color-muted);
}

/* ---- Servicios ---- */

.home-servicios {
    padding: 5rem 0 4.5rem;
    background: var(--color-bg);
}

.home-servicios-inner {
    width: var(--container);
    margin: 0 auto;
}

.home-servicios-head {
    margin-bottom: 2.75rem;
    max-width: 36rem;
}

.servicios-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(160px, 18vw);
    gap: 0.9rem;
}

.servicio-tile {
    position: relative;
    min-height: 0;
    border-radius: 20px;
    overflow: hidden;
    background: #1a1a1a;
}

.servicio-tile.is-featured {
    grid-column: span 2;
    grid-row: span 2;
}

.servicio-tile:nth-child(6),
.servicio-tile:nth-child(7) {
    grid-column: span 2;
}

.servicio-tile-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    color: #fff;
}

.servicio-tile-link > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    position: relative;
    z-index: 0;
}

.servicio-tile-slides {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.servicio-tile-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 1.8s ease-in-out, transform 6s ease-out;
    z-index: 0;
}

.servicio-tile-slide.is-active {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
}

.servicio-tile-content {
    position: absolute;
    inset: auto 0 0;
    z-index: 3;
    padding: 1.35rem 1.25rem 1.2rem;
    background: linear-gradient(180deg, transparent 0%, rgba(20, 20, 20, 0.62) 24%, rgba(20, 20, 20, 0.94) 100%);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    pointer-events: none;
    transition: padding 0.35s ease, background 0.35s ease;
}

.servicio-tile:hover .servicio-tile-content,
.servicio-tile:focus-within .servicio-tile-content {
    background: linear-gradient(180deg, transparent 0%, rgba(20, 20, 20, 0.72) 18%, rgba(20, 20, 20, 0.96) 100%);
    padding-bottom: 1.35rem;
}

.servicio-tile.is-featured .servicio-tile-content {
    padding: 1.75rem 1.5rem 1.4rem;
}

.servicio-tile h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.servicio-tile.is-featured h3 {
    font-size: clamp(1.4rem, 2.2vw, 1.85rem);
}

.servicio-tile .servicio-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(6px);
    transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.3s ease;
}

.servicio-tile.is-featured .servicio-list,
.servicio-tile:hover .servicio-list,
.servicio-tile:focus-within .servicio-list {
    max-height: 6rem;
    opacity: 1;
    transform: translateY(0);
}

.servicio-tile .servicio-list li {
    position: relative;
    padding-left: 0.75rem;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.35;
}

.servicio-tile .servicio-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-magenta);
}

.servicio-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    pointer-events: none;
    transition: box-shadow 0.35s ease;
}

.servicio-tile:hover .servicio-tile-link > img,
.servicio-tile:focus-within .servicio-tile-link > img {
    transform: scale(1.06);
}

.servicio-tile:hover .servicio-tile-slide.is-active,
.servicio-tile:focus-within .servicio-tile-slide.is-active {
    transform: scale(1.03);
}

.servicio-tile:hover::after,
.servicio-tile:focus-within::after {
    box-shadow: inset 0 0 0 2px rgba(237, 0, 140, 0.55);
}

.servicios-more {
    margin-top: 2.5rem;
    text-align: center;
}

/* ---- Potencia tu marca ---- */

.home-potencia {
    padding: 5.5rem 0;
    background: var(--color-surface);
}

.home-potencia-inner {
    width: var(--container);
    margin: 0 auto;
    max-width: 40rem;
}

.home-potencia-text {
    font-size: 1.12rem;
    line-height: 1.7;
    color: var(--color-muted);
    margin: 0 0 1.75rem;
}

/* ---- Marcando la diferencia ---- */

.home-legado {
    position: relative;
    padding: 6rem 0;
    color: #fff;
    overflow: hidden;
    min-height: min(520px, 70vh);
    display: flex;
    align-items: center;
}

.home-legado-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.home-legado-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
    animation: legadoKenBurns 22s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes legadoKenBurns {
    from {
        transform: scale(1) translate(0, 0);
    }
    to {
        transform: scale(1.14) translate(-2.5%, 1.5%);
    }
}

.home-legado-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(22, 19, 20, 0.94) 0%, rgba(22, 19, 20, 0.72) 48%, rgba(237, 0, 140, 0.38) 100%);
}

.home-legado-inner {
    position: relative;
    z-index: 1;
    width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2rem;
    align-items: center;
}

.home-legado .section-label {
    color: #ff7ec8;
}

.home-legado .section-title {
    color: #fff;
    margin-bottom: 1rem;
}

.home-legado-copy p {
    color: rgba(255, 255, 255, 0.82);
    margin: 0 0 1.75rem;
    max-width: 38rem;
    font-size: 1.02rem;
    line-height: 1.7;
}

.home-stat {
    text-align: center;
    justify-self: center;
    align-self: center;
}

.home-stat-number {
    font-family: var(--font-display);
    font-size: clamp(3.75rem, 8vw, 6rem);
    font-weight: 800;
    color: var(--color-magenta);
    line-height: 0.95;
    margin: 0;
    text-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.home-stat-label {
    margin: 0.65rem 0 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.02em;
}

@media (max-width: 900px) {
    .home-hero {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        min-height: 0;
    }

    .home-hero-panel {
        padding: 2.25rem 1.5rem 2rem;
        order: 0;
    }

    .home-hero-panel::after {
        display: none;
    }

    .home-hero-slogan {
        max-width: none;
    }

    .home-hero-visual {
        order: 1;
        height: 42vh;
        max-height: 320px;
        clip-path: none;
        background: transparent;
    }

    .home-hero-visual::after {
        display: none;
    }

    .home-legado-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: left;
    }

    .home-stat {
        text-align: center;
        order: -1;
        justify-self: center;
    }

    .timeline {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2.25rem 1rem;
    }

    .timeline-item figure {
        max-width: 140px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 0.85rem;
        border-radius: 12px;
    }

    .timeline-item:nth-child(odd) figure,
    .timeline-item:nth-child(even) figure {
        transform: none;
    }

    .timeline-item:hover figure {
        transform: translateY(-4px);
    }

    .timeline-item:nth-child(3n + 1) .timeline-marker::before {
        left: 50%;
    }

    .timeline-item:nth-child(3n) .timeline-marker::before {
        right: 50%;
    }

    .timeline-item:nth-child(4) .timeline-marker::before {
        left: 50%;
        right: 0;
    }

    .timeline-item:last-child .timeline-marker::before {
        right: 50%;
    }

    .servicios-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: minmax(180px, 28vw);
    }

    .servicio-tile.is-featured {
        grid-column: span 2;
        grid-row: span 1;
        min-height: 240px;
    }

    .servicio-tile:nth-child(6),
    .servicio-tile:nth-child(7) {
        grid-column: span 1;
    }

    .servicio-tile .servicio-list {
        max-height: 4rem;
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .timeline {
        grid-template-columns: 1fr;
        gap: 0;
        max-width: 100%;
        margin: 0 auto;
        position: relative;
    }

    .timeline::before {
        content: "";
        position: absolute;
        top: 0.55rem;
        bottom: 0.55rem;
        left: 50%;
        width: 2px;
        background: var(--color-magenta);
        transform: translateX(-50%);
        z-index: 0;
    }

    .timeline-item {
        display: grid;
        grid-template-columns: 1fr 1.25rem 1fr;
        grid-template-areas:
            "figure marker year"
            "figure marker label";
        column-gap: 0.75rem;
        row-gap: 0.15rem;
        align-items: center;
        text-align: left;
        padding-bottom: 1.5rem;
        position: relative;
        z-index: 1;
    }

    .timeline-item:nth-child(even) {
        grid-template-areas:
            "year marker figure"
            "label marker figure";
        text-align: right;
    }

    .timeline-item:last-child {
        padding-bottom: 0;
    }

    .timeline-marker {
        grid-area: marker;
        height: auto;
        align-self: center;
        margin: 0;
        justify-content: center;
        align-items: center;
        padding: 0;
    }

    .timeline-marker::before {
        display: none;
    }

    .timeline-item:last-child .timeline-marker::before {
        display: none;
    }

    .timeline-year {
        grid-area: year;
        font-size: 1.05rem;
        margin: 0;
        align-self: end;
    }

    .timeline-label {
        grid-area: label;
        font-size: 0.85rem;
        margin: 0;
        align-self: start;
    }

    .timeline-item:nth-child(even) .timeline-year,
    .timeline-item:nth-child(even) .timeline-label {
        text-align: right;
    }

    .timeline-item figure {
        grid-area: figure;
        margin: 0;
        max-width: 120px;
        width: 100%;
        aspect-ratio: 5 / 4;
        border-radius: 12px;
        transform: none !important;
        justify-self: end;
        align-self: center;
    }

    .timeline-item:nth-child(even) figure {
        justify-self: start;
    }

    .timeline-item:hover figure {
        transform: none !important;
    }

    .servicios-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 220px;
        gap: 0.75rem;
    }

    .servicio-tile.is-featured,
    .servicio-tile:nth-child(6),
    .servicio-tile:nth-child(7) {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 0;
    }
}
