:root {
    /* Color Palette - IDE Theme (Inspired by VS Code / Dracula) */
    --bg-primary: #0f111a;
    /* Deep dark blue/gunmetal */
    --bg-secondary: #0d1117;
    /* GitHub Dark Dimmed style */
    --bg-card: #161b22;
    --border-color: #30363d;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-accent: #58a6ff;
    /* Blue for links/info */

    /* Syntax Highlighting Colors */
    --syntax-keyword: #ff7b72;
    /* Red/Pink */
    --syntax-string: #a5d6ff;
    /* Light Blue */
    --syntax-function: #d2a8ff;
    /* Purple */
    --syntax-comment: #8b949e;
    /* Grey */
    --accent-success: #3fb950;
    /* Green */
    --accent-warning: #d29922;
    /* Orange */

    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-sans: 'Inter', system-ui, sans-serif;

    /* Spacing */
    --container-width: 1200px;
    --header-height: 70px;
    --section-spacing: 60px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-mono);
    color: var(--text-primary);
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Utilities */
.text-mono {
    font-family: var(--font-mono);
}

.text-keyword {
    color: var(--syntax-keyword);
}

.text-string {
    color: var(--syntax-string);
}

.text-function {
    color: var(--syntax-function);
}

.text-comment {
    color: var(--syntax-comment);
}

.text-success {
    color: var(--accent-success);
}

.mt-4 {
    margin-top: 1rem;
}

.text-center {
    text-align: center;
}

.full-width {
    width: 100%;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-success);
    color: #fff;
    border-color: var(--accent-success);
}

.btn-primary:hover {
    background-color: #2ea043;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(63, 185, 80, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-accent);
    border-color: var(--text-accent);
}

.btn-secondary:hover {
    background-color: rgba(88, 166, 255, 0.1);
}

/* Header Styles */
header {
    height: var(--header-height);
    background-color: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(230, 237, 243, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

header.scrolled {
    height: 60px;
    background-color: rgba(15, 17, 26, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.nav-container {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    /* Prevent container wrapping */
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
    /* Protect logo width */
}

.logo img {
    /* High Contrast Strategy: Turn dark logo into pure white for dark mode */
    filter: brightness(0) invert(1);
    transition: all 0.3s ease;
}

.logo:hover img {
    opacity: 0.8;
}

.desktop-nav ul {
    display: flex;
    gap: 20px;
    /* Highly optimized gap */
    align-items: center;
    margin: 0;
    padding: 0;
}

.desktop-nav a {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
    /* Key fix for wrapping */
    border: 1px solid transparent;
}

.desktop-nav a:hover {
    color: var(--text-primary);
    background-color: rgba(88, 166, 255, 0.1);
    /* Subtle glowing pill effect */
    border-color: rgba(88, 166, 255, 0.2);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.1);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Hero Section */
.hero {
    min-height: 80vh;
    min-height: 80dvh;
    /* Dynamic Viewport Height for mobile stability */
    display: flex;
    align-items: center;
    padding-top: var(--header-height);
    background: radial-gradient(circle at 10% 20%, rgba(88, 166, 255, 0.05) 0%, transparent 20%);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.hero-text h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(210, 168, 255, 0.1);
    border: 1px solid rgba(210, 168, 255, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
}

.cta-group {
    display: flex;
    gap: 15px;
}

/* Terminal Window */
.terminal-window {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
    transition: transform 0.3s ease;
}

.terminal-window:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg);
}

.terminal-header {
    background: #21262d;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.dots {
    display: flex;
    gap: 8px;
}

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

.red {
    background: #ff5f56;
}

.yellow {
    background: #ffbd2e;
}

.green {
    background: #27c93f;
}

.title {
    flex-grow: 1;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-secondary);
}

.terminal-body {
    padding: 20px;
    font-size: 14px;
}

.line {
    margin-bottom: 10px;
    display: flex;
}

.prompt {
    color: var(--accent-success);
    margin-right: 10px;
}

.success {
    color: var(--accent-success);
}

.info {
    color: var(--text-secondary);
}

.cursor {
    animation: blink 1s step-end infinite;
}

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

/* General Section Styles */
.section {
    padding: var(--section-spacing) 0;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 3rem;
}

.section-close {
    font-size: 2rem;
    margin-top: 3rem;
    color: var(--text-secondary);
}

.bg-secondary {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 50px;
    align-items: center;
}

.code-block-text {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    padding-left: 20px;
    border-left: 2px solid var(--syntax-comment);
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card i {
    color: var(--text-accent);
    margin-bottom: 10px;
    width: 32px;
    height: 32px;
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--accent-success);
}

/* Services Section */
.services-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-left: 0;
    /* Reset indentation for flex */
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 8px;
    transition: transform 0.3s ease;
    flex: 1 1 300px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Context for pseudo-element */
}

/* Add Comma after cards */
.service-card::after {
    content: ",";
    position: absolute;
    bottom: -15px;
    /* Position below */
    right: -25px;
    /* Position to the right */
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: bold;
}

/* Remove comma from the very last card if desired, but user asked for "after each card" */
/* If the image showed a closing bracket after the last one, the main structure has ]; so we might not need a comma on the last one.
   Usually in JS arrays, a trailing comma is fine. I'll leave it or remove it based on visual preference.
   Let's leave it for now as "despues de cada tarjeta" implies consistency. */

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--text-accent);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.card-header i {
    color: var(--text-accent);
}

