@property --grid-color {
    syntax: '<color>';
    inherits: true;
    initial-value: transparent;
}

:root {
    /* Colors */
    --bg-color: #ffffff;
    --text-primary: #0a0a0a;
    --text-secondary: #52525b;
    --accent-primary: #4f46e5;
    --accent-secondary: #7c3aed;
    --glass-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.1);

    /* Grid Color Control */
    --grid-color: transparent;
    /* Controlled by JS: transparent -> #5F5B85 */
    --scrollbar-thumb-color: #8A90C2;
    /* default */
    --scrollbar-track-color: #E5E7EB;
    /* default, gris claro */

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;

    /* Typography */
    --font-human: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-interface: 'Inter Tight', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-code: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    --font-main: var(--font-human);
}

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




body {
    font-family: var(--font-human);
    font-weight: 400;
    background-color: #F3F4F6;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

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

/* Header */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    transition: background-color 0.3s ease;
    background-color: #F3F4F6;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.05em;
    transition: color 0.3s ease;
}

.main-nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s ease, letter-spacing 260ms ease-out;
    font-size: 0.95rem;
    font-family: 'Barlow', sans-serif;
}

.main-nav a:hover {
    color: var(--text-primary);

}

/* Buttons */
.btn-primary {
    text-decoration: none;
    background: var(--text-primary);
    color: #ffffff !important;
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px;
    font-weight: 550;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, letter-spacing 260ms ease-out !important;
}



.btn-secondary {
    text-decoration: none;
    background: var(--glass-bg);
    color: #272c31;
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px;
    font-weight: 550;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--text-primary);
    border-radius: 6px;

}

/* Header Transformation on Footer View (Sequenced) */

/* 1. Menu Links: 3s delay */
/* 1. Menu Links: Split-step timing separate from footer-in-view */
body.footer-menu-ready .main-nav a {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition:
        font-family 0s 0s,
        font-size 0.2s ease 0.1s,
        color 0.2s ease 0.1s;
}

/* 2. Contact Button: Split-step timing */
body.footer-menu-ready .btn-primary {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-secondary) !important;
    box-shadow: none;
    padding: 0.5rem 1rem;

    transition:
        all 0.2s ease 0.1s,
        font-family 0s 0s;
}

body.footer-in-view .btn-primary:hover {
    border-color: rgba(0, 0, 0, 0.3);
    color: var(--text-primary) !important;
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* Hover state for transformed button to match .btn-boring:hover */
body.footer-in-view .btn-primary:hover {
    border-color: rgba(0, 0, 0, 0.3);
    color: var(--text-primary) !important;
    background: transparent;
    transform: none;
    /* Reset original button lift if desired, or keep it */
    box-shadow: none;
}

/* Hero Section */
.hero {
    scroll-snap-align: start;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: visible;
    z-index: 1;
    padding-top: var(--header-height);
}

/* Hero Grid Base */
.hero-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(138, 144, 194, 0.22) 1px, transparent 1px),
        linear-gradient(90deg, rgba(138, 144, 194, 0.22) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
    animation: gridScroll 3s linear infinite;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}

/* Hero Grid Highlight (Spotlight) */
.hero-grid-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--accent-primary) 1px, transparent 1px),
        linear-gradient(90deg, var(--accent-primary) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
    pointer-events: none;
    animation: gridScroll 3s linear infinite;
    mask-image: radial-gradient(circle 300px at var(--x, 50%) var(--y, 50%), black 0%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle 300px at var(--x, 50%) var(--y, 50%), black 0%, transparent 100%);
}

.hero-grid-highlight.active {
    opacity: 0.3;
}

/* FINAL FIX: Isolate hero text from animated grid background */
.hero-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    width: 100%;
    isolation: isolate;
    transform: translateZ(0);
    will-change: transform;
}

