:root {
    /* Main Layout Colors - Light Theme Default */
    --primary-color: #0077ff;
    /* Bright Ocean Blue */
    --primary-glow: rgba(0, 119, 255, 0.2);
    /* Reduced glow intensity */
    --accent-color: #00ffff;
    /* Turquoise/Cyan */
    --accent-glow: rgba(0, 255, 255, 0.3);
    /* Reduced glow intensity */

    --bg-color: #f7f9fa;
    /* Very Light Gray/White */
    --text-color: #333333;
    /* Dark text */
    --text-muted: #555555;
    /* Dark gray for muted text */
    --glass-bg: rgba(255, 255, 255, 0.85);
    /* Frosty white glass */
    --glass-border: 1px solid rgba(0, 0, 0, 0.1);
    
    --nav-height: 100px;
    --section-spacing: 120px;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    width: 100%;
}

/* Response Container Padding */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Nuclear Overflow Fix */
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Prevent long words from breaking layout (ESPECIALIDADES) */
    h1,
    h2,
    h3 {
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    /* Adaptive Font Sizes for Long Titles */
    .page-header h1,
    .about-header h1,
    .neon-text {
        font-size: clamp(1.8rem, 8vw, 2.5rem) !important;
        align-self: center;
    }
}

/* Background & Matrix Canvas */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    pointer-events: none;
}

/* Page Container Adjustment */
main {
    position: relative;
    z-index: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    border: 1px solid var(--primary-color);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 40px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease;
}

.glass-panel:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
}

.neon-text {
    color: var(--text-color);
    text-shadow: 0 0 15px rgba(0, 119, 255, 0.4);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #00aaff 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 119, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 0 25px var(--primary-glow), 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary-color) 20%, #00aaff 120%);
}

.btn-outline {
    background: transparent;
    border-color: #008b8b; /* Turquesa oscuro para mayor contraste */
    color: #008b8b;
}

.btn-outline:hover {
    background: rgba(0, 139, 139, 0.1); /* Fondo sutil turquesa oscuro */
    box-shadow: 0 0 15px rgba(0, 139, 139, 0.4);
    text-shadow: 0 0 5px #008b8b;
}

/* Navbar */
nav .nav-link {
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

nav .nav-link:hover {
    color: var(--accent-color);
}

nav .nav-link.active {
    color: var(--primary-color);
}

@media (max-width: 768px) {

    /* Hide active link on mobile only to avoid redundancy */
    nav .nav-link.active {
        display: none !important;
    }
}

/* Forms */
input,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.1) !important;
    border: var(--glass-border) !important;
    color: var(--text-color) !important;
    transition: all 0.3s ease;
}

input:focus,
textarea:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

/* --- ANIMATIONS START --- */

