/* ============================================================
   ALIENTO STUDIO — INDEX (console foyer)
   The index is the face of a mixing console. Choosing a
   language powers the console on: the wordmark rises to the
   masthead, a breathing master meter appears, and the three
   sections enter as channel strips.
   ============================================================ */

/* ---------- Fonts (local) ---------- */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Outfit';
    src: url('../fonts/outfit-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'AlientoLogo';
    src: url('../fonts/aliento.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Barlow Condensed';
    src: url('../fonts/barlow-condensed-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Barlow Condensed';
    src: url('../fonts/barlow-condensed-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Barlow Condensed';
    src: url('../fonts/barlow-condensed-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/jetbrains-mono-var.woff2') format('woff2');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    /* control-room palette */
    --ink: #0b0d11;
    --panel: #14171d;
    --rail: #1b2129;
    --bone: #e9e5db;
    --dim: #8b909c;
    --cyan: #00e5ff;
    --amber: #ffb454;
    --red: #ff4d4d;
    --line: rgba(233, 229, 219, 0.09);

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-heading: 'Outfit', var(--font-sans);
    --font-cond: 'Barlow Condensed', var(--font-heading);
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);

    /* legacy aliases */
    --bg-dark: var(--ink);
    --bg-surface: var(--panel);
    --bg-surface-hover: var(--rail);
    --text-primary: var(--bone);
    --text-secondary: var(--dim);
    --accent-cyan: var(--cyan);
    --accent-cyan-glow: rgba(0, 229, 255, 0.4);
    --accent-red: var(--red);
    --accent-red-glow: rgba(255, 77, 77, 0.4);
    --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ---------- Base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background:
        radial-gradient(1500px 900px at 50% 36%, #10141b 0%, var(--ink) 62%);
    background-color: var(--ink);
    color: var(--bone);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    animation: pageIn 0.7s ease both;
}

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: rgba(0, 229, 255, 0.28);
    color: var(--bone);
}

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

/* ---------- Entrance choreography (first load) ---------- */
.graticule {
    animation: graticuleIn 1.4s ease both;
}

#welcome-word {
    animation: riseIn 0.7s var(--ease) 0.1s backwards;
}

.brand-letter {
    display: inline-block;
    animation: letterIn 0.6s var(--ease) backwards;
}

.brand-letter--cyan {
    color: var(--cyan);
}

.brand-letter--space {
    width: 0.34em;
}

.lang-key {
    animation: riseIn 0.65s var(--ease) backwards;
}

.lang-key:nth-child(1) {
    animation-delay: 1.05s;
}

.lang-key:nth-child(2) {
    animation-delay: 1.22s;
}

.lang-key:nth-child(3) {
    animation-delay: 1.39s;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes letterIn {
    from {
        opacity: 0;
        transform: translateY(22px) scale(1.15);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes graticuleIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ---------- Ambient graticule (scope glass) ---------- */
.graticule {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 540px at 50% 42%, rgba(0, 229, 255, 0.055), transparent 65%),
        radial-gradient(1300px 760px at 50% 46%, rgba(255, 180, 84, 0.04), transparent 60%),
        repeating-linear-gradient(0deg, rgba(233, 229, 219, 0.028) 0 1px, transparent 1px 58px),
        repeating-linear-gradient(90deg, rgba(233, 229, 219, 0.028) 0 1px, transparent 1px 58px);
    -webkit-mask-image: radial-gradient(760px 460px at 50% 42%, #000 15%, transparent 78%);
    mask-image: radial-gradient(760px 460px at 50% 42%, #000 15%, transparent 78%);
}

/* ---------- Stage ---------- */
.stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.4rem;
    overflow: hidden;
}

/* ---------- Masthead / wordmark ---------- */
#brand-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.15rem;
    text-align: center;
}

#welcome-word {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.42em;
    padding-left: 0.42em; /* optical centering for letter-spacing */
    text-transform: uppercase;
    color: var(--dim);
    transition: opacity 0.5s ease-in-out;
}

.brand-font {
    font-family: 'AlientoLogo', var(--font-heading);
    font-size: clamp(3.4rem, 9.5vw, 5.6rem);
    line-height: 1;
    color: #ffffff;
    font-weight: normal;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.brand-font .brand-letter--cyan {
    color: var(--cyan);
}

/* After a language is chosen the wordmark folds up to the masthead */
#brand-logo.moved {
    --masthead-scale: 0.58;
    --masthead-from: 0.6612;
    position: absolute;
    top: 1.05rem;
    left: 50%;
    z-index: 40;
    flex-direction: row;
    gap: 0.9rem;
    transform: translateX(-50%) scale(var(--masthead-scale));
    transform-origin: top center;
    white-space: nowrap;
    animation: toMasthead 0.7s var(--ease) both;
}

#brand-logo.moved .brand-font {
    font-size: 3.4rem;
}

@keyframes toMasthead {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(var(--masthead-from));
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scale(var(--masthead-scale));
    }
}