.hero-text {
    flex: 1;
    max-width: 600px;
    isolation: isolate;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.hero-text {
    flex: 1;
    max-width: 600px;
    isolation: isolate;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* Additional stability: prevent reflow in hero text container */
.hero-text {
    contain: layout style;
    position: relative;
}

/* Lock all hero text elements to prevent any movement */
.hero h1,
.hero p {
    contain: layout style paint;
    position: relative;
}

.hero-image {
    flex-shrink: 0;
    width: 350px;
    height: 350px;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

.hero .subtitle {
    color: #272c31;
    font-weight: 550;
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px;
    margin-bottom: 0.2rem;
    display: block;
}

.hero h1 {
    font-family: var(--font-interface);
    font-size: 3.6rem;
    line-height: 0.96;
    font-weight: 550;
    font-stretch: 94%;
    margin-bottom: -0.28rem;
    letter-spacing: -0.003em;
}

.hero-subtitle {
    margin-top: -1.2rem;
    line-height: 1.00;
    margin-bottom: 0;
}

.hero p {
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
    color: #272c31;
    margin-bottom: 0;
    max-width: 600px;
}



.hero .hero-description {
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
    color: #272c31;
    margin-top: 0.5rem;
    /* Previous gap was br+br (~22px*2?? lines). 1.5rem is ~24px. Let's make it distinct. */
    margin-bottom: 1.75rem;
    max-width: 600px;
}

.hero-actions {
    margin-top: -0.12rem;
    display: flex;
    gap: 1rem;
}

/* Audio Interstitial */
.audio-interstitial {
    min-height: 100vh;
    /* Fullscreen */
    scroll-snap-align: start;
    /* Standard snap behavior */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 5;
    background-color: transparent;
    transition: opacity 1s ease;
}

.interstitial-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.interstitial-text {
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
    color: #272c31;
    opacity: 1;
    margin: 0;

    /* Strict Stability */
    transform: none !important;
    filter: none !important;
    transition: none !important;
    animation: none !important;
    will-change: auto !important;
    contain: layout paint;
}

.hardware-btn svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 55px;
    /* Scaled 2.5x from 22px */
    height: 55px;
    pointer-events: none;
    display: block;
    color: #2a2a2a;
    /* User requested #2a2a2a - Soft neutral dark gray */
}

/* Pause Icon One-Time Rotation */
@keyframes rotateOnce {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotate-once {
    animation: rotateOnce 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
    transform-origin: center;
    transform-box: fill-box;
    /* Ensures rotation around the icon's own center */
}

.interstitial-control {
    position: relative;
    /* Entry Animation Init State */
    transform: translateY(6px);
    opacity: 0;
    will-change: transform, opacity;
}

.interstitial-control.entered {
    /* Triggered by JS */
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    /* Smooth natural ease */
}

/* Hardware Button Style - Minimal Tech Control */
.hardware-btn {
    width: 64px;
    height: 64px;
    background: #F3F4F6;
    /* Match body bg for 'extruded' feel */
    border: none;
    border-radius: 50%;
    /* Soft Pneumatic/Neumorphic Shadows */
    box-shadow:
        9px 9px 18px #D1D5DB,
        -9px -9px 18px #FFFFFF;
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s ease;
    /* Pure shape, no icon */
    -webkit-tap-highlight-color: transparent;
}



.hardware-btn:hover {
    /* Slight lift */
    box-shadow:
        12px 12px 24px #cbd0d8,
        -12px -12px 24px #FFFFFF;
    transform: translateY(-2px);
}

.hardware-btn:active {
    /* Physical Press */
    box-shadow:
        inset 6px 6px 12px #D1D5DB,
        inset -6px -6px 12px #FFFFFF;
    transform: translateY(0);
}

/* .hardware-btn:active::after {
    opacity: 1;
} */

/* --- STICKY WIDGET TRANSITION --- */

/* 
   Layout Stability: 
   When the button enters sticky mode (fixed), it leaves the flow.
   We force the container to keep its size so the layout doesn't collapse.
*/
.interstitial-control {
    position: relative;
    /* Ensure it has a defined size context if needed, though we rely on padding/gap usually. */
    height: 64px;
    /* Force height of the button */
    width: 64px;
    /* Force width of the button */
    /* Entry Animation Init State */
    transform: translateY(6px);
    opacity: 0;
    will-change: transform, opacity;
}

/* When sticky is active, ensure fixed positioning is relative to the viewport */
body.audio-sticky-active .interstitial-control {
    transform: none !important;
    will-change: auto !important;
    transition: none !important;
    /* CRÍTICO: evita el micro-salto */
}

/* Scoped Sticky State */
#audio-btn.is-sticky {
    position: fixed;
    bottom: 30px;
    left: 30px;

    /* Ensure widget is above ALL site layers */
    z-index: 2147483647;

    /* Force widget to receive clicks even if overlays exist */
    pointer-events: auto !important;

    transform: scale(0.7);
    transform-origin: bottom left;

    box-shadow:
        5px 5px 15px rgba(0, 0, 0, 0.1),
        -5px -5px 15px rgba(255, 255, 255, 0.8);

    transition:
        opacity 0.5s ease,
        box-shadow 0.3s ease;

    background: rgba(138, 144, 194, 0.14);
    border: 1px solid rgba(138, 144, 194, 0.45);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Invisible Prep State (for JS Step 2) */
#audio-btn.is-sticky-prep {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Dimmed Start */
#audio-btn.is-sticky.is-dimmed {
    opacity: 0.4;
    transform: scale(0.7);
    /* Maintain scale */
}

/* Ensure hover restores opacity */
#audio-btn.is-sticky:hover {
    opacity: 1;
    transform: scale(0.75);
    /* Slight lift on hover while sticky */
    box-shadow:
        8px 8px 20px rgba(0, 0, 0, 0.15),
        -8px -8px 20px rgba(255, 255, 255, 0.9);
    border-color: rgba(138, 144, 194, 0.65);
}

/* ================================
   Audio Button: teleport (no travel)
   ================================ */

/* During teleport / sticky, do NOT allow hover/active translate to interfere */
#audio-btn.is-teleporting-out:hover,
#audio-btn.is-teleporting-out:active {
    transform: none !important;
}

/* Sticky: NO crecer. Mantener escala fija. */
#audio-btn.is-sticky:hover,
#audio-btn.is-sticky:active {
    transform: scale(0.7) translate3d(0, 0, 0) !important;
}

#audio-btn.is-teleporting-out {
    pointer-events: none;
    animation: audioTeleportOut 420ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transform-origin: 50% 50%;
}

@keyframes audioTeleportOut {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
        filter: blur(0px);
    }

    100% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.25);
        filter: blur(1.2px);
    }
}

