/* =========================================================
   Theme tokens (Light / Dark)
   ========================================================= */
:root {
    --bg: 255 255 255;
    --fg: 10 10 14;
    --muted: 100 105 115;
    --accent: 99 102 241;       /* indigo-500 */
    --border: 220 222 228;

    --glass-bg: 255 255 255;
    --glass-border: 0 0 0;
    --glass-highlight: 255 255 255;
}

html.dark {
    --bg: 8 8 12;
    --fg: 240 240 245;
    --muted: 140 145 155;
    --accent: 129 140 248;      /* indigo-400 */
    --border: 35 38 45;

    --glass-bg: 30 30 38;
    --glass-border: 255 255 255;
    --glass-highlight: 255 255 255;
}

html, body {
    background-color: rgb(var(--bg));
    color: rgb(var(--fg));
    transition: background-color 0.4s ease, color 0.4s ease;
}
/* Ensure the html element itself paints the bg so dark-mode toggle is reliable */
html { background-color: rgb(var(--bg)); }


/* =========================================================
   Liquid Glass Buttons + Pills
   Frosted glass with backdrop-filter, inner highlights for
   "depth", and a cursor-tracking light sweep.
   ========================================================= */
.glass-button {
    --mx: 50%;
    --my: 50%;

    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    color: rgb(var(--fg));
    background: rgb(var(--glass-bg) / 0.08);
    border: 1px solid rgb(var(--glass-border) / 0.12);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.18),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.04),
        0 4px 24px -8px rgb(0 0 0 / 0.10);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    overflow: hidden;
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

:is(html.dark, .force-dark) .glass-button {
    background: rgb(var(--glass-bg) / 0.30);
    border-color: rgb(var(--glass-border) / 0.10);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.10),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.20),
        0 4px 24px -8px rgb(0 0 0 / 0.40);
}

/* Top gloss */
.glass-button::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg,
        rgb(var(--glass-highlight) / 0.22) 0%,
        rgb(var(--glass-highlight) / 0) 45%);
    pointer-events: none;
    z-index: 0;
}

/* Cursor-tracking light sweep */
.glass-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(140px circle at var(--mx) var(--my),
        rgb(var(--glass-highlight) / 0.20),
        transparent 55%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 0;
}

.glass-button > * { position: relative; z-index: 1; }

.glass-button:hover {
    transform: translateY(-2px);
    background: rgb(var(--glass-bg) / 0.14);
    border-color: rgb(var(--glass-border) / 0.20);
}
:is(html.dark, .force-dark) .glass-button:hover {
    background: rgb(var(--glass-bg) / 0.45);
    border-color: rgb(var(--glass-border) / 0.18);
}
.glass-button:hover::after { opacity: 1; }
.glass-button:active { transform: translateY(0) scale(0.98); }
.glass-button:hover .arrow { transform: translateX(3px); }
.arrow { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

/* Primary variant — inverted, the "Apple primary" feel */
.glass-button-primary {
    background: rgb(var(--fg) / 0.92);
    color: rgb(var(--bg));
    border: 1px solid rgb(var(--fg) / 1);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.25),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.18),
        0 8px 24px -8px rgb(var(--fg) / 0.45);
}
.glass-button-primary:hover {
    background: rgb(var(--fg));
    border-color: rgb(var(--fg));
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.30),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.20),
        0 12px 32px -8px rgb(var(--fg) / 0.55);
}
.glass-button-primary::before {
    background: linear-gradient(180deg,
        rgb(var(--glass-highlight) / 0.30) 0%,
        rgb(var(--glass-highlight) / 0) 50%);
}

/* Dark-mode primary: keep it visible without the harsh black-on-white look */
:is(html.dark, .force-dark) .glass-button-primary {
    background: rgb(var(--fg) / 0.10);
    color: rgb(var(--fg));
    border: 1px solid rgb(var(--fg) / 0.25);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.18),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.30),
        0 8px 24px -8px rgb(0 0 0 / 0.55);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
}
:is(html.dark, .force-dark) .glass-button-primary:hover {
    background: rgb(var(--fg) / 0.18);
    border-color: rgb(var(--fg) / 0.35);
}

/* CTA — vibrant gradient button, identical in light AND dark mode.
   Use for the "look at me" actions like the email button. */
.glass-button-cta {
    background: linear-gradient(120deg,
        #6366f1 0%,
        #a855f7 25%,
        #ec4899 55%,
        #f59e0b 100%);
    background-size: 240% 240%;
    color: #fff !important;
    border: none !important;
    text-shadow: 0 1px 2px rgb(0 0 0 / 0.20);
    box-shadow:
        inset 0 1px 0 0 rgb(255 255 255 / 0.30),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.18),
        0 10px 32px -8px rgb(236 72 153 / 0.55),
        0 0 0 1px rgb(255 255 255 / 0.12);
    animation: cta-gradient-shift 8s ease infinite;
}
.glass-button-cta::before {
    /* override the default glossy stripe */
    background: linear-gradient(180deg,
        rgb(255 255 255 / 0.25) 0%,
        rgb(255 255 255 / 0) 55%);
}
.glass-button-cta:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 0 rgb(255 255 255 / 0.35),
        inset 0 -1px 0 0 rgb(0 0 0 / 0.18),
        0 16px 44px -8px rgb(236 72 153 / 0.65),
        0 0 0 1px rgb(255 255 255 / 0.18);
}
:is(html.dark, .force-dark) .glass-button-cta {
    /* Use !important to win over the dark-mode primary rule above */
    background: linear-gradient(120deg,
        #6366f1 0%,
        #a855f7 25%,
        #ec4899 55%,
        #f59e0b 100%) !important;
    background-size: 240% 240% !important;
    color: #fff !important;
}
@keyframes cta-gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Large variant for hero/contact */
.glass-button-lg {
    height: 3.25rem;
    padding: 0 1.75rem;
    font-size: 0.95rem;
}

/* Icon-only square variant for nav arrows */
.glass-icon {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
}
.glass-icon:disabled,
.glass-icon[disabled] { opacity: 0.35; pointer-events: none; }

/* Disabled-looking glass (e.g. "Próximamente") */
.glass-button-disabled {
    cursor: default;
    color: rgb(var(--muted));
}
.glass-button-disabled:hover { transform: none; }


/* =========================================================
   Glass Pills (status badges, tags)
   ========================================================= */
.glass-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2rem;
    padding: 0 0.875rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(var(--fg));
    background: rgb(var(--glass-bg) / 0.08);
    border: 1px solid rgb(var(--glass-border) / 0.10);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow: inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.15);
}
:is(html.dark, .force-dark) .glass-pill {
    background: rgb(var(--glass-bg) / 0.30);
    border-color: rgb(var(--glass-border) / 0.08);
}
.glass-pill-sm {
    height: 1.6rem;
    padding: 0 0.625rem;
    font-size: 0.7rem;
}

