/* ==========================================================================
   Design Tokens & Variables
   ========================================================================== */
:root {
    /* Colors */
    --color-bg: #FFFFFF;
    /* Clean White */
    --color-surface: #F8F9FA;
    /* Light Grey */
    --color-surface-light: #F1F3F5;
    --color-primary: #E63946;
    /* Corporate Red */
    --color-primary-glow: rgba(230, 57, 70, 0.4);
    --color-text: #1A1614;
    --color-text-muted: #6C757D;
    --color-border: rgba(0, 0, 0, 0.08);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);

    /* Component specific */
    --nav-bg: rgba(255, 255, 255, 0.95);
    --hero-glow: rgba(255, 255, 255, 0.7);
    --mesh-line-color: rgba(230, 57, 70, 0.08);
    --mesh-opacity: 0.5;
    --mountain-bg: var(--color-surface-light);
    --mountain-opacity: 0.8;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --card-hover-border: rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
    :root:not(.light-mode) {
        --color-bg: #1A1614;
        --color-surface: #26201D;
        --color-surface-light: #312A26;
        --color-text: #F8F4F1;
        --color-text-muted: #BBAFAB;
        --color-border: rgba(255, 240, 230, 0.08);
        --nav-bg: rgba(26, 22, 20, 0.9);
        --hero-glow: rgba(42, 10, 12, 0.4);
        --mesh-line-color: rgba(230, 57, 70, 0.05);
        --mesh-opacity: 0.4;
        --mountain-bg: var(--color-bg);
        --mountain-opacity: 0.5;
        --card-shadow: rgba(0, 0, 0, 0.4);
        --card-hover-border: rgba(255, 255, 255, 0.15);
    }
}

body.dark-mode {
    --color-bg: #1A1614;
    --color-surface: #26201D;
    --color-surface-light: #312A26;
    --color-text: #F8F4F1;
    --color-text-muted: #BBAFAB;
    --color-border: rgba(255, 240, 230, 0.08);
    --nav-bg: rgba(26, 22, 20, 0.9);
    --hero-glow: rgba(42, 10, 12, 0.4);
    --mesh-line-color: rgba(230, 57, 70, 0.05);
    --mesh-opacity: 0.4;
    --mountain-bg: var(--color-bg);
    --mountain-opacity: 0.5;
    --card-shadow: rgba(0, 0, 0, 0.4);
    --card-hover-border: rgba(255, 255, 255, 0.15);
}

body.light-mode {
    --color-bg: #FFFFFF;
    --color-surface: #F8F9FA;
    --color-surface-light: #F1F3F5;
    --color-text: #1A1614;
    --color-text-muted: #6C757D;
    --color-border: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(255, 255, 255, 0.95);
    --hero-glow: rgba(255, 255, 255, 0.7);
    --mesh-line-color: rgba(230, 57, 70, 0.08);
    --mesh-opacity: 0.5;
    --mountain-bg: var(--color-surface-light);
    --mountain-opacity: 0.8;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --card-hover-border: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Reset & Normalize
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

/* Typography Base */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

a {
    color: var(--color-text);
    text-decoration: none;
    transition: color var(--transition-base);
}

/* ==========================================================================
   Global Utilities & Layout
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 5%;
}

.section {
    padding: 120px 0;
    position: relative;
    z-index: 2;
}

.section-dark {
    background-color: var(--color-surface);
}

.section-surface {
    background-color: var(--color-surface-light);
}

.section-header {
    text-align: center;
    margin-bottom: 64px;
}

.border-top {
    border-top: 1px solid var(--color-border);
}

/* Tech Stack Tags */
.tech-stack-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.tech-tag {
    background: rgba(230, 57, 70, 0.1);
    color: var(--color-primary);
    border: 1px solid rgba(230, 57, 70, 0.2);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Background Textures */
.bg-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(var(--color-border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.3;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all var(--transition-base);
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--color-primary-glow);
}

.btn-primary:hover {
    background-color: #c92a37;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.6);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* Typography styles */
.eyebrow {
    display: block;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 100px;
    background: rgba(230, 57, 70, 0.1);
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
    border: 1px solid rgba(230, 57, 70, 0.2);
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.section-desc,
.lead-text {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin-bottom: 32px;
}

.body-text {
    font-size: 1.05rem;
    color: var(--color-text-muted);
}

.center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 5px 0;
    transition: background-color var(--transition-base), padding var(--transition-base), border-bottom var(--transition-base);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 5px 0;
    border-bottom: 1px solid var(--color-border);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.brand-logo {
    height: 80px;
    width: auto;
}

.brand-logo-footer {
    height: 56px;
    width: auto;
    opacity: 0.8;
}

nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.theme-toggle {
    background: var(--color-surface-light);
    border: 1px solid var(--color-border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text);
    transition: all var(--transition-base);
    order: 2;
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

body.dark-mode .sun-icon {
    display: block;
}

body.dark-mode .moon-icon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    body:not(.light-mode) .sun-icon {
        display: block;
    }

    body:not(.light-mode) .moon-icon {
        display: none;
    }
}

body.light-mode .sun-icon {
    display: none;
}

body.light-mode .moon-icon {
    display: block;
}

@media (max-width: 768px) {
    .theme-toggle {
        order: 0;
        margin-right: -20px;
    }
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.nav-link:hover {
    color: var(--color-text);
}

/* Responsive Nav */
@media (max-width: 768px) {
    nav {
        display: none;
        /* Mobile menu needed for full prod */
    }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    /* Offset for nav */
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 100%, var(--hero-glow) 0%, var(--color-bg) 80%), url('assets/hero-bg.png') center/cover no-repeat;
}

.decorative-nodes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.node {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--color-primary);
    opacity: 0.3;
}

.node-1 {
    top: 20%;
    left: 10%;
    animation: float 10s infinite alternate;
}

.node-2 {
    top: 60%;
    right: 15%;
    animation: float 15s infinite alternate-reverse;
}

.node-3 {
    top: 40%;
    left: 85%;
    animation: float 12s infinite alternate 1s;
}

@keyframes fadeFloat {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    20% {
        opacity: 0.6;
    }

    80% {
        opacity: 0.6;
    }

    100% {
        transform: translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

@keyframes float {
    0% {
        transform: translate(0, 0);
        opacity: 0.2;
    }

    100% {
        transform: translate(40px, -40px);
        opacity: 0.5;
    }
}

.mesh-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--mesh-line-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--mesh-line-color) 1px, transparent 1px);
    background-size: 80px 80px;
    transform: perspective(1000px) rotateX(15deg) translateY(-20%) scale(1.2);
    transform-origin: top center;
    opacity: var(--mesh-opacity);
}

.hero-inner {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
    position: relative;
    z-index: 1;
}

@media (max-width: 992px) {
    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-cta {
        justify-content: center;
    }
}

.hero-content {
    width: 100%;
    max-width: 600px;
}

.hero-title {
    font-size: clamp(3rem, 6vw, 5rem);
    margin-bottom: 24px;
    line-height: 1.05;
}

.hero-title span {
    color: var(--color-primary);
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--color-text-muted);
    margin-bottom: 48px;
    font-weight: 400;
}

.hero-cta {
    display: flex;
    gap: 16px;
}

/* Terminal Graphic styles */
.terminal-window {
    background: #1A1614;
    /* Always dark for the terminal */
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    overflow: hidden;
    position: relative;
    transform: perspective(1000px) rotateY(-5deg) rotateX(5deg);
    transition: transform 0.5s ease;
}

.terminal-window:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg);
}