/* When pausing while already sticky: flip-to-play then disappear from sticky */
#audio-btn.is-sticky.is-teleporting-out-sticky:hover,
#audio-btn.is-sticky.is-teleporting-out-sticky:active {
    transform: scale(0.7) translate3d(0, 0, 0) !important;
}

#audio-btn.is-sticky.is-teleporting-out-sticky {
    pointer-events: none !important;
    animation: audioTeleportOutSticky 420ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transform-origin: bottom left;
}

@keyframes audioTeleportOutSticky {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(0.7);
        filter: blur(0px);
    }

    100% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.25);
        filter: blur(1.2px);
    }
}

/* When it appears as sticky widget */
/* When it appears as sticky widget */
#audio-btn.is-sticky.is-teleport-in {
    animation: audioTeleportIn 900ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transform-origin: bottom left;
}

/* Teleport-in now ALSO fades in widget tint */
@keyframes audioTeleportIn {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.92);
        background: rgba(138, 144, 194, 0.00);
        border-color: rgba(138, 144, 194, 0.00);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }

    /* “Nace” con color más vivo (1 sola vez) */
    25% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(0.7);
        background: rgba(138, 144, 194, 0.55);
        border-color: rgba(138, 144, 194, 0.85);
        box-shadow: 0 0 0 6px rgba(138, 144, 194, 0.18);
    }

    /* Se apaga al look final gris */
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(0.7);
        background: rgba(138, 144, 194, 0.14);
        border-color: rgba(138, 144, 194, 0.45);
        box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.10),
            -5px -5px 15px rgba(255, 255, 255, 0.80);
    }
}

/* Blink removed as per v2 refinement request (integrated into teleport-in) */
#audio-btn.is-sticky.is-blink-once {
    /* kept for legacy safety but effectively disabled via JS */
    animation: none;
}


/* Ensure transition on body bg exists */
body {
    transition: background-color 1.2s ease, color 1.2s ease;
}


/* About Section */
.about-section {
    scroll-snap-align: start;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    z-index: 10;
    padding-top: var(--header-height);
    padding-bottom: var(--header-height);
    box-sizing: border-box;
    scroll-margin-top: var(--header-height);
    z-index: 10;
}

.about-content {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    margin-top: 0;
    /* Optical adjustment */
}

.about-image-column {
    display: flex;
    align-items: center;
    justify-content: center;
}

.computer-image {
    max-width: 100%;
    height: auto;
    animation: computerFloat 3s ease-in-out infinite;
}

@keyframes computerFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.about-column {
    width: 100%;
}

.about-column p,
.about-column p * {
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px !important;
    font-weight: 500;
    color: #272c31;
    margin-bottom: 2rem;
    transition: none;
}

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



/* Scroll Expand Section */
.scroll-expand-section {
    position: relative;
    padding: 0;
    height: 220vh;
    z-index: 20;
    /* Ensure background helps the overlap effect */
    background-color: #F3F4F6;
}

.expandable-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.expandable-content {
    width: 90%;
    height: 85vh;
    background-color: #ECEAE6;
    color: #272c31;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    will-change: width, height, border-radius;
    overflow: hidden;
    z-index: 10;
    letter-spacing: -0.02em;
    line-height: 1.16;
}

.expandable-content .container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 1200px;
    max-width: 90vw;
}

.expandable-content .subtitle {
    color: #ffffff;
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px !important;
    font-weight: 550;
}

/* Futuristic Grid Base */
.futuristic-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0;
    transition: opacity 1.5s ease;
    z-index: 1;
    pointer-events: none;
    animation: gridScroll 3s linear infinite;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}

.futuristic-grid.active {
    opacity: 0.3;
}

/* Futuristic Grid Highlight (Spotlight) */
.futuristic-grid-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0;
    transition: opacity 0.5s ease, --grid-color 0.8s ease;
    z-index: 2;
    pointer-events: none;
    animation: gridScroll 3s linear infinite;
    /* Intensity Boost for the specific requested color #5F5B85 */
    filter: brightness(1.3) drop-shadow(0 0 4px rgba(95, 91, 133, 0.6));
    mask-image: radial-gradient(circle 300px at var(--x, 50%) var(--y, 50%), black 0%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle 300px at var(--x, 50%) var(--y, 50%), black 0%, transparent 100%);
}

.futuristic-grid-highlight.active {
    opacity: 0.3;
}

/* Reduce spotlight opacity when reading text (Header or Cards) */
.expandable-content:has(.philosophy-header:hover) .futuristic-grid-highlight.active,
.expandable-content:has(.card:hover) .futuristic-grid-highlight.active,
.expandable-content:has(.philosophy-header:hover) .futuristic-grid.active,
.expandable-content:has(.card:hover) .futuristic-grid.active {

    .expandable-content:has(.philosophy-header:hover) .futuristic-grid-highlight.active,
    .expandable-content:has(.card:hover) .futuristic-grid-highlight.active,
    .expandable-content:has(.philosophy-header:hover) .futuristic-grid.active,
    .expandable-content:has(.card:hover) .futuristic-grid.active {
        opacity: 0.15;
    }
}

/* Hero Grid Hover Effect (Reading Mode) */
.hero:has(.hero-content:hover) .hero-grid,
.hero:has(.hero-content:hover) .hero-grid-highlight.active {
    opacity: 0.15;
    transition: opacity 0.5s ease;
}