/* ---------- Language keys ---------- */
.lang-grid {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-key {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.68rem 1.2rem 0.68rem 0.85rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--bone);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 10px 26px rgba(0, 0, 0, 0.35);
    transition:
        border-color 0.25s ease,
        background-color 0.25s ease,
        transform 0.28s var(--ease),
        box-shadow 0.28s ease;
}

.lang-key:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 229, 255, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 14px 34px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 229, 255, 0.12);
}

.lang-name {
    font-family: var(--font-cond);
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.lang-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dim);
    opacity: 0.45;
    transition: background-color 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.lang-key .lang-led {
    animation: ledCycle 4.5s ease-in-out infinite;
    animation-delay: var(--led-delay, 0s);
}

.lang-key:hover .lang-led,
.lang-switcher.active .lang-led {
    animation-play-state: paused;
    background: var(--cyan) !important;
    opacity: 1 !important;
    box-shadow: 0 0 9px rgba(0, 229, 255, 0.8) !important;
}

.lang-switcher.active {
    border-color: rgba(0, 229, 255, 0.6);
}

@keyframes ledCycle {
    0%, 12% {
        background: var(--dim);
        opacity: 0.45;
        box-shadow: none;
    }
    22%, 38% {
        background: var(--cyan);
        opacity: 1;
        box-shadow: 0 0 9px rgba(0, 229, 255, 0.8);
    }
    50%, 100% {
        background: var(--dim);
        opacity: 0.45;
        box-shadow: none;
    }
}

/* ---------- Channel strips ---------- */
.paths-container {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(1040px, 92vw);
    gap: 1.1rem;
    z-index: 5;
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.96);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.paths-container.visible {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.channel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.35rem 1.5rem 1.4rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012) 42%),
        var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 18px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    transition:
        transform 0.35s var(--ease),
        border-color 0.35s ease,
        box-shadow 0.35s ease;
    opacity: 0;
}

/* channel-on accent line */
.channel::after {
    content: "";
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.55), transparent);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.paths-container.visible .channel {
    animation: channelIn 0.65s var(--ease) both;
    animation-delay: var(--chan-delay, 0s);
}

.channel:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 229, 255, 0.42);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 22px 46px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 229, 255, 0.14);
}

.channel:hover::after {
    opacity: 1;
}

.channel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}

.channel-num {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    color: var(--dim);
}

.channel-icon {
    width: 30px;
    height: 30px;
    color: var(--dim);
    transition: color 0.3s ease;
}

.channel:hover .channel-icon {
    color: var(--cyan);
}

.channel-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dim);
    opacity: 0.45;
    transition: background-color 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.channel:hover .channel-led {
    background: var(--cyan);
    opacity: 1;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.85);
}

/* the classes channel carries the "on air" lamp */
.channel-led--air,
.channel:hover .channel-led--air {
    background: var(--amber);
    opacity: 0.95;
}

