/* ==========================================================================
   SISTEMA DE DISEÑO - MODO OSCURO MODERNO (TECH / DEV)
   ========================================================================== */
:root {
    /* Fondos y Superficies */
    --bg-body: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-hover: #1e293b;
    --bg-card: #151f32;
    --bg-input: #0e1626;
    --bg-input-focus: #111a2d;
    --bg-hero: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(15, 23, 42, 0.8) 100%);
    --bg-nav: rgba(17, 24, 39, 0.85);
    --bg-placeholder: linear-gradient(135deg, #0f1d35 0%, #1a2a4a 50%, #0e1626 100%);
    --bg-card-label: rgba(11, 15, 25, 0.85);
    --dot-color: rgba(56, 189, 248, 0.05);

    /* Superposiciones (hover de links y botones secundarios) */
    --overlay-soft: rgba(255, 255, 255, 0.04);
    --overlay-hover: rgba(255, 255, 255, 0.08);
    --overlay-strong: rgba(255, 255, 255, 0.1);
    --overlay-border: rgba(255, 255, 255, 0.25);
    --border-card-label: rgba(255, 255, 255, 0.05);

    /* Bordes sutiles y estados */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.12);
    --border-active: #38bdf8;

    /* Paleta de Acentos Tech */
    --accent-cyan: #38bdf8;
    --accent-cyan-hover: #0ea5e9;
    --accent-indigo: #818cf8;
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
    --accent-glow: rgba(56, 189, 248, 0.25);
    --on-accent: #0b0f19;
    --title-gradient: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);

    /* Estados */
    --status-color: #34d399;
    --error-color: #f87171;

    /* Textos */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #9ca3af;
    --text-highlight: #e2e8f0;

    /* Sombras modernas */
    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.2);
    --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.3);

    /* Radios y Transiciones */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   MODO CLARO - misma identidad, solo cambian superficies, textos y sombras
   ========================================================================== */
:root[data-theme="light"] {
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-card: #f8fafc;
    --bg-input: #f8fafc;
    --bg-input-focus: #ffffff;
    --bg-hero: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.92) 100%);
    --bg-nav: rgba(255, 255, 255, 0.85);
    --bg-placeholder: linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 50%, #f1f5f9 100%);
    --bg-card-label: rgba(255, 255, 255, 0.9);
    --dot-color: rgba(2, 132, 199, 0.1);

    --overlay-soft: rgba(15, 23, 42, 0.03);
    --overlay-hover: rgba(15, 23, 42, 0.06);
    --overlay-strong: rgba(15, 23, 42, 0.07);
    --overlay-border: rgba(15, 23, 42, 0.2);
    --border-card-label: rgba(15, 23, 42, 0.06);

    --border-subtle: rgba(15, 23, 42, 0.1);
    --border-card: rgba(15, 23, 42, 0.13);
    --border-active: #0284c7;

    --accent-cyan: #0369a1;
    --accent-cyan-hover: #075985;
    --accent-glow: rgba(2, 132, 199, 0.2);
    --on-accent: #ffffff;
    --title-gradient: linear-gradient(135deg, #0f172a 30%, #475569 100%);

    --status-color: #047857;
    --error-color: #b91c1c;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-highlight: #1e293b;

    --shadow-subtle: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.14);
    --shadow-glow: 0 0 25px rgba(2, 132, 199, 0.15);
    --shadow-hover: 0 4px 14px rgba(15, 23, 42, 0.1);
}

/* --- RESET Y BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 16px;
    /* Patrón de puntos sutil de fondo */
    background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
    background-size: 24px 24px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 {
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
    font-weight: 700;
}

/* --- ACCESIBILIDAD --- */
:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 200;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-150%);
    transition: transform var(--transition-fast);
}

.skip-link:focus {
    transform: translateY(0);
}

/* --- CABECERA HERO --- */
.hero-header {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-hero);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    box-shadow: var(--shadow-subtle);
    position: relative;
    overflow: hidden;
}

/* Efecto de resplandor ambiental superior */
.hero-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 160px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.avatar-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.avatar-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-cyan);
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
    transition: var(--transition-normal);
}

.avatar-img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 32px rgba(56, 189, 248, 0.5);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--status-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-full);
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-color);
    box-shadow: 0 0 8px var(--status-color);
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.hero-content h1 {
    font-size: 2.2rem;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.hero-role {
    color: var(--accent-cyan);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.role-sep {
    color: var(--text-muted);
    opacity: 0.6;
    margin: 0 10px;
    font-weight: 400;
}

.hero-bio-short {
    color: var(--text-secondary);
    max-width: 620px;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Botones Principales */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #0b0f19;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
    transition: var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-soft);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    text-decoration: none;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
    transition: var(--transition-fast);
}

.btn-outline:hover {
    background: var(--overlay-strong);
    border-color: var(--overlay-border);
    transform: translateY(-2px);
}

/* --- NAVEGACIÓN FLOTANTE MODERNA --- */
/* Tres columnas: [vacía] [menú centrado] [controles]. Las laterales miden
   lo mismo (1fr), así los controles nunca desplazan el centro real del menú. */
.navbar {
    position: sticky;
    top: 16px;
    z-index: 100;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 24px;
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    box-shadow: var(--shadow-subtle);
}

.nav-links {
    grid-column: 2;
    display: flex;
    justify-content: center;
    gap: 36px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--overlay-hover);
}