/* Status indicator dots */
.status-dot {
    position: relative;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: rgb(52 211 153);          /* emerald — "online" */
    box-shadow: 0 0 0 0 rgb(52 211 153 / 0.6);
    animation: status-pulse 2s ease-out infinite;
}
.status-dot-amber {
    background: rgb(251 191 36);
    box-shadow: 0 0 0 0 rgb(251 191 36 / 0.6);
}
@keyframes status-pulse {
    0%   { box-shadow: 0 0 0 0 rgb(52 211 153 / 0.55); }
    70%  { box-shadow: 0 0 0 7px rgb(52 211 153 / 0); }
    100% { box-shadow: 0 0 0 0 rgb(52 211 153 / 0); }
}
.status-dot-amber {
    animation-name: status-pulse-amber;
}
@keyframes status-pulse-amber {
    0%   { box-shadow: 0 0 0 0 rgb(251 191 36 / 0.55); }
    70%  { box-shadow: 0 0 0 7px rgb(251 191 36 / 0); }
    100% { box-shadow: 0 0 0 0 rgb(251 191 36 / 0); }
}


/* =========================================================
   Site Header — liquid-glass bar with sliding indicator
   and scroll-progress underline.
   ========================================================= */
.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 50;
    color: #fff;                /* default = over the dark hero */
    transition:
        background-color 0.35s ease,
        border-color     0.35s ease,
        backdrop-filter  0.35s ease,
        color            0.35s ease;
    border-bottom: 1px solid transparent;
    background: transparent;
}

.site-header-bar {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    gap: 1rem;
}

.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 1.05rem;
    color: inherit;
    text-decoration: none;
}
.header-brand-mark {
    width: 1.6rem;
    height: 1.6rem;
    color: rgb(99 102 241);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    filter: drop-shadow(0 0 8px rgb(99 102 241 / 0.4));
}
.header-brand:hover .header-brand-mark {
    transform: rotate(60deg);
}
.header-brand-dot {
    color: rgb(99 102 241);
    margin-left: 0.05em;
}

/* CV download — liquid glass pill, sits between nav and theme toggler */
.header-cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.85rem;
    height: 2.1rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease, color 0.25s ease;
}
.header-cv-btn svg {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.header-cv-btn:hover {
    color: rgb(165 180 252);
}
.header-cv-btn:hover svg {
    transform: translateY(2px);
}
@media (max-width: 480px) {
    /* On very small screens, collapse to icon-only */
    .header-cv-label { display: none; }
    .header-cv-btn { padding: 0 0.55rem; }
}

/* The pill nav — liquid-glass capsule with a sliding indicator */
.header-nav {
    position: relative;
    display: none;
    align-items: center;
    height: 2.5rem;
    padding: 0 0.3rem;
    border-radius: 9999px;
    background: rgb(255 255 255 / 0.06);
    border: 1px solid rgb(255 255 255 / 0.12);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow:
        inset 0 1px 0 0 rgb(255 255 255 / 0.18),
        0 6px 24px -8px rgb(0 0 0 / 0.30);
}
@media (min-width: 720px) {
    .header-nav { display: inline-flex; }
}
.header-nav a {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    padding: 0 0.95rem;
    height: 1.9rem;
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 500;
    color: rgb(255 255 255 / 0.55);
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap;
}
.header-nav a:hover,
.header-nav a.is-active {
    color: rgb(255 255 255 / 1);
}
.header-nav-indicator {
    position: absolute;
    top: 0.3rem;
    bottom: 0.3rem;
    left: 0;
    width: 0;
    background: rgb(255 255 255 / 0.16);
    border-radius: 9999px;
    transform: translateX(0);
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        width     0.45s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.3s ease;
    box-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.20);
    z-index: 0;
}

/* Scroll-progress bar at the bottom of the header */
.header-progress {
    position: relative;
    height: 2px;
    background: rgb(255 255 255 / 0.06);
}
.header-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #f59e0b);
    background-size: 200% 100%;
    animation: cta-gradient-shift 8s linear infinite;
    transition: width 0.06s linear;
}

/* When scrolled past the dark hero: switch to theme colors */
.site-header.is-scrolled {
    background: rgb(var(--bg) / 0.70);
    border-bottom-color: rgb(var(--border) / 0.5);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    color: rgb(var(--fg));
}
.site-header.is-scrolled .header-nav {
    background: rgb(var(--fg) / 0.04);
    border-color: rgb(var(--fg) / 0.10);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.10),
        0 6px 24px -8px rgb(0 0 0 / 0.10);
}
.site-header.is-scrolled .header-nav a { color: rgb(var(--muted)); }
.site-header.is-scrolled .header-nav a:hover,
.site-header.is-scrolled .header-nav a.is-active { color: rgb(var(--fg)); }
.site-header.is-scrolled .header-nav-indicator {
    background: rgb(var(--fg) / 0.10);
}
.site-header.is-scrolled .header-progress { background: rgb(var(--fg) / 0.05); }

/* Theme toggle button inside header — match current header color */
.site-header .theme-toggler {
    border-color: rgb(255 255 255 / 0.20);
    color: inherit;
}
.site-header.is-scrolled .theme-toggler {
    border-color: rgb(var(--border) / 0.6);
}


/* =========================================================
   MorphingText (Magic UI)
   Two stacked text spans cross-fade-blur via SVG threshold.
   ========================================================= */
.morphing-text {
    position: relative;
    display: block;
    width: 100%;
    height: clamp(4rem, 12vw, 9rem);
    filter: url(#threshold) blur(0.6px);
    user-select: none;
}
.morphing-text .morph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(3rem, 11vw, 7.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: rgb(var(--fg));
    will-change: filter, opacity;
}
/* When the morphing text lives inside the dark hero, force light color */
.hero-geometric .morphing-text .morph {
    color: #fff;
}
/* Hero variant — bigger */
.morphing-text-hero {
    height: clamp(5rem, 16vw, 12rem);
    margin-bottom: 1.5rem;
}
.morphing-text-hero .morph {
    font-size: clamp(3.5rem, 14vw, 10rem);
    letter-spacing: -0.045em;
}


/* =========================================================
   Hero — HeroGeometric (kokonut/benscott style)
   Dark stage with 5 floating "elegant shape" pills.
   ========================================================= */
.hero-geometric {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #030303;
    color: #fff;
}

.hero-geometric-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgb(99 102 241 / 0.06),
        transparent 50%,
        rgb(244 63 94 / 0.06));
    filter: blur(80px);
    pointer-events: none;
}

.hero-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Outer wrapper handles the entry: drops in + rotates from a tilted start.
   Inner wrapper handles the continuous gentle float. */
.elegant-shape {
    position: absolute;
    opacity: 0;
    animation:
        elegant-shape-fade  1.2s ease                                var(--delay, 0s) forwards,
        elegant-shape-enter 2.4s cubic-bezier(0.23, 0.86, 0.39, 0.96) var(--delay, 0s) forwards;
}
@keyframes elegant-shape-fade {
    to { opacity: 1; }
}
@keyframes elegant-shape-enter {
    0%   { transform: translateY(-150px) rotate(var(--rotate-start, 0deg)); }
    100% { transform: translateY(0)      rotate(var(--rotate, 0deg)); }
}

