:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --pixel-border: 4px solid #ffffff;
    --navbar-h: 74px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Press Start 2P', cursive;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ── Scanlines CRT ───────────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px, transparent 3px,
        rgba(0,0,0,0.07) 3px, rgba(0,0,0,0.07) 4px
    );
    z-index: 998;
    pointer-events: none;
}

/* ── Viñeta ──────────────────────────────────────────────────────── */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.65) 100%);
    z-index: 997;
    pointer-events: none;
}

/* ── Canvas fondo ────────────────────────────────────────────────── */
#bg-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ==========================================
   UTILIDADES
   ========================================== */
.text-center { text-align: center; }
.center-btn { display: flex; justify-content: center; width: 100%; }
.text-decoration-none { text-decoration: none; }

/* ==========================================
   NAVBAR
   ========================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    background-color: var(--bg-color);
    border-bottom: var(--pixel-border);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: padding 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.navbar.scrolled {
    padding: 0.75rem 2rem;
    background-color: rgba(0,0,0,0.96);
    border-bottom-color: rgba(255,255,255,0.6);
}

.header-left { display: flex; align-items: center; gap: 2rem; }

.logo {
    font-size: 1rem;
    letter-spacing: 2px;
    position: relative;
}

/* Logo glitch on hover */
.logo::before {
    content: 'NAAYYU.EXE';
    position: absolute;
    top: 0; left: 0;
    color: #fff;
    clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
    opacity: 0;
    transition: opacity 0.1s;
}
.logo:hover::before {
    animation: logoGlitch 0.4s steps(1) forwards;
}
@keyframes logoGlitch {
    0%  { opacity:1; transform: translateX(-3px); clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%); }
    25% { opacity:1; transform: translateX(3px);  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); }
    50% { opacity:1; transform: translateX(-2px); clip-path: polygon(0 10%, 100% 10%, 100% 30%, 0 30%); }
    75% { opacity:1; transform: translateX(2px);  clip-path: polygon(0 50%, 100% 50%, 100% 70%, 0 70%); }
    100%{ opacity:0; transform: translateX(0); }
}