/* Force animated grids to use separate compositing layer */
.hero-grid,
.hero-grid-highlight {
    will-change: background-position;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes gridScroll {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 -50px;
    }
}

.philosophy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
}

.philosophy-header h2 {
    font-family: var(--font-interface);
    font-weight: 520;
    font-size: 2.3rem;
    line-height: 1.12 !important;
    font-stretch: 94%;
    letter-spacing: -0.004em;
    margin-top: 1.2rem;
}

.philosophy-content-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    gap: 3.5rem;
    /* Tightened spacing (half of 7rem) */
    max-width: 460px;
    margin-left: 2rem;
    justify-self: start;
    margin-right: auto;
}

.philosophy-cards {
    position: relative;
    height: 200px;
    display: flex;
    justify-content: center;
    /* Center horizontally via grid constraint? No, model is col 1, this is col 2. */
    align-items: center;
    /* Vertical Center */
    /* Add padding to force model down slightly visually? Or use transform on model. */
}

.model-wrapper {
    width: 100%;
    /* Raised model by 40px (40px -> 0px) */
    transform: translate(-30px, 0px);
}


.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
}

.card.card-empty {
    /* No changes needed as parent is now transparent, but keeping for safety */
    background: transparent;
    border: none;
    box-shadow: none;
}

.card.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    z-index: 5;
}

.card.prev {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
}

.card h3,
.about-kicker {
    font-family: 'Barlow', sans-serif;
    font-weight: 550;
    font-size: 16px;
    line-height: 22px !important;
    letter-spacing: normal;
    margin-bottom: 0.8rem;
    /* 3. Slide header spacing: Breathing room */
    color: #272c31;
}

.about-kicker {
    margin: 0 0 0.35rem 0;
}

#lofiStatusText {
    display: inline-block;
    will-change: opacity, transform;
}

#lofiStatusText.is-fading {
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 180ms ease, transform 180ms ease;
}

#lofiStatusText.is-showing {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 220ms ease, transform 220ms ease;
}

.hardware-btn svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 55px;
    height: 55px;
    pointer-events: none;
    display: block;
    color: #2a2a2a;
}

.platform-logos {
    display: flex;
    gap: 20px;
    margin-top: 0.6rem;
    align-items: center;
}

.platform-logos img {
    height: 33px;
    width: auto;
    filter: brightness(0) opacity(0.55);
    transition: opacity 0.3s ease;
}

.card p {
    color: #272c31;
    font-family: 'Barlow', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 22px !important;
}

/* --- Time-Based Card Interaction Styles --- */

.progress-border {
    position: absolute;
    /* Inset negative to create breathing room around text */
    top: -24px;
    left: -24px;
    width: calc(100% + 48px);
    height: calc(100% + 48px);
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card.active .progress-border {
    opacity: 1;
}

.progress-rect {
    fill: none;
    stroke: currentColor;
    stroke-width: 2px;
    color: #272c31;
    opacity: 0.14;
    /* Target ~0.18-0.30 opacity for subtle border */

    /* Animation setup - will be controlled via JS for exact length */
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    stroke-linecap: round;
}

/* Animation trigger */
.card.active .progress-rect.animating {
    animation: progressStroke 12000ms linear forwards;
}

@keyframes progressStroke {
    to {
        stroke-dashoffset: 0;
    }
}

/* Pause Logic */
.card:hover .progress-rect.animating,
.card:focus-within .progress-rect.animating {
    animation-play-state: paused;
}

/* Controls */
.card-controls {
    display: flex;
    gap: 20px;
    margin-top: 2rem;
    align-items: center;
}

.nav-btn {
    background: none;
    border: none;
    padding: 8px;
    /* Touch target */
    font-family: inherit;
    color: inherit;
    /* Matches card text */
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    opacity: 1;
    /* Full opacity per request */
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    transform: translateX(2px);
    /* Standard feedback */
}

.nav-btn.prev:hover {
    transform: translateX(-2px);
}

.nav-btn:active {
    transform: scale(0.9);
}

/* Hide UI on empty cards explicitly */
.card-empty .card-controls,
.card-empty .progress-border {
    display: none !important;
}



/* Header Inverted State */
.site-header.inverted {
    background-color: transparent !important;
}

.site-header.inverted::before {
    opacity: 0;
}





.site-header.transparent-bg {
    background-color: transparent !important;
}

/* RA Logo Styles */
.ra-logo-container {
    display: flex;
    align-items: center;
    margin-right: 1.2rem;
}

.ra-logo-link {
    text-decoration: none;
}

.ra-logo-text {
    font-family: "Red Hat Display", system-ui, sans-serif;
    font-weight: 900;
    font-style: italic;
    text-transform: lowercase;
    white-space: nowrap;
    color: transparent;
    background-image:
        linear-gradient(120deg, #1a1a1a 40%, transparent 50%, #1a1a1a 60%),
        url('texture-min.webp');
    background-size: 250% 100%, 180% 180%;
    background-position: 100% 0%, 0% 50%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    animation: raLogoReveal 8s ease-in-out infinite;
    font-size: 1.5rem;
    /* Static override */
    color: transparent;
    background-image:
        linear-gradient(120deg, #1a1a1a 40%, transparent 50%, #1a1a1a 60%),
        url('texture-min.webp');
    background-size: 250% 100%, 180% 180%;
    /* Keep background position static */
    background-position: 100% 0%, 0% 50%;
    background-repeat: no-repeat;
    /* Ensure no repeating artifacts */
    -webkit-background-clip: text;
    background-clip: text;
    /* Disable animation globally - REMOVED */
    /* animation: none !important; */
    transition: opacity 1.5s ease-in-out;
    /* For the handoff */
}

/* Footer & Handoff Logic */
.footer-in-view .site-header .ra-logo-text {
    opacity: 0;
}

.site-footer .ra-logo-text {
    opacity: 0;
}

.footer-in-view .site-footer .ra-logo-text {
    opacity: 1;
}

/* Footer Styling (Redesign: Grid Centered 2-Row) */
#site-footer {
    background-color: #F3F4F6;
    padding: 0;
    /* Full view control */
    position: relative;
    z-index: 50;
}

.footer-content {
    display: grid;
    grid-template-rows: 1fr auto;
    /* Row 1: Logo (fills space), Row 2: Text (auto height) */
    min-height: 100vh;
    gap: 0;
    width: 100%;
}

.footer-logo-container {
    grid-row: 1;
    place-self: center;
    /* Dead center in the top available space */
    margin: 0;
}

/* Footer Columns: Anchored to bottom */
.footer-columns {
    grid-row: 2;
    align-self: end;
    /* Strict anchor to bottom */
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding-bottom: clamp(14px, 2.2vh, 28px);
    /* Breathing room */
    padding-top: 0;
    /* Reset */
}

.footer-col-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Uniform spacing, no margins on children */
}

.footer-col-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    /* Reset */
}

