@import url("./tarjeta-ia.css");
@import url("./tarjeta-data.css");
@import url("./tarjeta-electronica.css");
@import url("./tarjeta-software.css");

/* ==========================================================================
   SECCIÓN: Qué hago
   Minimalismo científico con continuidad visual del Hero
   ========================================================================== */

.what-i-do {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    margin-top: -1px;
    padding: clamp(5.5rem, 9vw, 8.5rem) 0;
    color: var(--text-primary, #f5f7fb);
    background:
        radial-gradient(circle at 18% 18%, rgba(47, 21, 76, 0.16), transparent 34rem),
        radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.018), transparent 42rem),
        linear-gradient(180deg,
            #100817 0%,
            #08050d 18%,
            #050407 52%,
            #020203 100%);
}

[data-theme="light"] .what-i-do,
body[data-theme="light"] .what-i-do,
body.light .what-i-do,
body.light-mode .what-i-do,
body.theme-light .what-i-do {
    color: var(--text-primary, #151515);
    background:
        radial-gradient(circle at 14% 22%, rgba(84, 90, 98, 0.06), transparent 34rem),
        linear-gradient(180deg,
            #f8f5ec 0%,
            #fffaf1 38%,
            #ffffff 100%);
}

.what-i-do::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -4;
    pointer-events: none;
    opacity: 0.065;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 84px 84px;
    mask-image: radial-gradient(circle at 42% 44%, black 0%, transparent 72%);
    -webkit-mask-image: radial-gradient(circle at 42% 44%, black 0%, transparent 72%);
}

[data-theme="light"] .what-i-do::before,
body[data-theme="light"] .what-i-do::before,
body.light .what-i-do::before,
body.light-mode .what-i-do::before,
body.theme-light .what-i-do::before {
    opacity: 0.24;
    background-image:
        linear-gradient(rgba(20, 20, 20, 0.075) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 20, 20, 0.075) 1px, transparent 1px);
}

.what-i-do::after {
    display: none;
}

[data-theme="light"] .what-i-do::after,
body[data-theme="light"] .what-i-do::after,
body.light .what-i-do::after,
body.light-mode .what-i-do::after,
body.theme-light .what-i-do::after {
    display: none;
}

.what-i-do__ambient {
    position: absolute;
    inset: 0;
    z-index: -3;
    pointer-events: none;
}

.what-i-do__ambient::before {
    display: none;
}

.what-i-do__glow {
    position: absolute;
    width: clamp(16rem, 30vw, 30rem);
    aspect-ratio: 1;
    border-radius: 999px;
    filter: blur(54px);
    opacity: 0.2;
    transform: translate3d(0, 0, 0);
}

.what-i-do__glow--one {
    display: none;
}

.what-i-do__glow--two {
    left: -10rem;
    bottom: 2%;
    background: rgba(79, 35, 128, 0.18);
}

[data-theme="light"] .what-i-do__glow,
body[data-theme="light"] .what-i-do__glow,
body.light .what-i-do__glow,
body.light-mode .what-i-do__glow,
body.theme-light .what-i-do__glow {
    opacity: 0.15;
    filter: blur(58px);
}

[data-theme="light"] .what-i-do__glow--two,
body[data-theme="light"] .what-i-do__glow--two,
body.light .what-i-do__glow--two,
body.light-mode .what-i-do__glow--two,
body.theme-light .what-i-do__glow--two {
    background: rgba(84, 90, 98, 0.22);
}

.hero+.what-i-do,
.hero+section.what-i-do,
#inicio+.what-i-do,
#inicio+section.what-i-do {
    margin-top: -1px;
}

.what-i-do__container {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
}

.what-i-do__header {
    max-width: 880px;
    margin-bottom: clamp(2.75rem, 5vw, 4.5rem);
}