.nav-controls {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 5px 12px;
    min-height: 32px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-fast);
}

.control-btn:hover {
    color: var(--text-primary);
    background: var(--overlay-hover);
    border-color: var(--border-card);
}

.lang-opt {
    transition: color var(--transition-fast);
}

.lang-opt.is-active {
    color: var(--accent-cyan);
    font-weight: 600;
}

.lang-sep {
    opacity: 0.5;
}

.theme-btn {
    padding: 5px 9px;
}

/* Icono según tema: luna en oscuro, sol en claro */
.theme-btn .icon-sun,
:root[data-theme="light"] .theme-btn .icon-moon {
    display: none;
}

:root[data-theme="light"] .theme-btn .icon-sun {
    display: block;
}

/* --- CONTENEDOR PRINCIPAL (MAIN + ASIDE) --- */
.layout-container {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    align-items: flex-start;
}

/* MAIN (Izquierda) */
main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- SECCIONES DE CONTENIDO --- */
.content-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-subtle);
    scroll-margin-top: 90px;
    transition: var(--transition-fast);
}

.section-header {
    margin-bottom: 20px;
}

.section-badge {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent-cyan);
    margin-bottom: 4px;
}

.section-header h2 {
    font-size: 1.6rem;
    color: var(--text-primary);
}

/* Tarjetas de la fila superior (Sobre mí / Experiencia) */
.content-section--row {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.content-section--row .section-header {
    margin-bottom: 16px;
}

/* Sección Sobre Mí */
.sobre-mi-texto {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sobre-mi-texto p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.75;
    font-size: 0.98rem;
}

.sobre-mi-texto strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Sección Experiencia */
.experiencia-texto {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.experiencia-item h3 {
    margin-bottom: 2px;
}

.experiencia-empresa {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.experiencia-lista {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

.experiencia-lista li {
    position: relative;
    padding-left: 16px;
}

.experiencia-lista li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 0.62em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-cyan);
}

/* --- GRID DE PROYECTOS --- */
.grid-proyectos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    width: 100%;
}

.card-proyecto {
    background-color: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
}

.card-proyecto:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-proyecto .img-contenedor {
    width: 100%;
    height: 180px;
    background-color: var(--bg-body);
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-subtle);
}

.card-proyecto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card-proyecto:hover img {
    transform: scale(1.05);
}

.info-proyecto {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.tags-proyecto {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.2);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.info-proyecto h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
}

.info-proyecto p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
}

.proyecto-footer {
    margin-top: 10px;
}

.info-proyecto .proyecto-nota {
    flex: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.45;
}

.btn-proyecto {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-proyecto:hover {
    background: var(--accent-cyan);
    color: var(--on-accent);
    border-color: var(--accent-cyan);
    transform: translateX(3px);
}

/* Placeholder para tarjetas sin captura de pantalla */
.img-contenedor--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-placeholder);
}

.proyecto-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--accent-cyan);
    opacity: 0.7;
    transition: var(--transition-normal);
}

.proyecto-placeholder span {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.card-proyecto:hover .proyecto-placeholder {
    opacity: 1;
    color: var(--accent-cyan);
}

/* --- SECCIÓN CONTACTO --- */
.contacto-descripcion {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.contacto-contenido {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
    align-items: start;
}

.contacto-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
    background-color: var(--bg-input-focus);
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent-gradient);
    color: #0b0f19;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
    transition: var(--transition-fast);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: progress;
    transform: none;
}

/* Mensaje de estado del formulario (enviado / error) */
.form-status {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.form-status.is-success {
    color: var(--status-color);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.form-status.is-error {
    color: var(--error-color);
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.3);
}

/* Redes Profesionales */
.contacto-redes {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.red-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

.red-item:hover {
    transform: translateX(4px);
    border-color: var(--accent-cyan);
    background: var(--bg-surface-hover);
    box-shadow: var(--shadow-hover);
}

.red-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 4px;
}

.red-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.red-texto strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.red-texto span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   BARRA LATERAL - CARRUSEL DE HABILIDADES OPTIMIZADO
   ========================================================================== */
.aside-skills {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 14px;
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 80px;
}

.aside-header {
    text-align: center;
    margin-bottom: 14px;
}

.aside-header h2 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.aside-sub {
    font-size: 0.72rem;
    color: var(--accent-cyan);
    font-weight: 500;
    display: block;
}

/* Carrusel y animación continua infinita */
.carousel {
    height: 640px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    /* Degradado sutil superior e inferior para efecto fade in / fade out elegante */
    mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
}

.carousel:hover .group {
    /* Pausa interactiva al pasar el cursor */
    animation-play-state: paused;
}

.carousel .group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    /* 24s para un desplazamiento suave y relajado */
    animation: spinVertical 24s linear infinite;
    will-change: transform;
}