.terminal-header {
    background: #2D2A28;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.terminal-title {
    margin: 0 auto;
    transform: translateX(-24px);
    /* offset for the dots */
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-family: monospace;
}

.terminal-body {
    padding: 24px;
    color: #a9dc76;
    /* Greenish matrix/code color */
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    height: 320px;
    overflow-y: auto;
}

.terminal-body .comment {
    color: #78787e;
}

.terminal-body .keyword {
    color: #ff6188;
}

.terminal-body .function {
    color: #a9dc76;
}

.terminal-body .string {
    color: #ffd866;
}

.terminal-body .cursor {
    display: inline-block;
    width: 8px;
    height: 1.2em;
    background: #a9dc76;
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes subtlePulse {
    0% {
        box-shadow: 0 0 0 0 var(--color-primary-glow);
    }

    70% {
        box-shadow: 0 0 0 15px transparent;
    }

    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.hero-cta .btn-primary {
    animation: subtlePulse 3s infinite;
}

.hero-cta .btn-primary:hover {
    animation: none;
}

/* ==========================================================================
   El Origen Section
   ========================================================================== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
}

.align-center {
    align-items: center;
}

@media (max-width: 992px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

.abstract-graphic {
    width: 100%;
    aspect-ratio: 1;
    background: var(--color-surface-light);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.mountain-silhouette {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, transparent, var(--mountain-bg));
    clip-path: polygon(0 100%, 0 60%, 20% 40%, 40% 70%, 60% 30%, 80% 50%, 100% 20%, 100% 100%);
    opacity: var(--mountain-opacity);
}

.code-stream {
    position: absolute;
    top: 10%;
    right: 10%;
    width: 40%;
    height: 80%;
    background: repeating-linear-gradient(0deg, transparent, transparent 10px, var(--color-primary-glow) 10px, var(--color-primary-glow) 12px);
    opacity: 0.3;
    animation: streamSlide 20s linear infinite;
}

@keyframes streamSlide {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }
}

/* ==========================================================================
   Core Services Section
   ========================================================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    margin-top: 64px;
}

.service-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 40px;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.service-card:hover {
    transform: translateY(-6px);
    border-color: var(--card-hover-border);
    box-shadow: 0 12px 32px var(--card-shadow);
}

.service-card:hover::before {
    opacity: 1;
}

.service-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    color: #fff;
    background: var(--color-primary);
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(230, 57, 70, 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    transition: all var(--transition-base);
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.service-card p {
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* ==========================================================================
   Value Section
   ========================================================================== */
.value-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 80px;
}

@media (max-width: 992px) {
    .value-layout {
        grid-template-columns: 1fr;
        gap: 48px;
    }
}

.value-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.metric {
    position: relative;
    padding-left: 32px;
}

.metric-line {
    position: absolute;
    top: 8px;
    left: 0;
    width: 2px;
    height: calc(100% - 16px);
    background-color: var(--color-border);
}

.metric-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary);
}

.metric h4 {
    font-size: 1.35rem;
    margin-bottom: 8px;
}

.metric p {
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* ==========================================================================
   CTA Section
   ========================================================================== */
.section-cta {
    position: relative;
    padding: 120px 0;
    text-align: center;
    background: linear-gradient(to bottom, var(--color-surface), var(--color-bg));
    border-top: 1px solid var(--color-border);
    overflow: hidden;
}

.cta-mesh {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 60%);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.cta-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
}

.cta-content h2 {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.cta-content p {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    margin-bottom: 40px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    border-top: 1px solid var(--color-border);
    padding: 48px 0;
    background-color: var(--color-bg);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-brand .logo {
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

.footer-text {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}

.footer-links p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* ==========================================================================
   Animations
   ========================================================================== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}