.channel:hover .channel-led--air {
    box-shadow: 0 0 10px rgba(255, 180, 84, 0.85);
}

.channel-title {
    font-family: var(--font-cond);
    font-weight: 700;
    font-size: clamp(1.6rem, 2.6vw, 2.15rem);
    line-height: 1.05;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--bone);
    margin: 0 0 0.7rem;
    transition: color 0.3s ease;
}

.channel:hover .channel-title {
    color: #ffffff;
}

.channel-desc {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.62;
    color: var(--dim);
    margin: 0;
}

.channel-desc strong {
    color: var(--bone);
    font-weight: 600;
}

.classes-card {
    display: none;
    border-color: rgba(255, 180, 84, 0.26);
}

.classes-card.visible {
    display: flex;
}

.classes-card:hover {
    border-color: rgba(255, 180, 84, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 22px 46px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 180, 84, 0.16);
}

.classes-card::after {
    background: linear-gradient(90deg, transparent, rgba(255, 180, 84, 0.55), transparent);
}

.channel-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
}

.channel-enter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--dim);
    transition: color 0.3s ease;
}

.channel-enter i {
    font-style: normal;
    transition: transform 0.3s var(--ease);
}

.channel:hover .channel-enter {
    color: var(--cyan);
}

.channel:hover .channel-enter i {
    transform: translateX(4px);
}

/* mini fader */
.channel-fader {
    position: relative;
    width: 26px;
    height: 44px;
}

.channel-fader::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
}

.channel-fader i {
    position: absolute;
    left: 50%;
    top: 58%;
    width: 18px;
    height: 7px;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    background: var(--rail);
    border: 1px solid var(--line);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
    transition: top 0.35s var(--ease), border-color 0.35s ease, box-shadow 0.35s ease;
}

.channel-fader i::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 1px;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.35);
}

.paths-container.visible .channel-fader i {
    animation: faderUp 0.6s var(--ease) var(--fade-delay, 0s) both;
}

.channel:hover .channel-fader i {
    animation: faderPump 1.5s ease-in-out infinite;
    top: 42%; /* static fallback when animation is off (reduced motion) */
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 2px 12px rgba(0, 229, 255, 0.35);
}

.classes-card:hover .channel-fader i {
    border-color: rgba(255, 180, 84, 0.55);
    box-shadow: 0 2px 12px rgba(255, 180, 84, 0.35);
}

/* ---------- Master meter (signature: the page breathes) ---------- */
.master {
    position: fixed;
    top: 4.7rem;
    left: 50%;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    opacity: 0;
    transform: translate(-50%, -8px);
    pointer-events: none;
    transition: opacity 0.7s var(--ease) 0.1s, transform 0.7s var(--ease) 0.1s;
}

.master.on {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.master-meter {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 30px;
    width: min(400px, 74vw);
}

.master-meter i {
    flex: 1;
    border-radius: 1px 1px 0 0;
    background: linear-gradient(180deg, var(--cyan), rgba(0, 229, 255, 0.3));
    transform-origin: bottom;
    animation: breath 3.6s ease-in-out infinite;
}

.master-meter i:nth-last-child(-n + 4) {
    background: linear-gradient(180deg, var(--amber), rgba(255, 180, 84, 0.28));
}

@keyframes breath {
    0%, 100% {
        transform: scaleY(0.16);
        opacity: 0.35;
    }
    45%, 55% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ---------- Status line (typewriter) ---------- */
#typewriter-text {
    position: absolute;
    bottom: 4.5vh;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    color: var(--dim);
    min-height: 1.4em;
}

#typewriter-text::after {
    content: "▍";
    margin-left: 2px;
    color: var(--cyan);
    animation: caret 1.1s steps(1) infinite;
}

@keyframes caret {
    50% {
        opacity: 0;
    }
}

/* ---------- Change-language key (sits where MASTER used to be) ---------- */
.change-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(11, 13, 17, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--bone);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s var(--ease);
}