/* Footer Typography (DM Mono) */
.meta-line,
.meta-link,
.meta-small {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.meta-link {
    text-decoration: none;
    margin-top: 0;
    /* Explicit Reset */
    display: block;
    transition: color 0.3s ease;
}

.meta-link:hover {
    color: var(--text-primary);
}

.version-block {
    margin-top: 0;
    /* Explicit Reset */
}

/* .meta-small removed to inherit shared styles (DM Mono, 0.85rem) */

/* Boring Button */
.btn-boring {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: 'DM Mono', monospace;
    /* Match footer text */
    font-size: 0.85rem;
    /* Match footer text */
    line-height: 1.5;
    /* Strict Match */
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-boring:hover {
    border-color: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}


/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* Matte-creamy overlay (no blur, no dark cinematic) */
    background: rgba(243, 244, 246, 0.92);

    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;

    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 1rem;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* 2s fade-out when closing */
.modal-overlay.closing {
    opacity: 0;
    visibility: visible;
    /* keep it clickable/visible during fade */
    transition: opacity 2s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #F3F4F6;
    /* Match Footer/Site Base */
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    padding: 0;
    max-width: 480px;
    /* 20% narrower */
    width: 90%;
    position: relative;
    overflow: hidden;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 769px) {
    .modal-card {
        max-width: 408px;
        /* 480 * 0.85 = 408 */
    }
}

.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-image {
    width: 100%;
    height: 400px;
    background: #000;
    position: relative;
    overflow: hidden;
}

/* Pan Animation */
@keyframes catPanDown {
    from {
        object-position: 50% 0%;
    }

    to {
        object-position: 50% 100%;
    }
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 0%;
    /* Start top */
}

/* 18s Pan Animation */
/* 13.5s Pan Animation (≈33% faster than 18s) -> NOW 11.25s (20% faster) */
.modal-overlay.open .modal-image img {
    animation: catPanDown 11.25s linear forwards;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay.open .modal-image img {
        animation: none !important;
    }
}

.modal-text {
    padding: 2.5rem;
    flex: 1;
    position: relative;
}

.modal-text p {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    /* Unified color */
    margin-bottom: 1rem;
    line-height: 1.5;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
}

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

/* Circular Close Button */
/* Close button in text area (top-right) */
/* Close button in text area (top-right) */
.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;

    width: 34px;
    height: 34px;
    border-radius: 999px;

    display: flex;
    align-items: center;
    justify-content: center;

    /* VISUAL ADJUSTMENTS */
    background: #F3F4F6;
    /* mismo fondo que el texto del popup */
    border: none;
    box-shadow: none;

    color: var(--text-secondary);
    /* mismo color que el texto */
    font-size: 18px;
    line-height: 1;

    cursor: pointer;
    transition: opacity 140ms ease, transform 140ms ease;
    z-index: 10;
}

.modal-close-btn:hover {
    opacity: 0.7;
    transform: scale(1.05);
}

body.modal-open {
    overflow: hidden;
}



.modal-body {
    display: flex;
    flex-direction: row;
    align-items: center;
}


@media (max-width: 768px) {
    .footer-columns {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
        /* Force Center */
        text-align: center;
        padding-bottom: 2rem;
        /* Add some breath at bottom on mobile */
    }

    .footer-col-right {
        align-items: center;
        padding-top: 0;
        width: 100%;
        justify-content: center;
    }



    .modal-body {
        flex-direction: column;
    }

    .modal-image {
        width: 100%;
        height: 250px;
    }

    .modal-image img {
        height: 100%;
        width: 100%;
    }
}

/* --- Contact Modal (LinkedIn) --- */
.contact-modal .modal-card {
    max-width: 560px;
}

.contact-modal-text {
    padding: 2.2rem;
}

.contact-modal-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.03);
    flex: 0 0 auto;
}

