/* ========== Estilos compartidos por los dos sitios. Colores y tipografías: sites/<sitio>/css/brand.css ========== */

body.light-mode .ttt-lateral-icon {
    color: var(--bg);
    background: var(--text);
}

body.light-mode .stats-card {
    background: var(--plane);
}

body.light-mode .project-card {
    background: var(--bg-card);
}

.theme-toggle {
    background: var(--plane);
    color: var(--text);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s;
    margin-left: 0.5rem;
}

.theme-toggle:hover {
    background: var(--plane-hi);
}

/* ========== LANGUAGE SELECTOR ========== */
.lang-selector {
    position: relative;
    margin-left: 0.3rem;
}

.lang-btn {
    background: var(--plane);
    color: var(--text);
    width: 42px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: transform 0.15s;
}

.lang-btn:hover {
    background: var(--plane-hi);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    display: none;
    flex-direction: column;
    z-index: 100;
    min-width: 120px;
}

.lang-dropdown.open {
    display: flex;
}

.lang-option {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-option:hover {
    background: var(--accent-dim);
}

.lang-option.active {
    color: var(--accent);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
/* Sin bordes en ningún sitio: los planos se separan por color (--plane). Los botones nativos traen uno propio. */
button { border: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 1.1rem;
    line-height: 1.7;
    transition: background-color 0.4s, color 0.4s;
}

/* ========== SNAKE CANVAS ========== */
#snake-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    opacity: 0.32;
    pointer-events: none;
}

/* ========== MOUSE EFFECTS ========== */
@property --glow {
    syntax: '<color>';
    inherits: true;
    initial-value: rgba(74, 144, 217, 0.7);
}

.cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    transform: translate3d(var(--gx, -300px), var(--gy, -300px), 0) translate(-50%, -50%);
    mix-blend-mode: screen;
    will-change: transform;
    transition: --glow 3s linear, opacity 0.3s;
}

body.light-mode .cursor-glow {
    mix-blend-mode: multiply;
}

.ripple {
    position: fixed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    background: var(--accent);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.35;
}

.ripple.animate {
    animation: ripple-expand 0.6s ease-out forwards;
}

@keyframes ripple-expand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, .nav-name, .hero-title {
    font-family: var(--font-display);
    font-weight: 800;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ========== NAV ========== */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(37, 37, 37, 0.42);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    height: 72px;
}

body.light-mode nav {
    background: rgba(255, 255, 255, 0.6);
}

.nav-name {
    font-size: 1.8rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
}

.nav-name span {
    color: var(--red);
    animation: dotColorCycle 10s ease infinite;
}

@keyframes dotColorCycle {
    0%    { color: var(--red); }
    25%   { color: var(--yellow); }
    50%   { color: var(--green); }
    75%   { color: var(--accent); }
    100%  { color: var(--red); }
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;
    position: relative;
    transition: color 0.2s;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0; bottom: -4px;
    width: 0; height: 3px;
    background: var(--red);
    transition: width 0.25s;
}

.nav-links a:hover::after { width: 100%; }
.nav-links a:hover { color: var(--red); }

/* ========== LAYOUT ========== */
.content-wrap {
    position: relative;
    z-index: 1;
}