.what-i-do__title {
    max-width: 880px;
    margin: 0;
    color: var(--text-primary, #f5f7fb);
    font-size: clamp(2.2rem, 5vw, 4.65rem);
    line-height: 1.06;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

[data-theme="light"] .what-i-do__title,
body[data-theme="light"] .what-i-do__title,
body.light .what-i-do__title,
body.light-mode .what-i-do__title,
body.theme-light .what-i-do__title {
    color: var(--text-primary, #151515);
}

.what-i-do__intro {
    max-width: 780px;
    margin: clamp(1.25rem, 3vw, 1.75rem) 0 0;
    color: var(--text-secondary, rgba(245, 247, 251, 0.72));
    font-size: clamp(1rem, 1.35vw, 1.12rem);
    line-height: 1.8;
    text-wrap: pretty;
}

[data-theme="light"] .what-i-do__intro,
body[data-theme="light"] .what-i-do__intro,
body.light .what-i-do__intro,
body.light-mode .what-i-do__intro,
body.theme-light .what-i-do__intro {
    color: var(--text-secondary, rgba(21, 21, 21, 0.68));
}

.what-i-do__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.35rem);
}

.what-i-do__closing {
    max-width: 780px;
    margin: clamp(2.25rem, 4vw, 3.5rem) 0 0;
    color: rgba(245, 247, 251, 0.82);
    font-size: clamp(1.08rem, 2vw, 1.45rem);
    line-height: 1.7;
    letter-spacing: -0.015em;
}

[data-theme="light"] .what-i-do__closing,
body[data-theme="light"] .what-i-do__closing,
body.light .what-i-do__closing,
body.light-mode .what-i-do__closing,
body.theme-light .what-i-do__closing {
    color: rgba(21, 21, 21, 0.78);
}

/* ==========================================================================
   Tarjetas compartidas
   ========================================================================== */

.what-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 31rem;
    overflow: hidden;
    border: 1px solid var(--card-border, rgba(245, 247, 251, 0.095));
    border-radius: 1.65rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.022)),
        rgba(255, 255, 255, 0.024);
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.065);
    backdrop-filter: blur(18px);
    transform: translate3d(0, 0, 0);
    transition:
        border-color 240ms ease,
        transform 240ms ease,
        box-shadow 240ms ease,
        background 240ms ease,
        opacity 220ms ease,
        filter 220ms ease;
}

.what-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 50% 0%, rgba(196, 174, 255, 0.11), transparent 18rem),
        linear-gradient(135deg, rgba(255, 255, 255, 0.052), transparent 44%);
    opacity: 0.68;
    transition: opacity 240ms ease;
}

.what-card:hover,
.what-card:focus-within,
.what-card.is-active {
    border-color: var(--card-border-active, rgba(196, 174, 255, 0.28));
    transform: translateY(-4px);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.36),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.what-card:hover::before,
.what-card:focus-within::before,
.what-card.is-active::before {
    opacity: 1;
}