.elegant-shape-float {
    position: relative;
    width:  var(--w, 400px);
    height: var(--h, 100px);
    animation: elegant-shape-float 12s ease-in-out infinite;
}
@keyframes elegant-shape-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(15px); }
}

.elegant-shape-fill {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--grad-from, rgb(255 255 255 / 0.08)), transparent);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 2px solid rgb(255 255 255 / 0.15);
    box-shadow: 0 8px 32px 0 rgb(255 255 255 / 0.10);
}
.elegant-shape-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 50%, rgb(255 255 255 / 0.2), transparent 70%);
}

.hero-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgb(3 3 3 / 0.85), transparent 25%, transparent 75%, rgb(3 3 3 / 0.95));
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
    max-width: 48rem;
    padding: 0 1.5rem;
}

/* Each content piece fades up with a stagger */
.hero-badge,
.hero-title,
.hero-tagline,
.hero-ctas {
    opacity: 0;
    transform: translateY(30px);
    animation: hero-fade-up 1s cubic-bezier(0.25, 0.4, 0.25, 1) forwards;
}
.hero-badge   { animation-delay: 0.5s; }
.hero-title   { animation-delay: 0.7s; }
.hero-tagline { animation-delay: 0.9s; }
.hero-ctas    { animation-delay: 1.1s; }

@keyframes hero-fade-up {
    to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    background: rgb(255 255 255 / 0.03);
    border: 1px solid rgb(255 255 255 / 0.08);
    margin-bottom: 2.5rem;
    font-size: 0.875rem;
    color: rgb(255 255 255 / 0.6);
    letter-spacing: 0.01em;
}
.hero-badge-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: rgb(244 63 94 / 0.85);
    box-shadow: 0 0 8px rgb(244 63 94 / 0.4);
}