.change-lang-btn.visible {
    animation: fadeUp 0.5s ease 0.55s backwards;
}

.change-lang-btn:hover {
    border-color: rgba(0, 229, 255, 0.5);
    color: var(--cyan);
    transform: translateY(-2px);
}

.change-lang-btn svg {
    width: 14px;
    height: 14px;
}

/* ---------- Keyframes ---------- */
@keyframes pageIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes marquee {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes channelIn {
    from {
        opacity: 0;
        transform: translateY(26px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes faderUp {
    from {
        top: 88%;
    }
    to {
        top: 58%;
    }
}

@keyframes faderPump {
    0%, 100% {
        top: 58%;
    }
    50% {
        top: 36%;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    #brand-logo.moved {
        --masthead-scale: 0.5;
        --masthead-from: 0.57;
        top: 0.85rem;
    }

    .stage {
        gap: 1.4rem;
    }

    .master {
        top: 3.7rem;
    }

    .master-meter {
        height: 22px;
        width: min(300px, 64vw);
    }

    .paths-container {
        flex-direction: column;
        gap: 0.8rem;
        width: min(92%, 430px);
        max-height: 60vh;
        overflow-y: auto;
        padding: 0.2rem 0.2rem 0.5rem;
        scrollbar-width: none;
    }

    .paths-container::-webkit-scrollbar {
        display: none;
    }

    .paths-container.visible {
        transform: translate(-50%, -50%) scale(1);
    }

    .channel {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem 0.75rem;
        padding: 1.15rem 1.25rem;
    }

    .channel-head {
        flex: 1 1 100%;
        margin-bottom: 0.25rem;
    }

    .channel-title {
        flex: 1 1 100%;
        margin-bottom: 0.35rem;
        font-size: 1.4rem;
    }

    .channel-desc {
        flex: 1 1 0;
        min-width: 0;
        align-self: center;
        font-size: 0.87rem;
    }

    .channel-enter {
        flex: 0 0 auto;
        align-self: center;
    }

    .channel-fader {
        display: none;
    }

    .channel-foot {
        display: contents;
    }

    /* Marquee: one line, scrolls and loops, fades at the right edge */
    .channel-desc.is-marquee {
        white-space: nowrap;
        overflow: hidden;
        -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent);
        mask-image: linear-gradient(90deg, #000 86%, transparent);
    }

    .channel-desc-track {
        display: inline-block;
        white-space: nowrap;
        will-change: transform;
        animation: marquee linear infinite;
    }

    .channel-desc-copy {
        display: inline-block;
        white-space: nowrap;
    }

    #typewriter-text {
        bottom: 3vh;
        font-size: 0.76rem;
    }

    .lang-grid {
        gap: 0.6rem;
        padding: 0 0.4rem;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .lang-key {
        width: 100%;
        justify-content: center;
        padding: 1.15rem 0.95rem 1.15rem 0.7rem;
    }

    .lang-name {
        font-size: 0.88rem;
    }
}

@media (max-width: 520px) {
    #brand-logo.moved {
        --masthead-scale: 0.44;
        --masthead-from: 0.5016;
    }
}

/* Compacta la escena en pantallas bajas para que nunca haga falta scroll vertical */
@media (max-width: 768px) and (max-height: 700px) {
    #brand-logo {
        gap: 0.6rem;
    }

    .brand-font {
        font-size: 2.6rem;
    }

    #welcome-word {
        font-size: 0.72rem;
    }

    .stage {
        gap: 1.1rem;
    }

    .lang-key {
        padding: 0.85rem 0.95rem 0.85rem 0.7rem;
    }

    #typewriter-text {
        bottom: 2.5vh;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01s !important;
    }

    .master-meter i {
        animation: none;
        transform: scaleY(0.45);
        opacity: 0.55;
    }

    .channel-desc.is-marquee .channel-desc-track {
        animation: none !important;
    }

    #typewriter-text::after {
        animation: none;
        opacity: 0.6;
    }
}