[data-theme="light"] .what-card,
body[data-theme="light"] .what-card,
body.light .what-card,
body.light-mode .what-card,
body.theme-light .what-card {
    --card-border: rgba(21, 21, 21, 0.12);
    --card-border-active: rgba(235, 178, 72, 0.28);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.62)),
        rgba(255, 255, 255, 0.7);
    box-shadow:
        0 22px 58px rgba(42, 32, 18, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .what-card::before,
body[data-theme="light"] .what-card::before,
body.light .what-card::before,
body.light-mode .what-card::before,
body.theme-light .what-card::before {
    background:
        radial-gradient(circle at 50% 0%, rgba(235, 178, 72, 0.14), transparent 18rem),
        linear-gradient(135deg, rgba(255, 255, 255, 0.74), transparent 48%);
}

.what-card__visual {
    position: relative;
    display: grid;
    align-items: center;
    flex: 0 0 auto;
    min-height: 15.8rem;
    padding: clamp(1rem, 2vw, 1.25rem);
    color: var(--visual-color, rgba(224, 229, 255, 0.82));
    cursor: pointer;
    outline: none;
}

.what-card__visual:focus-visible {
    border-radius: 1.25rem;
    box-shadow: 0 0 0 3px rgba(196, 174, 255, 0.34);
}

[data-theme="light"] .what-card__visual,
body[data-theme="light"] .what-card__visual,
body.light .what-card__visual,
body.light-mode .what-card__visual,
body.theme-light .what-card__visual {
    color: var(--visual-color, rgba(21, 21, 21, 0.78));
}

[data-theme="light"] .what-card__visual:focus-visible,
body[data-theme="light"] .what-card__visual:focus-visible,
body.light .what-card__visual:focus-visible,
body.light-mode .what-card__visual:focus-visible,
body.theme-light .what-card__visual:focus-visible {
    box-shadow: 0 0 0 3px rgba(235, 178, 72, 0.24);
}

.what-card--software .what-card__visual {
    cursor: default;
}

.what-card__signal {
    position: absolute;
    right: 1.15rem;
    bottom: 1rem;
    max-width: calc(100% - 2rem);
    padding: 0.42rem 0.65rem;
    border: 1px solid rgba(245, 247, 251, 0.12);
    border-radius: 999px;
    background: rgba(7, 9, 18, 0.52);
    color: rgba(245, 247, 251, 0.78);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 220ms ease,
        transform 220ms ease,
        border-color 220ms ease,
        background 220ms ease;
}

.what-card:hover .what-card__signal,
.what-card:focus-within .what-card__signal,
.what-card.is-active .what-card__signal {
    opacity: 1;
    transform: translateY(0);
}

[data-theme="light"] .what-card__signal,
body[data-theme="light"] .what-card__signal,
body.light .what-card__signal,
body.light-mode .what-card__signal,
body.theme-light .what-card__signal {
    border-color: rgba(21, 21, 21, 0.12);
    background: rgba(255, 255, 255, 0.72);
    color: rgba(21, 21, 21, 0.72);
}

.what-card__content {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    padding: 0 clamp(1.25rem, 2.4vw, 1.6rem) clamp(1.45rem, 2.6vw, 1.8rem);
}

.what-card__title {
    margin: 0;
    color: var(--text-primary, #f5f7fb);
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
}

[data-theme="light"] .what-card__title,
body[data-theme="light"] .what-card__title,
body.light .what-card__title,
body.light-mode .what-card__title,
body.theme-light .what-card__title {
    color: var(--text-primary, #151515);
}

.what-card__text {
    margin: 1rem 0 0;
    color: rgba(245, 247, 251, 0.68);
    font-size: 0.98rem;
    line-height: 1.75;
}

[data-theme="light"] .what-card__text,
body[data-theme="light"] .what-card__text,
body.light .what-card__text,
body.light-mode .what-card__text,
body.theme-light .what-card__text {
    color: rgba(21, 21, 21, 0.68);
}

/* Quitar sombra pesada heredada de la ventana de software */
.what-card--software .software-window {
    box-shadow: none;
}

/* ==========================================================================
   Cambio de idioma — transición suave tipo Hero
   ========================================================================== */

.what-i-do__title,
.what-i-do__intro,
.what-i-do__closing,
.what-card {
    transition:
        opacity 220ms ease,
        transform 220ms ease,
        filter 220ms ease,
        border-color 240ms ease,
        box-shadow 240ms ease,
        background 240ms ease;
}

.what-i-do.is-changing-language .what-i-do__title,
.what-i-do.is-changing-language .what-i-do__intro,
.what-i-do.is-changing-language .what-i-do__closing,
.what-i-do.is-changing-language .what-card {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(2px);
}

.what-i-do.is-changing-language .what-card:hover,
.what-i-do.is-changing-language .what-card:focus-within,
.what-i-do.is-changing-language .what-card.is-active {
    transform: translateY(8px);
}

/* ==========================================================================
   Reveal por scroll
   Seguro: si JS falla, el contenido queda visible
   ========================================================================== */

[data-what-reveal] {
    opacity: 1;
    transform: none;
}

.what-i-do.is-ready [data-what-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 700ms ease,
        transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.what-i-do.is-ready [data-what-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

.what-i-do.is-ready.is-scrolling-up [data-what-reveal].is-visible {
    transition-duration: 560ms;
}

/* ==========================================================================
   Alineación visual entre tarjetas principales: IA + Data
   ========================================================================== */

.what-card--ai,
.what-card--data {
    --what-card-visual-safe-height: 21rem;
}

.what-card--ai .what-card__visual,
.what-card--data .what-card__visual {
    min-height: var(--what-card-visual-safe-height);
    display: grid;
    align-content: start;
}

.what-card--data .what-card__visual {
    padding-bottom: 1.35rem;
}

/* ==========================================================================
   Alineación visual entre tarjetas: Electrónica + Software
   ========================================================================== */

.what-card--electronics,
.what-card--software {
    --what-card-visual-safe-height: 20.25rem;
}

.what-card--electronics .what-card__visual,
.what-card--software .what-card__visual {
    min-height: var(--what-card-visual-safe-height);
    height: auto;
    display: grid;
    align-content: center;
}

.what-card--electronics .electronics-system,
.what-card--software .software-window {
    align-self: center;
}

.what-card--software .software-window {
    width: 100%;
}

/* ==========================================================================
   Responsive general: tarjetas en una sola columna
   ========================================================================== */

@media (max-width: 980px) {
    .what-i-do {
        padding: clamp(4.5rem, 8vw, 6rem) 0;
    }

    .what-i-do__grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .what-card {
        width: 100%;
        min-height: auto;
    }

    .what-card:hover,
    .what-card:focus-within,
    .what-card.is-active {
        transform: none;
    }

    .what-card--ai,
    .what-card--data,
    .what-card--electronics,
    .what-card--software {
        --what-card-visual-safe-height: auto;
    }

    .what-card--ai .what-card__visual,
    .what-card--data .what-card__visual,
    .what-card--electronics .what-card__visual,
    .what-card--software .what-card__visual {
        min-height: auto;
        height: auto;
        align-content: center;
    }

    .what-card--data .what-card__visual {
        padding-bottom: 1rem;
    }
}

@media (max-width: 760px) {
    .what-i-do {
        padding: clamp(4rem, 12vw, 5.5rem) 0;
    }

    .what-i-do__container {
        width: min(100% - 1.25rem, 1120px);
    }

    .what-i-do__header {
        margin-bottom: 2.25rem;
    }

    .what-i-do__title {
        font-size: clamp(2rem, 11vw, 3.15rem);
        line-height: 1.08;
        letter-spacing: -0.025em;
    }

    .what-i-do__intro {
        line-height: 1.72;
    }

    .what-i-do__grid {
        gap: 1rem;
    }

    .what-card {
        border-radius: 1.3rem;
    }

    .what-card__visual {
        padding: 0.85rem;
    }

    .what-card__content {
        padding-inline: 1rem;
        padding-bottom: 1.25rem;
    }

    .what-card__title {
        font-size: clamp(1.25rem, 7vw, 1.65rem);
    }

    .what-card__text {
        font-size: 0.94rem;
        line-height: 1.68;
    }

    .what-card__signal {
        right: 0.8rem;
        bottom: 0.75rem;
        font-size: 0.68rem;
    }
}

/* ==========================================================================
   Responsive específico: Ciencia de datos
   ========================================================================== */

@media (max-width: 640px) {
    .data-demo {
        min-height: auto;
    }

    .data-demo__viewport {
        min-height: 17.8rem;
    }

    .data-demo__layout {
        grid-template-columns: 2.25rem minmax(0, 1fr);
        gap: 0.5rem;
        min-height: 17.8rem;
        padding: 0.55rem;
    }

    .data-demo__rail {
        grid-template-columns: 1fr;
        align-content: start;
        gap: 0.38rem;
    }

    .data-demo__tab {
        min-height: 2rem;
        aspect-ratio: 1;
    }

    .data-demo__workspace {
        min-width: 0;
    }

    .data-demo__question {
        font-size: 0.72rem;
        line-height: 1.2;
    }

    .data-demo__panel-stack {
        min-height: 11.7rem;
    }

    .data-chart__svg {
        max-height: 10.9rem;
    }

    .data-demo__footer {
        font-size: 0.49rem;
    }
}

/* ==========================================================================
   Responsive específico: Electrónica
   Mantiene cámara → procesamiento → robot en horizontal y centrado
   ========================================================================== */

@media (max-width: 980px) {
    .electronics-demo {
        min-height: auto;
    }

    .electronics-system {
        grid-template-columns:
            minmax(0, 1fr) 0.72rem minmax(0, 1fr) 0.72rem minmax(0, 1fr);
        gap: 0.42rem;
        min-height: 13.4rem;
        align-items: stretch;
    }

    .electronics-flow {
        display: grid;
        place-items: center;
        align-self: center;
        height: 2.8rem;
        min-width: 0;
    }

    .electronics-flow__line {
        left: 0;
        right: 0;
        top: 50%;
    }

    .electronics-module {
        min-width: 0;
        min-height: 12.6rem;
        padding: 0.85rem 0.42rem 0.72rem;
        display: grid;
        grid-template-rows: 1fr auto;
        align-items: center;
        justify-items: center;
        overflow: hidden;
    }

    .electronics-module__caption {
        align-self: end;
        max-width: 6rem;
        margin-inline: auto;
        font-size: 0.52rem;
        line-height: 1.16;
        text-align: center;
    }

    .electronics-kinect,
    .electronics-board,
    .robot-stage {
        transform: none;
        scale: 0.78;
        transform-origin: center;
        place-self: center;
        margin: auto;
    }

    .electronics-kinect {
        width: 7.25rem;
        height: 6.4rem;
    }

    .electronics-board {
        width: 6.3rem;
        height: 5.8rem;
    }

    .robot-stage {
        width: 7rem;
        height: 6.35rem;
        justify-items: center;
    }

    .robot-svg {
        transform: none;
        margin-inline: auto;
    }
}

@media (max-width: 640px) {
    .electronics-system {
        grid-template-columns:
            minmax(0, 1fr) 0.48rem minmax(0, 1fr) 0.48rem minmax(0, 1fr);
        gap: 0.24rem;
        min-height: 12.7rem;
        align-items: stretch;
    }

    .electronics-module {
        min-height: 12rem;
        border-radius: 0.95rem;
        padding: 0.68rem 0.24rem 0.62rem;
        grid-template-rows: minmax(7.8rem, 1fr) auto;
    }

    .electronics-module__caption {
        max-width: 5.4rem;
        min-height: 2.1em;
        font-size: 0.48rem;
        line-height: 1.12;
        letter-spacing: 0.015em;
    }

    .electronics-flow {
        height: 2.4rem;
    }

    .electronics-command {
        font-size: 0.38rem;
        min-width: 1.05rem;
        padding: 0.1rem 0.14rem;
    }

    .electronics-video-frame {
        width: 0.6rem;
        height: 0.44rem;
    }

    .electronics-kinect,
    .electronics-board,
    .robot-stage {
        transform: none;
        scale: 0.62;
        transform-origin: center;
        place-self: center;
        margin: auto;
    }

    .electronics-kinect {
        translate: 0 0.12rem;
    }

    .electronics-board {
        translate: 0 0.05rem;
    }

    .robot-stage {
        translate: 0 0.08rem;
        justify-items: center;
    }

    .robot-svg {
        transform: none;
        margin-inline: auto;
    }
}

@media (max-width: 420px) {
    .electronics-system {
        grid-template-columns:
            minmax(0, 1fr) 0.38rem minmax(0, 1fr) 0.38rem minmax(0, 1fr);
        gap: 0.18rem;
    }

    .electronics-module {
        min-height: 11.4rem;
        padding-inline: 0.18rem;
    }

    .electronics-module__caption {
        font-size: 0.44rem;
        max-width: 4.9rem;
    }

    .electronics-kinect,
    .electronics-board,
    .robot-stage {
        scale: 0.56;
    }
}

/* ==========================================================================
   Responsive específico: Software
   Mantiene la ventana como editor horizontal
   ========================================================================== */

@media (max-width: 640px) {
    .software-demo {
        min-height: auto;
    }

    .software-window {
        height: 16.85rem;
        min-height: 16.85rem;
        max-height: 16.85rem;
        grid-template-rows: 3.35rem minmax(0, 1fr) 4.25rem;
    }

    .software-window__topbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
        justify-items: stretch;
        gap: 0.45rem;
        min-height: 3.35rem;
        padding: 0.65rem 0.68rem;
    }

    .software-window__traffic {
        gap: 0.24rem;
    }

    .software-window__traffic span {
        width: 0.42rem;
        height: 0.42rem;
    }

    .software-window__file {
        font-size: 0.62rem;
    }

    .software-run {
        min-height: 1.75rem;
        padding: 0.42rem 0.58rem;
        font-size: 0.58rem;
    }

    .software-run__icon {
        border-left-width: 0.38rem;
        border-top-width: 0.24rem;
        border-bottom-width: 0.24rem;
    }

    .software-editor {
        grid-template-columns: 1.8rem 1fr;
    }

    .software-editor__gutter {
        padding: 0.72rem 0.35rem 0.72rem 0.48rem;
        font-size: 0.52rem;
        line-height: 1.45;
    }

    .software-code {
        padding: 0.72rem 0.58rem;
        font-size: 0.52rem;
        line-height: 1.45;
    }

    .software-console {
        padding-inline: 0.7rem;
    }

    .software-console__line {
        font-size: 0.56rem;
    }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .what-i-do *,
    .what-i-do *::before,
    .what-i-do *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }

    [data-what-reveal],
    .what-i-do.is-ready [data-what-reveal] {
        opacity: 1;
        transform: none;
    }

    .what-i-do.is-changing-language .what-i-do__title,
    .what-i-do.is-changing-language .what-i-do__intro,
    .what-i-do.is-changing-language .what-i-do__closing,
    .what-i-do.is-changing-language .what-card {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .what-card__signal {
        opacity: 1;
        transform: none;
    }
}