.service-card h3 {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.tags {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: rgba(56, 139, 253, 0.1);
    color: var(--text-accent);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Cafe Virtual Section */
.reasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.reason-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 8px;
    transition: transform 0.3s ease;
    text-align: left;
    height: 100%;
}

.reason-card:hover {
    transform: translateY(-5px);
    border-color: var(--text-accent);
}

.reason-card i {
    color: var(--accent-success);
    margin-bottom: 20px;
    width: 32px;
    height: 32px;
}

.service-card h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-accent);
}

.reason-card h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--text-accent);
}

.reason-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Increased spacing for Quienes Somos (20px + 20px) */
#quienes_somos {
    padding-top: 40px;
    padding-bottom: 0;
}

/* Reduced spacing for Cafe Virtual */
#cafe-virtual {
    padding-top: 20px;
}

/* Testimonials Section */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.review-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 8px;
    transition: transform 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.review-card::after {
    content: ",";
    position: absolute;
    bottom: -15px;
    right: -25px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: bold;
}

.review-card:hover {
    transform: translateY(-5px);
    border-color: var(--text-accent);
}

.review-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.avatar {
    width: 80px;
    /* Increased from 45px significantly to match '20% larger' visual impact closer to 100px but balanced */
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Reduced spacing between Reviews and Contact (30px total gap) */
#testimonials {
    padding-bottom: 15px;
}

#contact {
    padding-top: 15px;
}

.review-info {
    text-align: center;
}

.review-info h4 {
    font-size: 1.1rem;
    /* Slightly larger name */
    margin: 0;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.review-info span {
    font-size: 0.9rem;
    color: var(--text-accent);
    /* Highlight role */
}

.review-text {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.stars {
    color: var(--accent-warning);
    font-size: 1.1rem;
    margin-top: auto;
    /* Pushes stars to the bottom */
}

/* Contact Section */
.contact-container {
    max-width: 600px;
}

.contact-header {
    text-align: center;
    margin-bottom: 40px;
}

.contact-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-family: var(--font-mono);
    color: var(--accent-success);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: #0d1117;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    font-family: var(--font-sans);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--text-accent);
}

/* Footer */
footer {
    padding: 50px 0 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links i {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.footer-links i:hover {
    color: var(--text-primary);
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Terminal Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#preloader .terminal-loader {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    font-family: var(--font-mono);
}

#preloader .terminal-body {
    min-height: 300px;
    padding: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.loader-line {
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeIn 0.1s forwards;
}

.loader-line.success {
    color: var(--accent-success);
}

.loader-line.warning {
    color: var(--accent-warning);
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
        /* Show hamburger icon */
        z-index: 1001;
    }

    .desktop-nav {
        position: fixed;
        top: 70px;
        /* Header height */
        left: 0;
        width: 100%;
        background-color: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        padding: 20px;
        transform: translateY(-150%);
        /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        z-index: 999;
    }

    .desktop-nav.active {
        transform: translateY(0);
        /* Slide down when active */
        visibility: visible;
        pointer-events: auto;
    }

    .desktop-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .hero-content {
        grid-template-columns: 1fr;
        padding-top: 20px;
    }

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

    .hero-text h1 {
        font-size: 2.0rem;
    }

    .terminal-window {
        margin-top: 30px;
    }
}

/* Code Reveal Component */
.code-reveal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    font-family: var(--font-mono);
    position: relative;
    overflow: hidden;
    margin-top: 30px;
}

.code-header {
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.reveal-img {
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    animation: revealImage 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.5s;
    /* Wait for "code execution" */
}

@keyframes revealImage {
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

.syntax-keyword {
    color: var(--syntax-keyword);
}

.syntax-function {
    color: var(--syntax-function);
}

.syntax-string {
    color: var(--syntax-string);
}

/* Mobile Fix for Code Reveal */
@media (max-width: 768px) {
    .code-reveal {
        margin-top: 20px;
        padding: 10px;
        max-width: 100%;
        /* Force container to fit */
    }

    .code-header {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow-x: auto;
        /* Enable scrolling for long text */
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        /* Ensure header fits in container */
        display: block;
    }

    .image-container {
        width: 100%;
    }
}

/* Success Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}