.hero-title {
    font-size: clamp(3rem, 12vw, 9rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.045em;
    margin-bottom: 2rem;
}
.hero-title-1 {
    display: inline-block;
    background: linear-gradient(180deg, #ffffff, rgb(255 255 255 / 0.8));
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}
.hero-title-2 {
    display: inline-block;
    background: linear-gradient(90deg,
        rgb(165 180 252),
        rgb(255 255 255 / 0.95),
        rgb(253 164 175));
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.hero-tagline {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 300;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: rgb(255 255 255 / 0.45);
    max-width: 36rem;
    margin: 0 auto 2.25rem;
    padding: 0 1rem;
}

.hero-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

/* Glass buttons inside the dark hero need different surface tones */
.glass-on-dark {
    background: rgb(255 255 255 / 0.06) !important;
    border-color: rgb(255 255 255 / 0.12) !important;
    color: #fff !important;
}
.glass-on-dark:hover {
    background: rgb(255 255 255 / 0.12) !important;
    border-color: rgb(255 255 255 / 0.22) !important;
}
.glass-on-dark.glass-button-primary {
    background: #fff !important;
    color: #030303 !important;
    border-color: #fff !important;
}
.glass-on-dark.glass-button-primary:hover {
    background: rgb(255 255 255 / 0.92) !important;
}


/* =========================================================
   GradientDots — animated hexagonal dot pattern
   Direct CSS port of the framer-motion component.
   ========================================================= */
.gradient-dots {
    --gd-bg: rgb(var(--bg));
    --gd-dot: 8px;
    --gd-spacing: 10px;
    --gd-hex: 17.32px; /* spacing * 1.732 */

    position: absolute;
    inset: 0;
    background-color: var(--gd-bg);
    background-image:
        radial-gradient(circle at 50% 50%, transparent 1.5px, var(--gd-bg) 0 var(--gd-dot), transparent var(--gd-dot)),
        radial-gradient(circle at 50% 50%, transparent 1.5px, var(--gd-bg) 0 var(--gd-dot), transparent var(--gd-dot)),
        radial-gradient(circle  at 50% 50%, #f00, transparent 60%),
        radial-gradient(circle  at 50% 50%, #ff0, transparent 60%),
        radial-gradient(circle  at 50% 50%, #0f0, transparent 60%),
        radial-gradient(ellipse at 50% 50%, #00f, transparent 60%);
    background-size:
        var(--gd-spacing) var(--gd-hex),
        var(--gd-spacing) var(--gd-hex),
        200% 200%,
        200% 200%,
        200% 200%,
        200% var(--gd-hex);
    animation:
        gradient-dots-move 30s linear infinite,
        gradient-dots-hue   6s linear infinite;
    will-change: background-position, filter;
}

@keyframes gradient-dots-move {
    0% {
        background-position:
            0px 0px,
            5px 8.66px,
            800% 400%,
            1000% -400%,
            -1200% -600%,
            400% 17.32px;
    }
    100% {
        background-position:
            0px 0px,
            5px 8.66px,
            0% 0%,
            0% 0%,
            0% 0%,
            0% 0%;
    }
}
@keyframes gradient-dots-hue {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}


/* =========================================================
   Contact — flashy with gradient dots + huge headline
   ========================================================= */
.contact-section {
    position: relative;
    padding: 9rem 1.5rem;
    overflow: hidden;
}
.contact-section .gradient-dots { opacity: 0.55; }

.contact-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center,
        rgb(var(--bg) / 0) 0%,
        rgb(var(--bg) / 0.40) 45%,
        rgb(var(--bg) / 0.92) 85%);
}

.contact-inner {
    position: relative;
    z-index: 1;
    max-width: 52rem;
    margin: 0 auto;
    text-align: center;
}

.contact-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgb(var(--muted));
    margin-bottom: 1.5rem;
}

.contact-headline {
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin: 0 0 1.5rem;
}
.contact-headline-line-1,
.contact-headline-line-2 {
    display: block;
}
.contact-headline-line-1 {
    background: linear-gradient(180deg, rgb(var(--fg)), rgb(var(--fg) / 0.8));
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}
.contact-headline-line-2 {
    background: linear-gradient(90deg,
        #6366f1,
        #a855f7,
        #ec4899,
        #f59e0b);
    background-size: 200% auto;
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    animation: cta-gradient-shift 10s linear infinite;
}

.contact-tagline {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: rgb(var(--muted));
    line-height: 1.6;
    max-width: 32rem;
    margin: 0 auto 2.5rem;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.contact-footnote {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: rgb(var(--muted) / 0.8);
}


/* =========================================================
   ScrollBasedVelocity
   ========================================================= */
.scroll-velocity-container { padding: 1rem 0; }
.scroll-velocity-row { overflow: hidden; }
.scroll-velocity-track { will-change: transform; }
.skill-item {
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    padding: 0 1.5rem;
    white-space: nowrap;
    color: rgb(var(--fg));
}
.skill-dot {
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: rgb(var(--accent));
    padding: 0 0.25rem;
}


/* =========================================================
   DiaTextReveal
   ========================================================= */
.dia-text-reveal {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: rgb(var(--fg));
}
.dia-text-reveal .dia-word {
    display: inline-block;
    white-space: nowrap;
    margin-right: 0.4em;
}
.dia-text-reveal .dia-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.4em);
    color: var(--letter-color, currentColor);
    transition:
        opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        color 0.9s ease 0.2s;
}
.dia-text-reveal.is-visible .dia-letter {
    opacity: 1;
    transform: translateY(0);
    color: currentColor;
}


/* =========================================================
   IconCloud
   ========================================================= */
.icon-cloud-wrapper {
    width: min(420px, 100%);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-cloud-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}
.icon-cloud-canvas:active { cursor: grabbing; }


/* =========================================================
   AnimatedThemeToggler
   ========================================================= */
.theme-toggler { color: rgb(var(--fg)); overflow: hidden; }
.theme-toggler .theme-icon {
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity   0.35s ease;
}
html:not(.dark) .theme-toggler .sun  { transform: rotate(0deg) scale(1); opacity: 1; }
html:not(.dark) .theme-toggler .moon { transform: rotate(90deg) scale(0); opacity: 0; }
html.dark       .theme-toggler .sun  { transform: rotate(-90deg) scale(0); opacity: 0; }
html.dark       .theme-toggler .moon { transform: rotate(0deg) scale(1); opacity: 1; }


/* =========================================================
   Ethereal Shadow (background for About)
   Direct CSS/SVG port — the SVG filter values are animated
   via SMIL <animate> so no framer-motion is needed.
   ========================================================= */
.about-section {
    position: relative;
    padding: 7rem 1.5rem;
    overflow: hidden;
}

.ethereal-shadow {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.ethereal-svg {
    position: absolute;
    width: 0;
    height: 0;
}

.ethereal-shadow-filtered {
    position: absolute;
    inset: -100px;
    filter: url(#ethereal-filter) blur(4px);
}

.ethereal-shadow-fill {
    width: 100%;
    height: 100%;
    background-color: rgb(120 120 130 / 0.65);
            mask-image: url('https://framerusercontent.com/images/ceBGguIpUU8luwByxuQz79t7To.png');
    -webkit-mask-image: url('https://framerusercontent.com/images/ceBGguIpUU8luwByxuQz79t7To.png');
            mask-size: cover;
    -webkit-mask-size: cover;
            mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
            mask-position: center;
    -webkit-mask-position: center;
}

.ethereal-shadow-noise {
    position: absolute;
    inset: 0;
    background-image: url('https://framerusercontent.com/images/g0QcWrxr87K0ufOxIUFBakwYA8.png');
    background-size: 240px;
    background-repeat: repeat;
    opacity: 0.28;
    mix-blend-mode: overlay;
}

/* Soft tint over the shadow so content stays legible in both themes */
.ethereal-shadow-tint {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center,
            rgb(var(--bg) / 0) 0%,
            rgb(var(--bg) / 0.30) 55%,
            rgb(var(--bg) / 0.75) 90%);
}

.about-inner {
    position: relative;
    z-index: 1;
}


/* =========================================================
   About — alems.tech-inspired layout
   ========================================================= */
.about-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgb(var(--muted));
    margin-bottom: 2.5rem;
}
.about-eyebrow-line {
    width: 2rem;
    height: 1px;
    background: rgb(var(--fg) / 0.3);
}

.about-grid {
    display: grid;
    gap: 3rem;
    grid-template-columns: 1fr;
}
@media (min-width: 900px) {
    .about-grid {
        grid-template-columns: 1.4fr 1fr;
        align-items: start;
        gap: 4rem;
    }
}

.about-headline {
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: rgb(var(--fg));
    max-width: 36rem;
}
.about-headline-muted {
    color: rgb(var(--muted));
}

.about-paragraphs {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 1rem;
    line-height: 1.7;
    color: rgb(var(--muted));
    max-width: 34rem;
}
.about-strong { color: rgb(var(--fg)); font-weight: 600; }

/* Stats grid */
.about-stats {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 36rem;
}
@media (min-width: 600px) {
    .about-stats { grid-template-columns: repeat(4, 1fr); }
}
.about-stat {
    position: relative;
    padding: 1rem 0;
    border-top: 1px solid rgb(var(--fg) / 0.10);
}
.about-stat-value {
    font-size: clamp(1.5rem, 2.5vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: rgb(var(--fg));
    font-feature-settings: 'tnum';
    line-height: 1;
}
.about-stat-plus {
    color: rgb(var(--accent));
    margin-left: 0.1em;
}
.about-stat-label {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgb(var(--muted));
}

/* Identity card */
.about-card {
    position: relative;
    padding: 2.25rem 1.75rem;
    border-radius: 1.5rem;
    background: rgb(var(--glass-bg) / 0.06);
    border: 1px solid rgb(var(--glass-border) / 0.10);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.10),
        0 24px 56px -24px rgb(0 0 0 / 0.20);
    text-align: center;
    overflow: hidden;
}
:is(html.dark, .force-dark) .about-card {
    background: rgb(var(--glass-bg) / 0.25);
    border-color: rgb(var(--glass-border) / 0.08);
}
.about-card::before {
    content: '';
    position: absolute;
    inset: -50% 25% auto 25%;
    height: 80%;
    background: radial-gradient(ellipse at center top,
        rgb(var(--accent) / 0.25),
        transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.about-card-avatar {
    position: relative;
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 9999px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        rgb(var(--accent) / 0.35),
        rgb(244 114 182 / 0.25));
    border: 1px solid rgb(var(--fg) / 0.10);
    isolation: isolate;
}
.about-card-avatar-text {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: rgb(var(--fg));
}
.about-card-avatar-glow {
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 50%,
        rgb(var(--accent) / 0.4), transparent 65%);
    filter: blur(14px);
    z-index: -1;
}

.about-card-name {
    position: relative;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: rgb(var(--fg));
    margin-bottom: 0.25rem;
}
.about-card-role {
    position: relative;
    font-size: 0.85rem;
    color: rgb(var(--muted));
    margin-bottom: 1.5rem;
}

.about-card-meta {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.about-card-meta li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-size: 0.825rem;
    color: rgb(var(--fg) / 0.85);
}
.about-card-meta svg { color: rgb(var(--muted)); flex-shrink: 0; }

/* =========================================================
   About — Globe variant (Magic UI Globe via cobe)
   Vertically centered on the right column, square card with
   the globe rotating beneath a soft gradient "Globe" title.
   ========================================================= */
.about-card--globe {
    padding: 0;
    align-self: center;
    aspect-ratio: 1 / 1.05;
    overflow: hidden;
    isolation: isolate;
    text-align: center;
}
.about-card--globe::before {
    inset: -30% 25% auto 25%;
    height: 55%;
    opacity: 0.55;
}
.about-globe-title {
    position: absolute;
    top: 1.25rem;
    left: 0;
    right: 0;
    z-index: 1;
    font-size: clamp(2.25rem, 7vw, 3.75rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    background: linear-gradient(to bottom,
        rgb(255 255 255) 0%,
        rgb(15 23 42 / 0.10) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html:not(.dark) .about-globe-title {
    background: linear-gradient(to bottom,
        rgb(0 0 0) 0%,
        rgb(209 213 219 / 0.80) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
.about-globe-stage {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 5.25rem;
    bottom: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.about-globe-canvas {
    height: 100%;
    width: auto;
    aspect-ratio: 1;
    max-width: 100%;
    max-height: 100%;
    display: block;
    cursor: grab;
    contain: layout paint;
}
.about-globe-canvas:active { cursor: grabbing; }
.about-globe-vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(
        circle at 50% 200%,
        rgb(0 0 0 / 0.55),
        rgb(0 0 0 / 0) 50%);
}
.about-globe-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1.1rem;
    z-index: 4;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgb(var(--muted));
    pointer-events: none;
}


/* =========================================================
   Projects — Horizontal Scroller
   ========================================================= */
.projects-scroller {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0 2rem;
    /* fade edges */
    mask-image: linear-gradient(90deg,
        transparent 0,
        black 5%,
        black 95%,
        transparent 100%);
    -webkit-mask-image: linear-gradient(90deg,
        transparent 0,
        black 5%,
        black 95%,
        transparent 100%);
}
.projects-scroller::-webkit-scrollbar { display: none; }
.projects-scroller.is-dragging { cursor: grabbing; }
.projects-scroller.is-dragging .project-card { pointer-events: none; }

.projects-track {
    display: flex;
    gap: 1.5rem;
    padding: 0 max(1.5rem, calc(50vw - 14.5rem));
    align-items: stretch;
}
.projects-track-spacer {
    flex: 0 0 max(1.5rem, calc(50vw - 14.5rem));
}

.project-card {
    position: relative;
    flex: 0 0 min(460px, 80vw);
    aspect-ratio: 4 / 5;
    border-radius: 1.75rem;
    overflow: hidden;
    scroll-snap-align: center;
    isolation: isolate;
    border: 1px solid rgb(var(--glass-border) / 0.10);
    background: rgb(var(--glass-bg) / 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.10),
        0 24px 56px -24px rgb(0 0 0 / 0.25);
    transition:
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.4s ease;
}
:is(html.dark, .force-dark) .project-card {
    background: rgb(var(--glass-bg));
    border-color: rgb(var(--glass-border) / 0.16);
}

.project-card-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    opacity: 0.9;
    transition: opacity 0.5s ease;
}

/* Cursor spotlight inside the card */
.project-card-spotlight {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        320px circle at var(--mx, 50%) var(--my, 50%),
        rgb(var(--accent-rgb, var(--fg)) / 0.18),
        transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.project-card:hover { transform: translateY(-4px); }
.project-card:hover .project-card-spotlight { opacity: 1; }
.project-card:hover { border-color: rgb(var(--accent-rgb, var(--fg)) / 0.35); }

.project-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.project-number {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: rgb(var(--muted));
    font-feature-settings: 'tnum';
}

/* Line-icon watermark — centered horizontally, positioned in the upper
   third of the card (between the header row and the title block). */
.project-icon-bg {
    position: absolute;
    top: 13%;
    left: 0;
    right: 0;
    z-index: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    user-select: none;
    color: rgb(var(--accent-rgb, 255 255 255));
    opacity: 0.6;
    transition:
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.5s ease;
    /* Single drop-shadow is dramatically cheaper to paint than the triple
       stack — looks ~95% as good with a wider, softer blur. */
    filter: drop-shadow(0 0 24px rgb(var(--accent-rgb, 255 255 255) / 0.55));
}
.project-icon-bg svg {
    width: clamp(13rem, 62%, 21rem);
    height: auto;
    display: block;
}
.project-card:hover .project-icon-bg {
    transform: scale(1.06);
    opacity: 0.85;
}

/* Brand logo chip — sits next to the project number */
.project-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: #fff;
    padding: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 0 rgb(255 255 255 / 0.7),
        0 6px 18px -4px rgb(0 0 0 / 0.25);
}
.project-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.project-logo.project-logo-missing { display: none; }

/* Circular brand image — overlaps the right edge of the card */
.project-image-badge {
    position: absolute;
    right: -2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(9rem, 22vw, 14rem);
    height: clamp(9rem, 22vw, 14rem);
    border-radius: 50%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    border: 1px solid rgb(var(--accent-rgb, 255 255 255) / 0.28);
    box-shadow:
        0 24px 60px -16px rgb(0 0 0 / 0.55),
        inset 0 1px 0 0 rgb(255 255 255 / 0.08);
    opacity: 0.92;
    transition:
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.4s ease;
}
.project-image-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.project-card:hover .project-image-badge {
    transform: translateY(-50%) scale(1.04);
    opacity: 1;
}

.project-title {
    font-size: clamp(1.25rem, 2.6vw, 1.65rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: rgb(var(--fg));
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

.project-description {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgb(var(--muted));
    max-width: 32rem;
}

.project-tech-chip {
    display: inline-flex;
    align-items: center;
    height: 1.6rem;
    padding: 0 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    color: rgb(var(--fg) / 0.85);
    background: rgb(var(--fg) / 0.06);
    border: 1px solid rgb(var(--fg) / 0.08);
}

/* Progress dots */
.project-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: rgb(var(--fg) / 0.18);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}
.project-dot.is-active {
    width: 1.5rem;
    background: rgb(var(--fg) / 0.85);
}


/* =========================================================
   Section bridges — soft fades between sections so the
   theme/dark transitions feel gradual instead of abrupt.
   ========================================================= */
.section-bridge {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 5;
    height: 180px;
}
/* Bottom of a dark section fading into the theme bg below */
.section-bridge-bottom {
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgb(var(--bg) / 0.4) 60%,
        rgb(var(--bg)) 100%);
}
/* Top of a section fading from the theme bg above (light → dark hand-off) */
.section-bridge-top {
    top: 0;
    background: linear-gradient(
        to top,
        transparent 0%,
        rgb(var(--bg) / 0.4) 60%,
        rgb(var(--bg)) 100%);
}
/* Dark variant — for sections that are dark internally and need to
   fade to/from theme bg on the outer edges.
   Colors are explicit (not var(--bg)) because these bridges live inside
   a force-dark scope that overrides --bg locally. */
.section-bridge-dark.section-bridge-top {
    height: 280px;
    background: linear-gradient(
        to bottom,
        rgb(255 255 255) 0%,
        rgb(255 255 255 / 0.85) 18%,
        rgb(180 180 190 / 0.35) 45%,
        rgb(20 20 26 / 0.55) 70%,
        rgb(3 3 3) 100%);
}
html.dark .section-bridge-dark.section-bridge-top {
    height: 240px;
    background: linear-gradient(
        to top,
        transparent 0%,
        rgb(8 8 12 / 0.3) 50%,
        rgb(8 8 12 / 0.85) 100%);
}
.section-bridge-dark.section-bridge-bottom {
    height: 280px;
    background: linear-gradient(
        to top,
        rgb(255 255 255) 0%,
        rgb(255 255 255 / 0.85) 18%,
        rgb(180 180 190 / 0.35) 45%,
        rgb(20 20 26 / 0.55) 70%,
        rgb(3 3 3) 100%);
}
html.dark .section-bridge-dark.section-bridge-bottom {
    height: 240px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgb(8 8 12 / 0.3) 50%,
        rgb(8 8 12 / 0.85) 100%);
}
/* Top of a section that was preceded by a cosmic-dark section */
.section-bridge-from-dark {
    background: linear-gradient(
        to bottom,
        #030303 0%,
        rgb(3 3 3 / 0.5) 35%,
        transparent 100%);
}


/* =========================================================
   Projects — Cosmic backdrop (CelestialSphere shader)
   The section sets a force-dark scope so cards/glass keep
   their dark-mode look regardless of the global theme.
   ========================================================= */
.projects-section {
    position: relative;
    padding: 8rem 0 6rem;
    overflow: hidden;
    background: #030303;
    color: rgb(var(--fg));
    /* Force the dark token set INSIDE this section */
    --bg: 3 3 3;
    --fg: 240 240 245;
    /* Muted is brighter here than the global default so descriptions and
       subtitles stay readable against the cosmic backdrop + bridges. */
    --muted: 200 205 220;
    --accent: 165 180 252;
    --border: 35 38 45;
    --glass-bg: 30 30 38;
    --glass-border: 255 255 255;
    --glass-highlight: 255 255 255;
}

.celestial-mount {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    /* Soft fade-in at top/bottom so the cosmic doesn't appear as a hard edge */
    mask-image: linear-gradient(to bottom,
        transparent 0%,
        black 14%,
        black 86%,
        transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom,
        transparent 0%,
        black 14%,
        black 86%,
        transparent 100%);
}
.celestial-mount canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.projects-vignette {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center,
            rgb(3 3 3 / 0) 0%,
            rgb(3 3 3 / 0.10) 60%,
            rgb(3 3 3 / 0.35) 100%);
}

.projects-inner {
    position: relative;
    z-index: 4;
}

/* Bridges live BEHIND the inner content so the fade doesn't obscure the
   "Proyectos" title or the progress dots. */
.projects-section .section-bridge {
    z-index: 1;
}

/* Tighten the existing scroller mask to use the section's dark bg */
.projects-section .projects-scroller {
    mask-image: linear-gradient(90deg,
        transparent 0,
        black 4%,
        black 96%,
        transparent 100%);
    -webkit-mask-image: linear-gradient(90deg,
        transparent 0,
        black 4%,
        black 96%,
        transparent 100%);
}


/* =========================================================
   Process — "Cómo trabajo"
   Desktop: orbital ring (CSS-only spin + counter-spin on each step
   so the icons stay upright while the orbit rotates).
   Mobile : vertical numbered timeline (the ring is hidden via media).
   ========================================================= */
.process-section {
    position: relative;
    padding: 7rem 1.5rem 6rem;
    overflow: hidden;
}

.process-header {
    text-align: center;
    margin-bottom: 4rem;
}
.process-header .dia-text-reveal {
    display: inline-block;
}

/* ----- Spin keyframes (used by the ring + each step) ----- */
@keyframes process-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes process-spin-reverse {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}

/* ----- Orbital ring (desktop) ----- */
.process-ring-wrapper {
    position: relative;
    width: min(560px, 92vw);
    aspect-ratio: 1;
    margin: 0 auto;
}

/* Soft glow behind the ring */
.process-ring-glow {
    position: absolute;
    inset: -10%;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgb(129 140 248 / 0.18) 0%,
        rgb(129 140 248 / 0.06) 35%,
        transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.process-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px dashed rgb(var(--fg) / 0.14);
    background: radial-gradient(
        circle at center,
        rgb(var(--glass-bg) / 0.03) 0%,
        transparent 65%);
    animation: process-spin 60s linear infinite;
    z-index: 1;
}

/* Each step is positioned absolutely on the ring (top/left set inline from
   PHP via sin/cos). The centering translate lives here; the counter-rotation
   animation goes on the rotator wrapper so the two don't fight over the
   `transform` property. */
.process-step {
    position: absolute;
    width: 5rem;
    height: 5rem;
    transform: translate(-50%, -50%);
}
.process-step-rotator {
    width: 100%;
    height: 100%;
    animation: process-spin-reverse 60s linear infinite;
}
.process-step-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgb(var(--bg) / 0.85);
    border: 1.5px solid rgb(var(--step-color, 165 180 252) / 0.6);
    color: rgb(var(--step-color, 165 180 252));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    box-shadow:
        0 0 0 4px rgb(var(--bg)),
        0 12px 30px -8px rgb(var(--step-color, 0 0 0) / 0.35),
        inset 0 1px 0 0 rgb(255 255 255 / 0.08);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.process-step:hover .process-step-inner {
    transform: scale(1.08);
}
.process-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}
.process-step-icon > svg {
    width: 100%;
    height: 100%;
    display: block;
}
.process-step-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgb(var(--fg) / 0.85);
}

/* Center label (does NOT spin) */
.process-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 38%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgb(var(--bg));
    border: 2px solid rgb(var(--fg) / 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-align: center;
    box-shadow:
        inset 0 1px 0 0 rgb(255 255 255 / 0.06),
        0 24px 60px -28px rgb(0 0 0 / 0.5);
}
.process-center-eyebrow {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgb(var(--muted));
}
.process-center-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: rgb(var(--fg));
    line-height: 1;
}
.process-center-foot {
    font-size: 0.65rem;
    color: rgb(var(--muted));
    letter-spacing: 0.05em;
}

/* ----- Timeline (mobile-only) ----- */
.process-timeline {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}
.process-timeline-step {
    position: relative;
    display: flex;
    gap: 1.25rem;
    padding: 1rem 0 1.5rem;
}
.process-timeline-rail {
    position: absolute;
    top: 3rem;
    bottom: 0;
    left: 1.5rem;
    width: 1px;
    background: linear-gradient(
        to bottom,
        rgb(var(--step-color, 129 140 248) / 0.6),
        rgb(var(--fg) / 0.05));
}
.process-timeline-step:last-child .process-timeline-rail {
    display: none;
}
.process-timeline-marker {
    position: relative;
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgb(var(--bg));
    border: 1.5px solid rgb(var(--step-color, 165 180 252) / 0.55);
    color: rgb(var(--step-color, 165 180 252));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px -8px rgb(var(--step-color, 0 0 0) / 0.45);
}
/* The icon is a <span> in markup — force a block-level flex box so the
   width/height rules below actually apply (inline spans ignore width). */
.process-timeline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}
.process-timeline-icon > svg {
    width: 100%;
    height: 100%;
    display: block;
}
.process-timeline-num {
    position: absolute;
    bottom: -0.4rem;
    right: -0.4rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgb(var(--bg));
    border: 1px solid rgb(var(--fg) / 0.12);
    font-size: 0.62rem;
    font-weight: 700;
    color: rgb(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
}
.process-timeline-content {
    flex: 1;
    padding-top: 0.25rem;
}
.process-timeline-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: rgb(var(--fg));
}
.process-timeline-desc {
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgb(var(--muted));
    margin: 0;
}

/* Mobile layout swap */
@media (max-width: 720px) {
    .process-ring-wrapper { display: none; }
    .process-timeline     { display: block; }
    .process-section      { padding: 5rem 1.25rem; }
}

/* Respect reduced motion — kill the orbit, render as a static layout */
@media (prefers-reduced-motion: reduce) {
    .process-ring,
    .process-step {
        animation: none !important;
    }
}


/* =========================================================
   Testimonials — Scroll-pinned stack (scrollytelling)
   The section reserves one viewport of scroll per testimonial.
   Inside, a position:sticky wrapper pins the content; JS reads
   the scroll progress and updates the active card.
   ========================================================= */
.testimonials-section {
    position: relative;
    /* No padding here — padding belongs INSIDE the sticky wrapper
       so the pinned content can fill the viewport cleanly. */
}

.testimonials-scroll-container {
    position: relative;
    /* One viewport per testimonial + a small head/tail buffer. */
    height: calc(var(--testimonial-count, 3) * 100vh);
}

.testimonials-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    /* Scroll-in animation triggered when the sticky wrap first enters view */
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 1s ease,
        transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.testimonials-section.is-in-view .testimonials-sticky {
    opacity: 1;
    transform: translateY(0);
}

.testimonials-inner {
    position: relative;
    width: 100%;
    max-width: 44rem;
    margin: 0 auto;
}

.testimonials-header {
    text-align: center;
    margin-bottom: 3rem;
}
.testimonials-header .dia-text-reveal {
    display: inline-block;
}
.testimonials-subtitle {
    margin-top: 1.75rem;
    line-height: 1.55;
}

.testimonial-stack {
    position: relative;
    min-height: 24rem;
    perspective: 1200px;
}

.testimonial-card {
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    padding: 2rem 2.25rem;
    background: rgb(var(--glass-bg) / 0.55);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgb(var(--glass-border) / 0.10);
    box-shadow:
        inset 0 1px 0 0 rgb(var(--glass-highlight) / 0.10),
        0 28px 60px -28px rgb(0 0 0 / 0.45);
    user-select: none;
    transform-origin: top center;
    transition:
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.45s ease;
    will-change: transform, opacity;
}
:is(html.dark) .testimonial-card {
    background: rgb(var(--glass-bg) / 0.45);
    border-color: rgb(var(--glass-border) / 0.10);
}

.testimonial-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.testimonial-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(255 255 255);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 0 rgb(255 255 255 / 0.2),
        0 8px 24px -8px rgb(0 0 0 / 0.45);
}
.testimonial-id { line-height: 1.25; }
.testimonial-name {
    font-weight: 600;
    font-size: 1.02rem;
    color: rgb(var(--fg));
}
.testimonial-role {
    font-size: 0.82rem;
    color: rgb(var(--muted));
    margin-top: 0.15rem;
}