.contact-kicker {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.contact-title {
    font-family: var(--font-interface);
    font-size: 1.35rem;
    line-height: 1.15;
    font-weight: 560;
    color: var(--text-primary);
    margin: 0 0 0.9rem 0;
}

.contact-body {
    font-family: var(--font-code);
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 1.2rem 0;
}

.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.25rem;
}

.contact-linkedin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.55rem 0.95rem;
    border-radius: 6px;
    text-decoration: none;

    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.18);
    color: var(--text-primary);

    font-family: var(--font-code);
    font-size: 0.85rem;
    line-height: 1.2;

    transition: transform 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.contact-linkedin-btn:hover {
    border-color: rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.contact-small {
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.9;
    margin: 0;
}

@media (max-width: 520px) {
    .contact-modal .modal-card {
        width: 94%;
    }

    .contact-modal-text {
        padding: 1.6rem;
    }

    .contact-title {
        font-size: 1.15rem;
    }

    .contact-avatar {
        width: 40px;
        height: 40px;
    }
}

/* Typography Micro-Animations */
body.is-idle:not(.hero) *:not(.hero *),
body.is-idle p:not(.hero p) {
    line-height: 1.616;
    /* +1% subtle breathing - excluded from hero section */
}



/* ULTRA STABILITY: Force text to render on completely independent layer */
.hero h1,
.hero p,
.hero .hero-description,
.hero .subtitle {
    position: relative;
    z-index: 100;
    isolation: isolate;
    transform: translate3d(0, 0, 1px);
    backface-visibility: hidden;
    perspective: 1000px;
    -webkit-font-smoothing: subpixel-antialiased;
    text-rendering: geometricPrecision;
}

/* CRITICAL: Force absolute stability for hero section */
.hero-text,
.hero-text *,
.hero h1,
.hero p,
.hero .hero-description,
.hero .subtitle {
    line-height: inherit !important;
    transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    will-change: auto !important;
    transition: none !important;
    animation: none !important;
}

/* Prevent any hover effects on hero text */
.hero-text:hover,
.hero-text *:hover,
.hero h1:hover,
.hero p:hover,
.hero .hero-description:hover,
.hero .subtitle:hover {
    line-height: inherit !important;
    transform: translateZ(0) !important;
    animation: none !important;
}

/* Ensure hero section text is always stable */
.hero,
.hero *,
.hero h1,
.hero p,
.hero .hero-description,
.hero .subtitle {
    line-height: inherit !important;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: auto;
}

small,
.metadata,
.badge,
.timestamp {
    font-family: var(--font-code);
    font-weight: 400;
}

small:hover,
.metadata:hover,
.badge:hover,
.timestamp:hover {
    animation: ghostFade 900ms linear forwards;
}

@keyframes ghostFade {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.85;
    }
}


/* Section heading presets */
.section-title {
    font-family: var(--font-interface);
    font-weight: 540;
    font-size: 2.1rem;
    line-height: 1.14;
    letter-spacing: -0.003em;
    margin-bottom: 2rem;
}

.section-subtitle {
    font-family: 'Barlow', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: #52525b;
    margin-bottom: 0.15rem;
}