/* Base Fade In */
.fade-in {
    animation: fadeIn 1s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Zoom & Unfold Animation */
.animate-hero {
    /* Container itself ensures we start invisible if needed, but logic is on children usually */
    /* If we animate container: */
    animation: zoomInUnfold 2.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    /* Much slower (was 1.2s) */
    opacity: 0;
}

/* Staggered children for 'unfolding' effect */
.animate-hero>* {
    opacity: 0;
    animation: slideUpFade 1.5s ease forwards;
    /* Slower fade in (was 0.8s) */
}

/* Increased delays for dramatic effect */
.animate-hero>*:nth-child(1) {
    animation-delay: 0.5s;
}

/* Subtitle */
.animate-hero>*:nth-child(2) {
    animation-delay: 1.0s;
}

/* Title */
.animate-hero>*:nth-child(3) {
    animation-delay: 1.5s;
}

/* Description */
.animate-hero>*:nth-child(4) {
    animation-delay: 2.0s;
}

/* Buttons */

/* Buttons */

@keyframes zoomInUnfold {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll Trigger Animations settings */
/* Scroll Trigger Animations settings */
.scroll-hidden {
    opacity: 0;
    /* Use specific properties to avoid conflicts and verify speed */
    transition: opacity 2.5s ease-out, transform 2.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
    /* Optimize performance */
}

/* Slide Right (From Left to Center) */
.slide-in-left {
    transform: translateX(-100px);
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Left (From Right to Center) */
.slide-in-right {
    transform: translateX(100px);
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Up (Standard) */
.slide-up {
    transform: translateY(100px);
    /* Increased start distance */
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Down (From Top) */
.slide-down {
    transform: translateY(-100px);
}

.slide-down.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Card Borders */
.border-turquoise {
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.border-turquoise:hover {
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.border-blue {
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 119, 255, 0.1);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.border-blue:hover {
    box-shadow: 0 0 30px rgba(0, 119, 255, 0.3);
}

/* Zoom In (From Background) */
.zoom-in {
    transform: scale(0.5);
    opacity: 0;
    transition: all 2.5s cubic-bezier(0.25, 1, 0.5, 1);
    /* Slower (was 1.5s) */
}

.zoom-in.visible {
    transform: scale(1);
    opacity: 1;
}

/* About Page Styles */
.about-header {
    padding-top: 150px;
    padding-bottom: 50px;
    text-align: center;
}

.about-header h1 {
    font-size: 3.5rem;
}

.about-section {
    padding-bottom: var(--section-spacing);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.about-text p:last-child {
    margin-bottom: 0;
}

.about-visual {
    border: 2px solid var(--primary-color);
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 30px rgba(67, 97, 238, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.about-visual p {
    color: var(--primary-color);
    letter-spacing: 2px;
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Specialties Page Styles */
.specialties-grid {
    display: grid;
    /* Force 3 columns on desktop by ensuring min-width allows it, but keep it responsive */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 3rem;
    /* Increased space between cards */
}

.specialty-card {
    text-align: center;
    /* transition is handled by .zoom-in now */
    height: 100%;
    padding: 1.5rem 1rem;
    /* Reduced height by reducing vertical padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* Subtle turquoise glow */
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.specialty-card:hover {
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.25);
    border-color: var(--accent-color);
    transform: translateY(-5px);
}

/* Staggered transition delays for grid items */
.specialty-card:nth-child(1) {
    transition-delay: 0.1s;
}

.specialty-card:nth-child(2) {
    transition-delay: 0.3s;
}

.specialty-card:nth-child(3) {
    transition-delay: 0.5s;
}

.specialty-card:nth-child(4) {
    transition-delay: 0.7s;
}

.specialty-card:nth-child(5) {
    transition-delay: 0.9s;
}

.specialty-card:nth-child(6) {
    transition-delay: 1.1s;
}

.specialty-icon {
    font-size: 2.2rem;
    /* Compact icon */
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    /* Less space below icon */
    display: block;
}

.specialty-title {
    font-size: 1.25rem;
    /* Compact title */
    margin-bottom: 0.5rem;
    /* Less space below title */
    color: var(--text-color);
    line-height: 1.3;
}

.specialty-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    /* Compact description */
    margin: 0;
}

@media (max-width: 768px) {
    .specialties-grid {
        /* Stack on mobile */
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .specialty-card {
        padding: 2rem;
        /* More comfortable padding on mobile */
    }
}

/* --- ANIMATIONS END --- */

/* Code Window Animation Styles */
.code-window {
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 119, 255, 0.15);
    font-family: 'Fira Code', 'Courier New', monospace;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.code-window:hover {
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 119, 255, 0.25);
}

.code-header {
    background: #1a1a1f;
    padding: 10px 15px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #2a2a30;
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background-color: #ff5f56;
}

.dot-yellow {
    background-color: #ffbd2e;
}

.dot-green {
    background-color: #27c93f;
}

.code-content {
    padding: 20px;
    color: #a9b7c6;
    font-size: 0.9rem;
    line-height: 1.5;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background-color: var(--accent-color);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.keyword {
    color: #cc7832;
    font-weight: bold;
}

/* Orange */
.function {
    color: #ffc66d;
}

/* Yellow */
.string {
    color: #6a8759;
}

/* Green */
.class-name {
    color: #a9b7c6;
    text-decoration: underline;
}

.comment {
    color: #808080;
    font-style: italic;
}

/* ========================================= */
/* NAVBAR RESPONSIVE STYLES (Mobile Optim.)  */
/* ========================================= */

.navbar {
    display: block !important;
    padding: 0 !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    border-radius: 0 !important;
    border-bottom: var(--glass-border);
    /* Glass Effect moved here to avoid transform context issue from .glass-panel */
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.3s ease;
}

.navbar-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-color);
}

.logo-link .highlight {
    color: var(--primary-color);
}

.navbar-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Fix for oversized contact button in navbar */
.navbar .btn {
    padding: 8px 20px;
    font-size: 0.8rem;
    height: auto;
}

.nav-spacer {
    height: var(--nav-height);
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    left: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

/* Mobile Media Query */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0 20px;
    }

    .navbar-toggle {
        display: block;
    }

    .navbar-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fdfdfd !important;
        /* White block */
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        flex-direction: column;
        justify-content: flex-start;
        /* Ensure items start from top */
        padding-top: 100px;
        padding-bottom: 40px;
        gap: 1.5rem;
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.3s ease;
        z-index: 1001;
        pointer-events: none;
        overflow-y: auto;
        /* Allow scrolling if items don't fit */
    }

    .navbar-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .navbar-menu li a {
        font-size: 1.3rem;
        font-weight: 700;
        /* Bold */
        color: #ff4500 !important;
        /* Neon Orange */
        display: block;
        padding: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .navbar-menu li a:hover {
        color: #fff !important;
        text-shadow: 0 0 10px #ff4500;
    }

    .navbar-toggle.active .hamburger {
        background-color: transparent;
    }

    .navbar-toggle.active .hamburger::before {
        transform: rotate(45deg);
        top: 0;
    }

    .navbar-toggle.active .hamburger::after {
        transform: rotate(-45deg);
        top: 0;
    }

    /* Global Mobile Adjustments */
    :root {
        --section-spacing: 60px;
    }

    .about-header {
        padding-top: 100px;
        padding-bottom: 30px;
    }

    .about-visual {
        height: 300px;
    }

    .about-header h1 {
        font-size: 2.5rem;
    }

    /* Mobile Menu Button Fix */
    .navbar-menu .btn {
        width: 100%;
        max-width: 200px;
        text-align: center;
        padding: 12px;
        margin-top: 1rem;
    }
}