.testimonial-quote {
    margin: 1.5rem 0 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgb(var(--fg) / 0.92);
    font-style: normal;
}

.testimonial-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgb(var(--fg) / 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
@media (min-width: 600px) {
    .testimonial-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }
}

.testimonial-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.testimonial-tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.55rem;
    border-radius: 0.4rem;
    background: rgb(var(--fg) / 0.06);
    color: rgb(var(--fg) / 0.85);
    border: 1px solid rgb(var(--fg) / 0.06);
}
.testimonial-tag--featured {
    background: rgb(129 140 248 / 0.18);
    color: rgb(165 180 252);
    border-color: rgb(129 140 248 / 0.35);
}

.testimonial-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    font-size: 0.74rem;
    color: rgb(var(--muted));
}
.testimonial-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.testimonial-stat svg {
    width: 0.85rem;
    height: 0.85rem;
    flex-shrink: 0;
}

/* Pagination dots */
.testimonial-dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 3rem;
}
.testimonial-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    padding: 0;
    background: rgb(var(--fg) / 0.18);
    transition: width 0.3s ease, background-color 0.3s ease;
}
.testimonial-dot.is-active {
    width: 1.5rem;
    background: rgb(var(--fg) / 0.85);
}

/* =========================================================
   Low-power devices — applies to ANY device flagged by the
   head-script detector (small screens, ≤6 CPU cores, ≤4 GB RAM,
   or Save-Data mode). The WebGL CelestialSphere is skipped in JS
   and `.celestial-mount--static` is added to the mount, but the
   visual fallback below means the projects section still looks
   cosmic — without 150KB of Three.js or any GPU frame work.
   ========================================================= */