.metadata-label {
    font-family: var(--font-interface);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive */
@media (prefers-reduced-motion: reduce) {
    .ra-logo-text {
        animation: none;
        background-position: 100% 0%, 0% 50%;
    }

    body,
    .hero h1 {
        animation: none;
        transition: none;
    }
}

@media (max-width: 900px) {
    .philosophy-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .philosophy-cards {
        text-align: left;
    }
}

@media (max-width: 768px) {
    .ra-logo-text {
        font-size: 1.4rem;
    }

    .hero h1 {
        font-size: 2.1rem;
        line-height: 0.96;
        letter-spacing: -0.001em;
        margin-bottom: -0.28rem;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .hero-text {
        max-width: 100%;
    }

    .hero-image {
        order: -1;
        width: 280px;
        height: 280px;
    }

    .hero-actions {
        justify-content: center;
    }

    .main-nav {
        display: none;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-column {
        width: 100%;
    }
}

/* Smooth slide-in for About section */
/* About section: Controlled via JS for scroll-linked blur effect */
.js-enhanced .about-section {
    /* Initial state handled by JS to avoid flash, or we can set defaults here */
    will-change: opacity, filter, transform;
}

/* Removed .is-visible transform/transition styles */

/* Scroll Snap & Layout Refinements (Sophisticated Mode) */
@media (min-width: 768px) {

    html,
    body {
        /* Removing scroll-snap to handle it with custom JS for "Soft Intent" */
        /* scroll-behavior: smooth;  <- Keep or remove? Better remove to control speed in JS */
    }

    .hero,
    .about-section {
        min-height: 100vh;
        position: relative;
    }

    .about-section {
        /* Ensure the wrapper is full viewport height */
        min-height: calc(100vh - var(--header-height));
        display: flex;
        align-items: center;
        justify-content: center;
        padding-top: var(--header-height);
        box-sizing: border-box;
        scroll-margin-top: var(--header-height);
    }

    .about-section .about-content {
        /* Restore 2-column layout (Image Left | Text Right) */
        /* Natural height only - do not stretch */
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
        align-items: center;
        /* Vertical center of grid items */
        width: 100%;
        max-width: var(--container-width);
    }
}

.js-enhanced .about-section.is-visible {
    /* Disable the old bounce on the container */
    animation: none;
}

/* Experimental 3D Section */
.experimental-3d-section {
    background-color: #f3f4f6;
    padding: 6rem 0;
    position: relative;
    z-index: 10;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.lab-header {
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0.7;
}

.model-wrapper {
    background: transparent;
    border-radius: 20px;
    box-shadow: none;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

/* Customizing the model-viewer progress bar color */
model-viewer {
    --progress-bar-color: var(--accent-primary);
}

/* Final Section (Section 4) */
.final-section {
    scroll-snap-align: start;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    background-color: #F3F4F6;
    /* Matches Base/Hero/About explicitly */
    /* Ensure it sits below the sticky section */

    /* --- Final Section: delayed dithering blob + ultra-slow drift (draft 7.59) --- */
    overflow: hidden;
    isolation: isolate;
}

/* content above overlays */
.final-section .final-content {
    position: relative;
    z-index: 2;
}

/* Base state: overlays OFF (so entry matches site bg perfectly) */
.final-section::before,
.final-section::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.1s ease;
    will-change: opacity, background-position;
}

/* Activated state (JS toggles this class AFTER 1s inside section) */
.final-section.fx-on::before,
.final-section.fx-on::after {
    opacity: 1;
}

/* Fast exit mode (only used when scrolling UP) */
.final-section.fx-fast-off::before,
.final-section.fx-fast-off::after {
    transition-duration: 220ms !important;
    /* quick but not harsh */
    transition-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1) !important;
}

/* 1) Matte vignette: extremely subtle (no immediate gray jump because it's hidden until fx-on) */
.final-section::before {
    z-index: 0;
    /* Updated matte gradient: lighter */
    background:
        radial-gradient(circle at 55% 45%,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0) 55%,
            rgba(0, 0, 0, 0.008) 82%,
            rgba(0, 0, 0, 0.016) 100%);

    /* Fade out at bottom (clean footer approach) */
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 72%, transparent 90%);
    mask-image: linear-gradient(to bottom, black 0%, black 72%, transparent 90%);
}

/* 2) Dither blob: radial mass + ordered dithering texture */
/* 2) Dither blob: radial mass + ordered dithering texture */
.final-section::after {
    z-index: 1;

    /* Layer A: irregular "blob" made of 2 radial gradients (not a perfect circle) */
    /* Layer B: ordered dithering pattern on top */
    /* Stronger blob gradients as requested */
    background-image:
        /* Elipse principal (más marcada, claramente elíptica) */
        radial-gradient(120% 70% at 36% 54%, rgba(0, 0, 0, 0.090) 0%, rgba(0, 0, 0, 0.050) 28%, rgba(0, 0, 0, 0.020) 44%, rgba(0, 0, 0, 0) 68%),

        /* Segunda masa para romper perfección (ruido estructural) */
        radial-gradient(95% 60% at 30% 48%, rgba(0, 0, 0, 0.060) 0%, rgba(0, 0, 0, 0.030) 26%, rgba(0, 0, 0, 0) 60%),

        /* Dithering (quantization) */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='1' height='1' x='0' y='0' fill='%23000000' fill-opacity='.22'/%3E%3Crect width='1' height='1' x='4' y='0' fill='%23000000' fill-opacity='.14'/%3E%3Crect width='1' height='1' x='2' y='2' fill='%23000000' fill-opacity='.19'/%3E%3Crect width='1' height='1' x='6' y='2' fill='%23000000' fill-opacity='.12'/%3E%3Crect width='1' height='1' x='1' y='4' fill='%23000000' fill-opacity='.16'/%3E%3Crect width='1' height='1' x='5' y='4' fill='%23000000' fill-opacity='.21'/%3E%3Crect width='1' height='1' x='3' y='6' fill='%23000000' fill-opacity='.14'/%3E%3Crect width='1' height='1' x='7' y='6' fill='%23000000' fill-opacity='.19'/%3E%3C/svg%3E");

    /* Big gradients move slowly (blob drift); dithering repeats small */
    background-repeat: no-repeat, no-repeat, repeat;
    background-size: 240% 240%, 260% 260%, 14px 14px;

    /* Start positions (left-biased / leaf-left) */
    background-position: 0% 48%, 8% 42%, 0 0;

    /* Clean cut at bottom (Top 75% visible, Bottom 25% clean) - No center masking */
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 74%, transparent 92%);
    mask-image: linear-gradient(to bottom, black 0%, black 74%, transparent 92%);

    mix-blend-mode: multiply;

    /* Multi-step appearance: start 0 */
    opacity: 0;
    /* controlled by .fx-on state via transition */
}

/* When fx-on is active, we want after to reach a readable opacity */
.final-section.fx-on::after {
    opacity: 0.235;
    /* Stronger contrast (was 0.16) */
    animation: finalDitherBlobDrift 60s linear infinite;
}