.header-icons { display: flex; align-items: center; gap: 1rem; color: #ffffff; }

.header-icon-link {
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s ease, color 0.15s ease;
    color: inherit;
    text-decoration: none;
}
.header-icon-link:hover { transform: scale(1.2); }
.header-icon-link:active { transform: scale(0.9); }

.pixel-icon { width: 20px; height: 20px; display: block; }

/* Botón música navbar */
.music-toggle {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    cursor: pointer;
    padding: 4px 7px;
    line-height: 0;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.music-toggle:hover { transform: scale(1.15); box-shadow: 3px 3px 0px #ffffff; }
.music-toggle:active { transform: scale(0.9) translate(2px,2px); box-shadow: 1px 1px 0px #ffffff; }
.music-toggle.is-playing { animation: musicPulse 1.5s ease-in-out infinite; }

@keyframes musicPulse {
    0%,100% { box-shadow: 0 0 0px rgba(255,255,255,0); }
    50%      { box-shadow: 0 0 10px rgba(255,255,255,0.55); }
}

/* ── Hamburger (mobile) ──────────────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    flex-shrink: 0;
}
.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #ffffff;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.navbar.nav-open .nav-hamburger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.navbar.nav-open .nav-hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.navbar.nav-open .nav-hamburger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ── Nav links ───────────────────────────────────────────────────── */
.nav-links { list-style: none; display: flex; gap: 2rem; }
.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.6rem;
    transition: color 0.2s, letter-spacing 0.2s;
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0;
    width: 0; height: 2px;
    background: #ffffff;
    transition: width 0.2s ease;
}
.nav-links a:hover { color: #cccccc; letter-spacing: 1.5px; }
.nav-links a:hover::after { width: 100%; }

/* ==========================================
   BOTÓN FLOTANTE MÚSICA (FAB)
   ========================================== */
.music-fab {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #000;
    border: 3px solid #ffffff;
    color: #ffffff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 999;
    opacity: 0;
    transform: scale(0.4) translateY(16px);
    pointer-events: none;
    transition:
        opacity 0.35s cubic-bezier(0.34,1.56,0.64,1),
        transform 0.35s cubic-bezier(0.34,1.56,0.64,1),
        box-shadow 0.18s ease;
}
.music-fab.fab-visible { opacity:1; transform:scale(1) translateY(0); pointer-events:auto; }
.music-fab:hover { box-shadow:0 0 0 5px rgba(255,255,255,0.25),0 0 20px rgba(255,255,255,0.15); transform:scale(1.12); }
.music-fab:active { transform:scale(0.93); }
.music-fab.is-playing { animation: fabPulse 1.5s ease-in-out infinite; }
@keyframes fabPulse {
    0%,100% { box-shadow:0 0 0px rgba(255,255,255,0); }
    50%      { box-shadow:0 0 18px rgba(255,255,255,0.4); }
}

/* ==========================================
   SECCIONES
   ========================================== */
section {
    min-height: 100vh;
    padding: 8rem 2rem 4rem;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-bottom: 4px dashed #ffffff;
    width: 100%;
}
#contacto { border-bottom: none; }

/* ── Tipografía ──────────────────────────────────────────────────── */
h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.5;
    text-shadow: 4px 4px 0px #555;
    animation: h1Glitch 8s ease-in-out infinite;
}
@keyframes h1Glitch {
    0%,88%,100% { text-shadow:4px 4px 0px #555; transform:translateX(0); }
    90% { text-shadow:-3px 0 rgba(255,0,80,0.7),3px 0 rgba(0,200,255,0.7),4px 4px 0px #555; transform:translateX(-2px); }
    92% { text-shadow:3px 0 rgba(255,0,80,0.7),-3px 0 rgba(0,200,255,0.7),4px 4px 0px #555; transform:translateX(2px); }
    94% { text-shadow:4px 4px 0px #555; transform:translateX(0); }
    96% { text-shadow:-2px 0 rgba(255,0,80,0.5),2px 0 rgba(0,200,255,0.5); transform:translateX(1px); }
}

h2 {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.5;
}
h2::after {
    content: '_';
    animation: blinkCursor 0.85s step-end infinite;
    margin-left: 2px;
}
@keyframes blinkCursor { 0%,100%{opacity:1;} 50%{opacity:0;} }

p {
    font-size: 0.7rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 2;
}

/* ── Botón genérico ──────────────────────────────────────────────── */
.btn {
    display: inline-block;
    background: var(--bg-color);
    color: var(--text-color);
    padding: 1rem 2rem;
    text-decoration: none;
    font-size: 0.8rem;
    border: var(--pixel-border);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.btn:hover { transform:translate(-4px,-4px); box-shadow:6px 6px 0px #ffffff; }
.btn:active { transform:translate(-1px,-1px); box-shadow:2px 2px 0px #ffffff; }

/* Shimmer sweep on .btn hover */
.btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 0.4s ease;
}
.btn:hover::after { left: 150%; }

/* ==========================================
   CARRUSEL — estructura base
   ========================================== */
.carousel-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    padding: 0;
    position: relative;
}

.carousel-container {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding: 3rem 0;
    scrollbar-width: none;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    /* scroll-snap desactivado en carruseles de video: el bucle infinito JS
       y el snap del navegador se contradicen al hacer el teleport clon→original */
}
.carousel-container::-webkit-scrollbar { display: none; }

.carousel-container .video-card {
    flex: 0 0 auto;
    border: 2px solid #ffffff;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transform: scale(0.75);
    transition: transform 0.5s cubic-bezier(0.25,1,0.5,1), box-shadow 0.3s ease;
    z-index: 1;
    /* scroll-snap-align quitado: lo gestiona el JS con foco 3D */
}
.carousel-container .video-card.active-card {
    transform: scale(1.05);
    z-index: 5;
    box-shadow: 0 0 30px rgba(255,255,255,0.12);
}

.empty-slot { display: none !important; }

/* ── Video overlay ───────────────────────────────────────────────── */
.video-overlay {
    position: absolute;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.85);
    display: flex; justify-content: center; align-items: center;
    z-index: 10;
    cursor: pointer;
    transition: background 0.5s ease, opacity 0.3s ease;
}
.active-card .video-overlay { background: rgba(0,0,0,0.3); }
.video-overlay.hidden { opacity:0; pointer-events:none; }

.play-text {
    color: #fff;
    font-size: 0.8rem;
    border: 2px solid #fff;
    padding: 12px 20px;
    background: #000;
    box-shadow: 0 0 10px rgba(255,255,255,0.3);
    transition: all 0.2s ease;
}
.active-card .play-text { box-shadow:0 0 22px rgba(255,255,255,0.85); }
.video-overlay:hover .play-text { background:#fff; color:#000; transform:scale(1.1); }

/* ── Tamaños de cards ────────────────────────────────────────────── */
.vertical-carousel   .video-card { width: 325px; }
.horizontal-carousel .video-card { width: 440px; }

.video-container { display:flex; justify-content:center; align-items:center; overflow:hidden; background:#000; }
.vertical-ratio   { aspect-ratio: 9/16; }
.horizontal-ratio { aspect-ratio: 16/9; }
.video-container video { width:100%; height:100%; object-fit:contain; outline:none; }

/* ==========================================
   CLIENTES
   ========================================== */
.clients-carousel {
    justify-content: center;
    gap: 2rem;
    padding: 2rem 3rem;
    scroll-snap-type: x mandatory;
}

@keyframes cardSlideUp {
    from { opacity:0; transform:translateY(44px) scale(0.93); }
    to   { opacity:1; transform:translateY(0)    scale(1); }
}

.client-card {
    flex: 0 0 260px;
    border: var(--pixel-border);
    padding: 2rem 1.5rem;
    display: flex; flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    background: #040408;
    scroll-snap-align: center;
    position: relative;
    opacity: 0;
    transform: translateY(44px) scale(0.93);
    transition: box-shadow 0.2s ease;
}
.client-card.card-visible {
    animation: cardSlideUp 0.55s cubic-bezier(0.34,1.38,0.64,1) forwards;
}
.client-card:nth-child(2).card-visible { animation-delay: 0.12s; }
.client-card:hover { box-shadow: 6px 6px 0px #ffffff; }

.client-avatar {
    width: 96px; height: 96px;
    border: 2px solid #ffffff;
    overflow: hidden; flex-shrink: 0;
    background: #111;
}
.client-avatar img {
    width:100%; height:100%;
    object-fit:cover; display:block;
    filter: grayscale(15%) contrast(1.05);
    transition: filter 0.3s ease, transform 0.3s ease;
}
.client-card:hover .client-avatar img { filter:grayscale(0%) contrast(1.1); transform:scale(1.06); }
.client-avatar svg { width:100%; height:100%; display:block; image-rendering:pixelated; }

.client-name { font-size:0.85rem; text-align:center; margin:0; line-height:1.6; letter-spacing:1px; }
.client-tag  { font-size:0.38rem; border:1px solid #444; padding:4px 8px; color:#888; text-align:center; letter-spacing:1px; line-height:1.8; }

.client-stats { display:flex; flex-direction:column; gap:0.6rem; width:100%; margin-top:0.3rem; }
.client-stat  {
    display:flex; align-items:center; gap:0.6rem;
    font-size:0.42rem; border-bottom:1px solid #222; padding-bottom:0.4rem;
}
.client-stat svg    { width:13px; height:13px; flex-shrink:0; color:#888; }
.client-stat-label  { color:#666; flex:1; letter-spacing:1px; }
.client-stat-value  { color:#fff; letter-spacing:1px; }

.client-link {
    display:inline-block; margin-top:0.5rem;
    font-size:0.42rem; color:#aaa; text-decoration:none;
    border:1px solid #444; padding:6px 10px;
    transition: color 0.15s, border-color 0.15s, box-shadow 0.1s, transform 0.1s;
    letter-spacing:1px;
}
.client-link:hover { color:#fff; border-color:#fff; box-shadow:3px 3px 0px #fff; transform:translate(-2px,-2px); }
.client-link:active { transform:translate(0,0); box-shadow:1px 1px 0px #fff; }

/* ==========================================
   FORMULARIO & FOOTER
   ========================================== */
form { display:flex; flex-direction:column; gap:1.5rem; width:100%; max-width:500px; }

input, textarea {
    background: var(--bg-color); color: var(--text-color);
    border: var(--pixel-border); padding:1rem; font-size:0.8rem; width:100%;
    transition: box-shadow 0.15s ease;
}
input:focus, textarea:focus { outline:none; box-shadow:4px 4px 0px #ffffff; }

/* Hover glow on inputs */
input:hover:not(:focus), textarea:hover:not(:focus) {
    box-shadow: 2px 2px 0px rgba(255,255,255,0.35);
}

.footer-info { margin-top:3rem; text-align:center; width:100%; display:flex; flex-direction:column; align-items:center; }
.footer-info p { font-size:0.6rem; margin:0.5rem 0; }

.insert-coin { animation: coinBlink 1.8s step-end infinite; }
@keyframes coinBlink { 0%,49%,100%{opacity:1;} 50%,99%{opacity:0.15;} }

.footer-icons-list {
    display:flex; flex-direction:row; flex-wrap:wrap;
    justify-content:center; align-items:center; gap:1rem;
    margin-top:1.5rem; color:#aaaaaa;
}
.footer-icon-block {
    display:flex; align-items:center; justify-content:center;
    gap:0.5rem; cursor:pointer; color:inherit; text-decoration:none;
    transition: color 0.2s, transform 0.15s;
}
.footer-icon-block:hover { color:#fff; transform:translateY(-2px); }
.separator { font-size:0.8rem; color:#555; }
.footer-icon { width:16px; height:16px; display:block; }
.footer-icon-text { font-size:0.6rem; }

/* ==========================================
   FADE-IN
   ========================================== */
.fade-in { opacity:0; transform:translateY(30px); transition:opacity 0.8s ease-out,transform 0.8s ease-out; }
.fade-in.appear { opacity:1; transform:translateY(0); }

/* ==========================================
   RESPONSIVE — TABLET ≤ 900px
   ========================================== */
@media (max-width: 900px) {
    .vertical-carousel .video-card { width: 280px; }
    .horizontal-carousel .video-card { width: 380px; }
}

/* ==========================================
   RESPONSIVE — MOBILE ≤ 768px
   ========================================== */
@media (max-width: 768px) {

    /* ── Navbar mobile ── */
    :root { --navbar-h: 66px; }

    .navbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.2rem;
        flex-wrap: nowrap;
    }
    .navbar.scrolled { padding: 0.7rem 1.2rem; }

    .header-left { gap: 0.8rem; }
    .logo { font-size: 0.72rem; letter-spacing: 1px; }
    .header-icons { gap: 0.6rem; }
    .pixel-icon { width: 18px; height: 18px; }

    /* Hamburger visible on mobile */
    .nav-hamburger { display: flex; }

    /* Nav links: hidden dropdown on mobile */
    .nav-links {
        display: none;
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(0,0,0,0.98);
        border-bottom: 4px solid #ffffff;
        padding: 1.5rem 2rem;
        gap: 1.6rem;
        z-index: 999;
        align-items: flex-start;
    }
    .navbar.nav-open .nav-links { display: flex; }
    .nav-links a { font-size: 0.7rem; }

    /* ── Sections mobile ── */
    section { padding: 6rem 1rem 3rem; }

    /* ── Typography mobile ── */
    h1 { font-size: 1.4rem; }
    h2 { font-size: 0.85rem; }
    p  { font-size: 0.58rem; }

    /* ── Carousel mobile: reduce 3D scale so cards look good ── */
    .carousel-container {
        gap: 1rem;
        padding: 2rem 0;
        /* sin scroll-snap: el JS maneja la posición en carruseles de video */
    }
    .carousel-container .video-card {
        transform: scale(0.88) !important;
        border-radius: 6px;
    }
    .carousel-container .video-card.active-card {
        transform: scale(1.0) !important;
        box-shadow: 0 0 20px rgba(255,255,255,0.12);
    }

    /* ── Video card widths mobile ── */
    .vertical-carousel   .video-card { width: 78vw; }
    .horizontal-carousel .video-card { width: 82vw; }

    /* ── Clients carousel mobile ── */
    .clients-carousel { padding: 1.5rem 0.5rem; gap: 1rem; }
    .client-card { flex: 0 0 80vw; }

    /* ── Btn mobile ── */
    .btn { font-size: 0.65rem; padding: 0.85rem 1.4rem; }

    /* ── Play text mobile ── */
    .play-text { font-size: 0.65rem; padding: 10px 14px; }

    /* ── FAB mobile ── */
    .music-fab { bottom:1.2rem; right:1.2rem; width:48px; height:48px; }

    /* ── Form mobile ── */
    input, textarea { font-size: 0.65rem; padding: 0.85rem; }
}

/* ==========================================
   RESPONSIVE — SMALL MOBILE ≤ 480px
   ========================================== */
@media (max-width: 480px) {
    h1 { font-size: 1.1rem; }
    h2 { font-size: 0.7rem; }
    .logo { font-size: 0.62rem; }

    .vertical-carousel   .video-card { width: 88vw; }
    .horizontal-carousel .video-card { width: 88vw; }
    .client-card { flex: 0 0 88vw; }

    .header-icons { gap: 0.45rem; }
    .pixel-icon { width: 16px; height: 16px; }

    .music-toggle { padding: 3px 5px; }

    .footer-icons-list { flex-direction: column; gap: 0.8rem; }
    .separator { display: none; }
}