.section-container {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

section {
    padding: 6rem 0;
}

/* ========== REVEAL ANIMATION ========== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== HERO ========== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 72px;
}

.hero .section-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 3.5rem;
}

.hero-left {
    max-width: 600px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 2rem;
}

.hero-label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--red);
    padding: 0.3rem 0.8rem;
    margin-bottom: 1.5rem;
    transform: rotate(-2deg);
    background: rgba(255, 77, 77, 0.14);
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    opacity: 0.6;
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
}

.hero-title {
    font-size: clamp(4rem, 10vw, 9rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.hero-title .accent {
    position: relative;
    display: inline-block;
}

.hero-title .accent::after {
    content: '';
    position: absolute;
    left: -4px;
    right: -4px;
    bottom: 0.04em;
    height: 0.22em;
    background: linear-gradient(90deg, var(--red), var(--yellow), var(--accent), var(--green), var(--red));
    background-size: 300% 100%;
    animation: thickLineWarp 8s linear infinite;
    z-index: -1;
}

.hero-desc {
    font-size: 1.15rem;
    line-height: 1.7;
    text-align: left;
    max-width: 560px;
    color: var(--text);
    opacity: 0.6;
    margin-bottom: 2rem;
}

.hero-ctas {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.btn-primary {
    display: inline-block;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    background: #BE0338;
    color: #fff;
    padding: 0.85rem 2rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.btn-primary:hover {
    transform: translate(-3px, -3px);
    background: #F40F50;
}

.about-cta {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.btn-ghost {
    display: inline-block;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    background: var(--plane);
    color: var(--text);
    padding: 0.85rem 2rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.btn-ghost:hover {
    transform: translate(-3px, -3px);
    background: rgba(255, 77, 77, 0.08);
}

/* ========== HERO ENTRANCE ========== */
.hero-left > * {
    opacity: 0;
    transform: translateY(30px);
    animation: heroStagger 0.7s ease forwards;
}

.hero-left > *:nth-child(1) { animation-delay: 0.1s; }
.hero-left > *:nth-child(2) { animation-delay: 0.2s; }
.hero-left > *:nth-child(3) { animation-delay: 0.3s; }
.hero-left > *:nth-child(4) { animation-delay: 0.4s; }
.hero-left > *:nth-child(5) { animation-delay: 0.5s; }
.hero-left > *:nth-child(6) { animation-delay: 0.6s; }

@keyframes heroStagger {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== DECORATIVE ELEMENTS ========== */
.blue-dot {
    width: 12px;
    height: 12px;
    background: var(--red);
    border-radius: 50%;
    margin-right: 0.6rem;
    vertical-align: middle;
    display: inline-block;
}

#sobre-mi .blue-dot { background: var(--accent); }
#proyectos .blue-dot { background: var(--red); }
#contacto .blue-dot { background: var(--yellow); }

.thick-line {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--red), var(--yellow), var(--accent), var(--green), var(--red));
    background-size: 300% 100%;
    animation: thickLineWarp 8s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes thickLineWarp {
    0%   { background-position: 0% 0; }
    100% { background-position: 300% 0; }
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    color: var(--text);
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    display: block;
}

/* ========== SOBRE MI ========== */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text);
    opacity: 0.8;
}

.about-text p {
    margin-bottom: 1.2rem;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 2rem;
}

.skill-tag {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.45rem 1rem;
    background: var(--plane);
    color: var(--text);
    transition: transform 0.12s, background 0.12s, color 0.12s;
}

.skill-tag:nth-child(3n+1):hover { background: rgba(255, 77, 77, 0.12); color: var(--red); }
.skill-tag:nth-child(3n+2):hover { background: rgba(74, 144, 217, 0.12); color: var(--accent); }
.skill-tag:nth-child(3n):hover { background: rgba(240, 192, 64, 0.12); color: var(--yellow); }

.skill-tag:hover {
    transform: translate(-2px, -2px);
}

.about-aside {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stats-card {
    padding: 1.5rem;
    background: rgba(26, 26, 26, 0.5);
    max-width: 340px;
    margin-left: 20%;
}

.stats-card-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    color: var(--text);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.65rem 0;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
}

.stat-value.highlight {
    color: var(--red);
}