/* Loop exacto: traslada la altura de 1 grupo completo + el gap */
@keyframes spinVertical {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(calc(-100% - 14px));
    }
}

/* Tarjetas de tecnologías */
.card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 105px;
    border: 1px solid var(--border-card);
    background-color: var(--bg-card);
    padding: 12px 10px 30px 10px;
    transition: var(--transition-fast);
}

.card:hover {
    border-color: var(--accent-cyan);
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
}

.card img {
    max-width: 60px;
    max-height: 44px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    border-radius: 4px;
}

.card .title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-highlight);
    text-align: center;
    padding: 4px 0;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card-label);
    backdrop-filter: blur(4px);
    border-top: 1px solid var(--border-card-label);
    margin: 0;
    letter-spacing: 0.3px;
}

/* --- FOOTER MODERNO --- */
.main-footer {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-subtle);
}

/* --- DOS COLUMNAS: Sobre mí / Experiencia --- */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}

/* --- MEDIA QUERIES (RESPONSIVE) --- */
@media (max-width: 960px) {
    .contacto-contenido {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .aside-skills {
        width: 220px;
    }

    .nav-links {
        gap: 12px;
    }
}

@media (max-width: 768px) {
    /* Navbar en móvil: menú y controles en una sola fila, sin forzar el centrado */
    .navbar {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 4px 8px;
        padding: 6px 10px;
    }

    .nav-links {
        gap: 2px;
    }

    .nav-controls {
        gap: 4px;
    }

    /* Sobre mí y Experiencia apiladas en una columna */
    .two-col-grid {
        grid-template-columns: 1fr;
        margin-bottom: 0;
    }

    /* Reordenamiento para que Tecnologías aparezca antes que Contacto */
    .layout-container {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    main {
        display: contents;
    }

    .two-col-grid {
        order: 1;
    }

    #proyectos {
        order: 2;
    }

    .aside-skills {
        order: 3;
        width: 100%;
        position: static;
        padding: 24px 18px;
        scroll-margin-top: 90px;
    }

    #contacto {
        order: 4;
    }

    /* Cabecera de habilidades en móvil */
    .aside-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        margin-bottom: 14px;
        padding: 0 4px;
    }

    .aside-header h2 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    .aside-sub {
        font-size: 0.75rem;
    }

    /* Carrusel Horizontal en Móvil */
    .carousel {
        height: auto;
        flex-direction: row;
        gap: 12px;
        overflow: hidden;
        padding: 6px 0;
        /* Máscara con degradado horizontal suave para bordes elegantes */
        mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
    }

    .carousel .group {
        flex-direction: row;
        gap: 12px;
        flex-shrink: 0;
        animation: spinHorizontal 24s linear infinite;
        will-change: transform;
    }

    .carousel:hover .group,
    .carousel:active .group {
        animation-play-state: paused;
    }

    @keyframes spinHorizontal {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-100% - 12px));
        }
    }

    /* Tarjetas compactas en fila horizontal */
    .card {
        width: 96px;
        height: 92px;
        flex-shrink: 0;
        padding: 8px 6px 24px 6px;
    }

    .card:hover {
        transform: translateY(-3px);
    }

    .card img {
        max-width: 44px;
        max-height: 32px;
    }

    .card .title {
        font-size: 0.68rem;
        padding: 2px 0;
    }
}

@media (max-width: 520px) {
    body {
        padding: 16px 12px;
        gap: 16px;
    }

    .hero-header {
        padding: 28px 16px;
    }

    .hero-content h1 {
        font-size: 1.7rem;
    }

    .hero-role {
        font-size: 0.95rem;
    }

    .role-sep {
        margin: 0 6px;
    }

    .nav-links a {
        font-size: 0.78rem;
        padding: 5px 8px;
    }

    .control-btn {
        font-size: 0.72rem;
        padding: 4px 8px;
        min-height: 28px;
    }

    .theme-btn {
        padding: 4px 7px;
    }

    .content-section,
    .aside-skills {
        padding: 20px 14px;
    }

    .grid-proyectos {
        grid-template-columns: 1fr;
    }

    .aside-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .card {
        width: 86px;
        height: 84px;
        padding: 6px 4px 22px 4px;
    }

    .card img {
        max-width: 38px;
        max-height: 28px;
    }

    .card .title {
        font-size: 0.62rem;
    }
}

@media (max-width: 380px) {
    .nav-links a {
        font-size: 0.74rem;
        padding: 5px 6px;
    }
}

/* Respeta a quien prefiere menos movimiento: el carrusel se detiene y permite scroll manual */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .carousel .group,
    .status-dot {
        animation: none;
    }

    .carousel {
        overflow: auto;
        scrollbar-width: thin;
    }
}