@keyframes finalDitherBlobDrift {
    0% {
        background-position: 0% 48%, 8% 42%, 0 0;
    }

    33% {
        background-position: 14% 54%, 22% 40%, 10px 6px;
    }

    66% {
        background-position: 26% 46%, 12% 58%, 22px 14px;
    }

    100% {
        background-position: 0% 48%, 8% 42%, 36px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .final-section.fx-on::after {
        animation: none !important;
    }
}

.final-content {
    text-align: center;
    max-width: 600px;
}

.final-text h2 {
    font-family: var(--font-interface);
    font-weight: 520;
    font-size: 2.3rem;
    line-height: 1.12 !important;
    /* Stability Fix */
    font-stretch: 94%;
    letter-spacing: -0.004em;
    margin-bottom: 1.5rem;
    /* Slightly more space than philosophy header for this context */
    color: var(--text-primary);
    transform: translateZ(0);
    /* Stability Fix */
}

.final-text p {
    font-family: 'Barlow', sans-serif;
    font-size: 16px;
    line-height: 22px !important;
    /* Stability Fix */
    font-weight: 500;
    color: #272c31;
    margin-bottom: 2.5rem;
    transform: translateZ(0);
    /* Stability Fix */
}

.final-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

/* GLOBAL SCROLLBAR – THUMB + TRACK DINÁMICOS */

/* Chrome / Edge / Safari */
::-webkit-scrollbar {
    width: 11px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track-color);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-color);
    border-radius: 999px;
    border: 2px solid rgba(243, 244, 246, 0.9);
    transition:
        background 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-color);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.20);
    border-color: rgba(243, 244, 246, 1);
}

/* Opcional: botones (flechas) donde el sistema aún las dibuja */
::-webkit-scrollbar-button {
    background: rgba(15, 23, 42, 0.12);
    height: 12px;
}

::-webkit-scrollbar-button:vertical:increment,
::-webkit-scrollbar-button:vertical:decrement {
    background: rgba(15, 23, 42, 0.18);
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
}

/* ================================
   RA Logo Glow – HEADER ONLY
   Restored effect using existing texture-min.webp
   Loop duration: 12s
   ================================ */

.site-header .ra-logo-text {
    color: transparent;
    background-image:
        linear-gradient(120deg, #1a1a1a 40%, transparent 50%, #1a1a1a 60%),
        url('texture-min.webp');
    background-size: 250% 100%, 180% 180%;
    background-position: 100% 0%, 0% 50%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    animation: raLogoReveal 12s ease-in-out infinite;
}

@keyframes raLogoReveal {

    0%,
    60% {
        background-position: 100% 0%, 0% 50%;
    }

    80%,
    100% {
        background-position: 0% 0%, 0% 50%;
    }
}

/* ================================
   Footer logo – force NO glow
   ================================ */

footer .ra-logo-text,
.site-footer .ra-logo-text,
.footer .ra-logo-text {
    animation: none !important;
    background-image: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    color: #1a1a1a !important;
}

/* Reduced motion safety */
@media (prefers-reduced-motion: reduce) {
    .site-header .ra-logo-text {
        animation: none;
        background-position: 100% 0%, 0% 50%;
    }
}

/* Fallback for Lazy Loaded Model */
model-viewer:not(:defined) {
    display: block;
    width: 100%;
    height: 350px;
    background-color: transparent;
}

/* Footer Spacing Adjustment (Desktop Only) */
@media (min-width: 769px) {
    .footer-col-left {
        padding-left: 3%;
    }

    .footer-col-right {
        padding-right: 3%;
    }
}

/* Cat Modal ONLY — widen text area on desktop without touching Contact modal */
@media (min-width: 769px) {
    #cat-modal .modal-card {
        max-width: 490px;
        /* 408 * 1.2 = ~490 */
    }

    #cat-modal .modal-body {
        align-items: stretch;
    }

    /* IMPORTANT: override the generic width:100% that is squeezing the text */
    #cat-modal .modal-image {
        width: auto;
        flex: 0 0 50%;
        /* Equal width (50/50) */
        height: 400px;
        /* keep the same visual presence */
    }

    #cat-modal .modal-text {
        flex: 0 0 50%;
        /* Equal width (50/50) */
        display: flex;
        flex-direction: column;
        justify-content: center;
        /* Vertically center the text */
    }
}

/* TEMPORARY: MOBILE GATE (remove when mobile layout is ready) */
/* =========================
   MOBILE GATE (TEMPORARY)
   ========================= */
.mobile-gate {
    display: none;
}

@media (max-width: 900px) {
    /* Hide entire site content on mobile */
    body > *:not(.mobile-gate) {
        display: none !important;
    }

    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .mobile-gate {
        display: flex !important;
        position: fixed;
        inset: 0;
        z-index: 999999;
        align-items: center;
        justify-content: center;
        background: var(--bg, #ECEAE6);
        padding: 24px;
        flex-direction: column;
    }

    .mobile-gate__inner {
        max-width: 520px;
        text-align: center;
    }

    .mobile-gate__logo {
        display: flex;
        justify-content: center;
        margin-bottom: 20px;
    }

    .mobile-gate__msg {
        font-family: inherit;
        /* IMPORTANT: same body font */
        color: inherit;
        font-size: 14px;
        line-height: 1.55;
        opacity: 0.75;
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
    }

    .mobile-gate__msg strong {
        font-weight: 500;
    }
}

/* PERF: render-skip for below-the-fold sections (no visual regression) */
.about-section,
.scroll-expand-section,
.final-section,
#site-footer {
    content-visibility: auto;
    contain-intrinsic-size: 900px;
}