/* ========== PROYECTOS ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.project-card:nth-child(1) { --card-color: #0079fa; } /* Super Proyecto Isaac - azul oscuro */
.project-card:nth-child(2) { --card-color: #FF8C32; } /* CTMV - naranja */
.project-card:nth-child(3) { --card-color: #d41515; } /* Sandwich - burdeos/rojo oscuro */
.project-card:nth-child(4) { --card-color: #00ddfa; } /* Proyecto Isaac - azul claro */
.project-card:nth-child(5) { --card-color: #b3155f; } /* 2069 - vino/violeta */
.project-card:nth-child(6) { --card-color: #05f2db; } /* Una semana online - cyan */
.project-card:nth-child(7) { --card-color: #FFFFFF; } /* Videojuegos en serie - blanco */
.project-card:nth-child(8) { --card-color: #F1C40F; } /* Game Work Jam - amarillo */
.project-card:nth-child(9) { --card-color: #27AE60; } /* Diseño de marcas - verde */

body.light-mode .project-card:nth-child(7) { --card-color: #1A1A1A; } /* En light, blanco pasa a oscuro */

.project-card {
    background: rgba(26, 26, 26, 0.6);
    position: relative;
    transition: transform 0.2s;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: var(--card-color, var(--accent));
    z-index: 2;
}

.project-card:hover {
    transform: translate(-3px, -3px);
    background: color-mix(in srgb, var(--card-color, var(--accent)) 16%, var(--bg-card));
}

.project-thumb {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.project-body {
    padding: 1.5rem 2rem 2rem 2rem;
}

.project-genre {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--card-color, var(--red));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.6rem;
}

.project-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
    color: var(--text);
}

.project-desc {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    opacity: 0.6;
    margin-bottom: 1.5rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    background: var(--bg);
    color: var(--text);
    opacity: 0.8;
}

/* ========== CONTACTO ========== */
.contact-section {
    text-align: center;
    padding: 7rem 0;
}

.contact-inner {
    display: inline-block;
}

.contact-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.contact-email {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--text);
    text-decoration: none;
    position: relative;
    display: inline-block;
    margin-bottom: 2.5rem;
}

.contact-email::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    bottom: -4px;
    height: 4px;
    background: linear-gradient(90deg, var(--red), var(--yellow), var(--accent));
}

.contact-email:hover {
    color: var(--red);
}

.social-links {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.social-link {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    background: var(--plane);
    padding: 0.5rem 1rem;
    transition: transform 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}

.social-link:nth-child(1):hover { background: #E1306C; color: #fff; }
.social-link:nth-child(2):hover { background: var(--accent); color: #fff; }
.social-link:nth-child(3):hover { background: var(--yellow); color: var(--bg); }
.social-link:nth-child(4):hover { background: var(--red); color: #fff; }

.btn-cv {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text);
    background: var(--plane);
    padding: 0.4rem 0.8rem;
    text-decoration: none;
    margin-top: 0.75rem;
    margin-left: 0.5rem;
    transition: transform 0.15s, background 0.15s, color 0.15s;
}

.btn-cv:hover {
    transform: translate(-2px, -2px);
    background: var(--accent);
    color: #fff;
}

.btn-cv svg { width: 16px; height: 16px; fill: currentColor; }

.social-link:hover {
    transform: translate(-3px, -3px);
}

/* ========== FOOTER ========== */
footer {
    background: var(--plane);
    color: var(--text);
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    opacity: 0.6;
    text-align: center;
}

.footer-socials {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-socials a {
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
}

.footer-socials a:nth-child(1):hover { opacity: 1; color: #E1306C; }
.footer-socials a:nth-child(2):hover { opacity: 1; color: var(--accent); }
.footer-socials a:nth-child(3):hover { opacity: 1; color: var(--yellow); }
.footer-socials a:nth-child(4):hover { opacity: 1; color: var(--red); }

.footer-socials a svg { width: 16px; height: 16px; fill: currentColor; }

footer .footer-hint {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* ========== TATETI LATERAL (Bottom-Left) ========== */
.ttt-lateral {
    position: fixed;
    left: 1.5rem;
    bottom: 1.5rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.ttt-lateral:hover { opacity: 0.85; }

.ttt-lateral-icon {
    width: 34px;
    height: 34px;
    background: var(--text);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    transition: transform 0.15s;
}

.ttt-lateral-icon:hover {
    transform: translate(-2px, -2px);
}

.ttt-lateral-board {
    display: grid;
    grid-template-columns: repeat(3, 28px);
    grid-template-rows: repeat(3, 28px);
    gap: 2px;
    padding: 3px;
    background: var(--border-dim);
}

.ttt-lateral-cell {
    background: var(--bg-card);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    font-family: var(--font-display);
    cursor: pointer;
    transition: background 0.12s;
}

.ttt-lateral-cell:hover:not(.taken) { background: rgba(255, 77, 77, 0.1); }
.ttt-lateral-cell.x { color: var(--accent); }
.ttt-lateral-cell.o { color: var(--red); }
.ttt-lateral-cell.winner { background: var(--red); color: var(--bg); }

.ttt-lateral-status {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
}

.ttt-lateral-status.x { color: var(--accent); }
.ttt-lateral-status.o { color: var(--red); }
.ttt-lateral-status.win { color: var(--red); }
.ttt-lateral-status.draw { color: var(--text); opacity: 0.5; }

.ttt-lateral-reset {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--plane);
    color: var(--text);
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    transition: transform 0.12s;
}

.ttt-lateral-reset:hover {
    background: var(--plane-hi);
}

/* ========== TATETI POPUP ========== */
.ttt-popup {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
}

.ttt-popup.active { display: flex; }

.ttt-popup-board {
    display: grid;
    grid-template-columns: repeat(3, 90px);
    grid-template-rows: repeat(3, 90px);
    gap: 4px;
    padding: 4px;
    background: var(--text);
}

.ttt-popup-cell {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    font-weight: 800;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.12s;
}

.ttt-popup-cell:hover:not(.taken) { background: #1a1a1a; }
.ttt-popup-cell.x { color: var(--accent); }
.ttt-popup-cell.o { color: var(--red); }
.ttt-popup-cell.winner { background: var(--red); color: var(--bg); }

.ttt-popup-status {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    color: var(--text);
}

.ttt-popup-status.x { color: var(--accent); }
.ttt-popup-status.o { color: var(--red); }
.ttt-popup-status.win { color: var(--red); animation: pulse 0.5s infinite; }
.ttt-popup-status.draw { color: var(--text); opacity: 0.5; }

@keyframes pulse { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.1); } }

.ttt-popup-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 2rem;
    color: var(--text);
    cursor: pointer;
    background: var(--plane);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    transition: transform 0.12s;
}

.ttt-popup-close:hover {
    transform: translate(-2px, -2px);
    background: var(--plane-hi);
}

.ttt-popup-reset {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    background: var(--plane);
    color: var(--text);
    padding: 0.6rem 1.8rem;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s;
}

.ttt-popup-reset:hover {
    transform: translate(-2px, -2px);
    background: rgba(232, 232, 232, 0.1);
}

/* ========== CUBE CONTAINER ========== */
.cube-wrapper {
    background: transparent;
    padding: 1rem;
    position: relative;
}

.cube-wrapper-label {
    position: absolute;
    top: -14px;
    left: 16px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg);
    padding: 0 0.5rem;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#cube-container {
    width: 380px;
    height: 380px;
    cursor: grab;
    touch-action: none; /* el arrastre es del cubo, no del scroll */
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

#cube-container canvas { display: block; touch-action: none; }

.cube-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 1.6rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-dim);
}

.cube-hud b { color: var(--text); font-weight: 500; }

.cube-solved {
    background: var(--yellow);
    color: #0F0F0F;
    padding: 0.05rem 0.6rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(4px) scale(0.9);
    transition: opacity 0.2s, transform 0.2s;
}

.cube-solved.show { opacity: 1; transform: none; }

#cube-container:active { cursor: grabbing; }

.cube-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

.cube-btn {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--plane);
    color: var(--text);
    padding: 0.35rem 0.8rem;
    cursor: pointer;
    transition: transform 0.12s;
}

.cube-btn:hover {
    transform: translate(-2px, -2px);
    background: var(--plane-hi);
}

.hero-right {
    flex: 0 0 auto;
}

/* ========== SNAKE HINT ========== */
.snake-hint {
    position: fixed;
    bottom: 1rem;
    right: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    opacity: 0.2;
    z-index: 10;
    color: var(--text);
}

/* ========== SCROLL TO TOP ========== */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 5rem;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.2s;
    z-index: 100;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translate(-2px, -2px);
    background: var(--plane-hi);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .hero .section-container {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .hero-left {
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-left {
        align-items: center;
    }

    .hero-desc { text-align: center; }

    .hero-ctas { justify-content: center; }

    #cube-container {
        width: 300px;
        height: 300px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .nav-links { gap: 1rem; }

    nav {
        padding: 0 1.5rem;
    }

    .section-container {
        padding: 0 1.5rem;
    }

    footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: clamp(2.8rem, 12vw, 5rem);
    }

    #cube-container {
        width: 260px;
        height: 260px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .nav-links a { font-size: 0.85rem; }
    .nav-links { gap: 0.8rem; }

    nav { height: 60px; }

    section { padding: 4rem 0; }

    .ttt-lateral { left: 1rem; bottom: 1rem; }
}

/* ========== CLIENTES ========== */
#clientes { padding: 6rem 0; }

.clients-grid {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.5rem;
}

/* Los logos están pensados para fondo claro: la tarjeta es clara en ambos temas. */
.client-cell {
    flex: 0 1 172px;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 5 / 3;
    padding: 0.9rem;
    background: #F5F5F0;
    transition: transform 0.15s;
}

.client-cell img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    mix-blend-mode: multiply; /* el blanco propio de cada logo desaparece contra la tarjeta */
    filter: grayscale(1);
    opacity: 0.75;
    transition: filter 0.2s, opacity 0.2s;
}

.client-cell:hover {
    transform: translate(-3px, -3px);
}

body.light-mode .client-cell { background: #fff; }

.client-cell:hover img { filter: none; opacity: 1; }

@media (max-width: 600px) {
    .client-cell { flex-basis: calc(50% - 0.5rem); }
}

/* Si el navegador no tiene WebGL, el cubo avisa en vez de quedar vacío. */
#cube-container.cube-failed {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: center;
    padding: 1rem;
    background: var(--plane);
}
#cube-container.cube-failed::after { content: 'WebGL no disponible en este navegador'; }

/* ========== MÓVIL ========== */
.cube-controls { flex-wrap: wrap; }
.hero-right, .cube-wrapper { min-width: 0; max-width: 100%; }

@media (max-width: 600px) {
    .nav-link-item { display: none; } /* los CTA del hero ya llevan a Proyectos y Contacto */
    .nav-name { font-size: 1.05rem; }
    .cube-wrapper { padding: 0.5rem; }
    .cube-controls { justify-content: center; }
}

/* Títulos de sección con palabras largas ("COLABORADORES"): que achiquen y, si hace falta, corten. */
.section-title { overflow-wrap: anywhere; }
@media (max-width: 600px) {
    .section-title { font-size: clamp(1.7rem, 8.6vw, 3rem); }
    .section-container { padding: 0 1.25rem; }
}