html.low-power .celestial-mount--static { display: none; }
html.low-power .projects-section {
    background:
        radial-gradient(ellipse 65% 50% at 18% 28%, rgb(99 102 241 / 0.22) 0%, transparent 60%),
        radial-gradient(ellipse 70% 55% at 82% 70%, rgb(168 85 247 / 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 55% 45% at 50% 50%, rgb(34 211 238 / 0.10) 0%, transparent 70%),
        #050510;
}
/* Static CSS-only starfield — paint-only, zero GPU shading */
html.low-power .projects-section::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1.2px 1.2px at 12% 18%, rgb(255 255 255 / 0.9), transparent 60%),
        radial-gradient(1px 1px   at 78% 22%, rgb(255 255 255 / 0.75), transparent 60%),
        radial-gradient(1.5px 1.5px at 42% 48%, rgb(255 255 255 / 0.95), transparent 60%),
        radial-gradient(1px 1px   at 65% 65%, rgb(199 210 254 / 0.7), transparent 60%),
        radial-gradient(1px 1px   at 22% 80%, rgb(255 255 255 / 0.8), transparent 60%),
        radial-gradient(1px 1px   at 88% 86%, rgb(255 255 255 / 0.7), transparent 60%),
        radial-gradient(1px 1px   at 33% 34%, rgb(196 181 253 / 0.6), transparent 60%),
        radial-gradient(1.2px 1.2px at 72% 10%, rgb(255 255 255 / 0.85), transparent 60%),
        radial-gradient(1px 1px   at 8%  55%, rgb(255 255 255 / 0.6), transparent 60%),
        radial-gradient(1px 1px   at 93% 48%, rgb(196 181 253 / 0.55), transparent 60%),
        radial-gradient(1px 1px   at 50% 92%, rgb(255 255 255 / 0.65), transparent 60%),
        radial-gradient(1.5px 1.5px at 58% 18%, rgb(165 180 252 / 0.85), transparent 60%);
}

/* Also drop the expensive backdrop-filters across the board on low-power
   desktops (the mobile @media already does this for ≤640px). */
html.low-power .glass-button,
html.low-power .glass-pill,
html.low-power .header-nav,
html.low-power .testimonial-card,
html.low-power .about-card {
    backdrop-filter: blur(14px) saturate(170%);
    -webkit-backdrop-filter: blur(14px) saturate(170%);
}


/* =========================================================
   Mobile responsive  — ≤640px
   Goals: keep the visual identity (defined glass + readable type),
   reduce GPU-heavy effects modestly without making things "soft",
   tighten section rhythm so content doesn't feel sparse.
   ========================================================= */
@media (max-width: 640px) {
    /* ---------- Perf: kill what truly costs frames ---------- */
    /* The SVG threshold filter on the hero morph is genuinely expensive.
       Keep this off. JS already uses simple cross-fade on small viewports. */
    .morphing-text { filter: none !important; }

    /* Backdrop-filter halved (was 16–22px) — defined glass at ~half cost.
       NOT 8px (that was the previous "blando" mistake). */
    .glass-button,
    .glass-pill,
    .header-nav {
        backdrop-filter: blur(14px) saturate(170%) !important;
        -webkit-backdrop-filter: blur(14px) saturate(170%) !important;
    }
    .testimonial-card,
    .about-card {
        backdrop-filter: blur(14px) !important;
        -webkit-backdrop-filter: blur(14px) !important;
    }
    /* project-card is opaque already (no transparent bg in dark) — no blur needed */

    /* ---------- Layout: no horizontal overflow ---------- */
    body { overflow-x: hidden; }

    /* ---------- Display typography ---------- */
    .dia-text-reveal { font-size: clamp(1.85rem, 8.5vw, 2.6rem); }

    /* ---------- HERO ---------- */
    .hero-geometric { min-height: 95vh; }
    .hero-content { padding: 0 1.25rem; }
    .hero-badge {
        margin-bottom: 1.75rem;
        font-size: 0.78rem;
        padding: 0.25rem 0.7rem;
    }
    .morphing-text-hero {
        height: clamp(4rem, 18vw, 7rem);
    }
    .morphing-text-hero .morph {
        font-size: clamp(2.75rem, 14vw, 5rem);
    }
    .hero-tagline {
        font-size: 0.95rem;
        margin-bottom: 1.75rem;
        padding: 0 0.5rem;
    }
    .hero-ctas {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 0 0.5rem;
    }
    .hero-ctas .glass-button { justify-content: center; }
    /* Shrink the floating shapes so they don't overflow on tiny screens */
    .hero-shapes .elegant-shape { transform: scale(0.55); transform-origin: center; }

    /* ---------- ABOUT ---------- */
    .about-section { padding: 5rem 1.25rem; }
    .about-headline { font-size: clamp(1.6rem, 7.5vw, 2.25rem); }
    .about-paragraphs { font-size: 0.95rem; max-width: 100%; }
    .about-grid { gap: 2.5rem; }
    .about-eyebrow { font-size: 0.7rem; }
    .about-stats { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .about-stat-value { font-size: 1.5rem; }
    .about-stat-label { font-size: 0.65rem; }
    .about-card--globe {
        max-width: min(100%, 22rem);
        margin-left: auto;
        margin-right: auto;
    }

    /* ---------- SKILLS ---------- */
    #skills { padding: 4.5rem 0; }
    #skills .max-w-4xl { padding-left: 1.25rem; padding-right: 1.25rem; }

    /* ---------- PROJECTS ---------- */
    .projects-section { padding: 5rem 0 4.5rem; }
    .projects-section .max-w-6xl { padding-left: 1.25rem; padding-right: 1.25rem; }
    .projects-section .glass-icon { width: 2.25rem; height: 2.25rem; }
    .project-card-inner   { padding: clamp(1.1rem, 5vw, 1.75rem); }
    .project-title        { font-size: clamp(1.15rem, 5.5vw, 1.5rem); }
    .project-description  { font-size: 0.85rem; line-height: 1.55; }
    .project-tech-chip    { font-size: 0.65rem; height: 1.4rem; padding: 0 0.5rem; }
    /* Big icon watermark less prominent on small cards */
    .project-icon-bg svg  { width: clamp(8rem, 32%, 13rem); }
    .project-icon-bg { opacity: 0.5; }

    /* ---------- PROCESS (already collapses to timeline at 720px) ---------- */
    .process-section { padding: 4.5rem 1.25rem 5rem; }
    .process-header { margin-bottom: 2.5rem; }
    .process-timeline-step { padding: 0.75rem 0 1.25rem; gap: 1rem; }
    .process-timeline-marker { width: 2.6rem; height: 2.6rem; }
    .process-timeline-rail { top: 2.6rem; left: 1.3rem; }
    .process-timeline-title { font-size: 1rem; }
    .process-timeline-desc { font-size: 0.85rem; }

    /* ---------- TESTIMONIALS ---------- */
    .testimonials-sticky { padding: 3rem 1rem 2.5rem; }
    .testimonials-header { margin-bottom: 2rem; }
    .testimonial-stack { min-height: 22rem; }
    .testimonial-card {
        padding: 1.5rem 1.25rem;
        border-radius: 1.25rem;
    }
    .testimonial-quote {
        font-size: 0.95rem;
        line-height: 1.55;
        margin-top: 1.25rem;
    }
    .testimonial-avatar {
        width: 2.4rem;
        height: 2.4rem;
        border-radius: 0.7rem;
        font-size: 0.85rem;
    }
    .testimonial-name { font-size: 0.95rem; }
    .testimonial-role { font-size: 0.78rem; }
    .testimonial-footer {
        margin-top: 1.25rem;
        padding-top: 0.85rem;
        gap: 0.65rem;
    }
    /* Scrollytelling: 75vh per card feels much snappier on mobile */
    .testimonials-scroll-container {
        height: calc(var(--testimonial-count, 3) * 75vh);
    }

    /* ---------- CONTACT ---------- */
    .contact-section { padding: 5rem 1.25rem 6rem; }
    .contact-headline { font-size: clamp(2rem, 9vw, 3rem); }
    .contact-tagline { font-size: 0.95rem; margin-bottom: 2rem; }
    .contact-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        margin-bottom: 2rem;
    }
    .contact-actions .glass-button { justify-content: center; width: 100%; }
    .contact-footnote { font-size: 0.68rem; letter-spacing: 0.18em; }

    /* ---------- HEADER ---------- */
    .site-header-bar { padding: 0.7rem 1rem; }
    .header-brand { font-size: 0.95rem; }
    .header-brand-mark { width: 1.4rem; height: 1.4rem; }
}

/* =========================================================
   Misc
   ========================================================= */
::selection { background: rgb(var(--accent) / 0.3); color: rgb(var(--fg)); }

/* Copy feedback */
.copy-success .copy-label { color: rgb(52 211 153); }

/* Respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
    .scroll-velocity-track,
    .status-dot,
    .header-progress-bar,
    .testimonials-sticky {
        transition-duration: 0.01ms !important;
    }
    .testimonials-sticky {
        opacity: 1;
        transform: none;
    }
    /* Don't lock the user inside a tall pinned section — collapse it. */
    .testimonials-scroll-container {
        height: auto;
    }
    .testimonials-sticky {
        position: relative;
        height: auto;
        padding: 4rem 1.5rem;
    }
    .dia-text-reveal .dia-letter {
        transition-duration: 0.01ms !important;
        opacity: 1;
        transform: none;
    }
    .projects-scroller { scroll-behavior: auto; }
}
