:root {
    /* --- Colors --- */
    /* --color-oklch-min: oklch(0 0 0);
    --color-oklch-max: oklch(1 0.4 360); */

    --color-bg: oklch(0.1496 0 0); /* #0b0b0b; */
    --color-fg: oklch(0.95 0 0); /* #f5f5f5; */
    --color-lightly-muted: oklch(0.8 0 0); /* #9a9a9a; */
    --color-muted: oklch(0.6862 0 0); /* #9a9a9a; */
    --color-accent: oklch(0.5597 0.242 268.92); /* #3f5cff; */
    --color-gradient: oklch(0.5944 0.2626 300.03); /* #9b3fff; */
    --color-border: oklch(1 0 0 / 8%); /* rgba(255, 255, 255, 0.08); */
    --gradient-primary: linear-gradient(135deg, var(--color-accent) 0%, var(--color-gradient) 100%);

    /* --------- Typography system --------- */
    --font-sans: system-ui, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    --font-mono: monospace;

    /* Font size */
    --text-xs: 0.85rem;
    --text-s: 0.95rem;
    --text-m-base: 1rem;
    --text-l: 1.125rem;
    --text-xl: 1.25rem;
    
    /* Fluid font size */
    --text-fluid-h3: clamp(1.1rem, 2.4vw, 1.35rem);
    --text-fluid-h2: clamp(1.4rem, 3.2vw, 2rem);
    --text-fluid-hero: clamp(1.6rem, 5.5vw, 3.5rem);
    --text-fluid-display: clamp(3.5rem, 10vw, 6rem);
    --text-fluid-phrase: clamp(1.1rem, 4vw, 2rem);

    /* --- Spacing --- */
    /* --space-1: 0.25rem; */
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    /* --space-5: 1.25rem; */
    /* --space-6: 1.5rem; */
    --space-8: 2rem;
    --space-12: 3rem;

    /* --- Radii --- */
    --radius-s: 6px;
    --radius-m: 8px;
    --radius-l: 18px;
    --radius-full: 999px;

    /* --- Layout --- */
    --layout-header-h: 56px;
    --layout-section: var(--space-8);

    --layout-padding: 1rem; /* The space between content and viewport edges for mobile */
    --layout-content-width: 900px;
    --layout-site-width: 1200px;

    /* --- Layers --- */
    --layer-below: -1;
    --layer-base: 1;
    --layer-sticky: 100;
    --layer-overlay: 200;

    /* --- Animation --- */
    --ease-snappy: 0.2s ease;
    --ease-base: 0.3s ease;
}

html,
body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0; /* By default some browser use 8px */
    background: var(--color-bg);
    color: var(--color-fg);
    font-family: var(--font-sans);
    font-size: var(--text-m-base);
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* ---------------------------- Top bar ---------------------------- */
.topbar {
    /* Mobile-first: keep header in document flow to preserve vertical space */
    position: relative;
    width: 100%;
    background: rgba(11, 11, 11, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    z-index: var(--layer-sticky);
}

.topbar-content {
    max-width: var(--layout-site-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: 0.65rem var(--layout-padding);
}

/* Mobile-first nav: horizontal scroll */
nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE 10+ */
}

nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    color: var(--color-fg);
    text-decoration: none;
    align-self: flex-start;
}

.logo img {
    border-radius: var(--radius-m);
}

.robot-logo {
    font-family: var(--font-mono);
    font-weight: 900;
    font-size: var(--text-xl);
    color: #fff;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    box-sizing: border-box;
    letter-spacing: -1px;
}

.robot-logo .eyes {
    display: inline-block;
    margin: 0 1px;
    transform-origin: center;
    white-space: nowrap;
}

nav a {
    position: relative;
    display: inline-block;
    color: var(--color-fg);
    text-decoration: none;
    font-size: var(--text-s);
    transition: color var(--ease-base), transform var(--ease-base), text-shadow var(--ease-base);
    white-space: nowrap;
    flex-shrink: 0;
}

nav a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -4px;
    left: 0;
    background-color: var(--color-fg);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform var(--ease-base);
}

nav a:hover {
    color: #fff;
    /* transform: scale(1.05); */
}

nav a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}


/* ---------------------------- Hero ---------------------------- */
.split {
    display: grid;
    grid-template-columns: auto auto;
    gap: var(--space-3);
    justify-content: center;
    max-width: var(--layout-content-width);
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0 var(--layout-padding);
}

.hero {
    /* Mobile: let content flow from the top and avoid imposing a large min-height
       that centers the pane vertically (which creates large gaps on small viewports). */
    min-height: auto;
    align-items: center;
    justify-items: center;
    max-width: var(--layout-content-width);
    margin: 0 auto;
    padding: var(--space-8);
}

.pane {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Left: image pushed to the right edge of its half */
.left {
    justify-content: flex-end;
    padding-right: var(--space-2);
}

.hero-img {
    max-height: 40vh;
    max-width: min(38vw, 520px);
    width: auto;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-l);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .35);
}

/* Right: stacked text */
.right {
    align-items: flex-start;
    justify-content: center;
    padding-left: var(--space-2);
}

.stack-lines {
    display: flex;
    flex-direction: column;
    gap: .15em;
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.stack-lines span {
    font-weight: 800;
    font-size: var(--text-fluid-hero);
    text-align: left;
    white-space: nowrap;
}



/* ---------------------------- Call To Action ---------------------------- */
.cta-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: 1.25rem var(--layout-padding) 2.25rem;
}

.lead {
    color: var(--color-muted);
    max-width: min(42ch, 90vw);
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    justify-content: center;
    font-size: clamp(1rem, 2vw, 1.125rem);
    font-weight: 350;
    letter-spacing: 0.04em;
    padding-bottom: var(--space-4);
}

.btn {
    color: #fff;
    text-decoration: none;
    background: var(--gradient-primary);
    padding: 1.05rem 2rem;
    border-radius: var(--radius-full);
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(63, 92, 255, 0.5);
}


/* ---------------------------- Scroll Arrow ---------------------------- */
.scroll-arrow {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-2) 0 var(--space-4);
    color: var(--color-muted);
    opacity: 0.7;
    transition: opacity var(--ease-base);
}

.scroll-arrow a,
.scroll-arrow a:visited {
    color: var(--color-muted);
    text-decoration: none;
}


.scroll-arrow:hover {
    opacity: 1;
    color: var(--color-accent);
}

.scroll-arrow svg {
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ---------------------------- Skip ---------------------------- */
/* Skip link for keyboard users and accessibility */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    background: var(--color-fg);
    color: var(--color-bg);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-s);
    z-index: var(--layer-overlay);
}

.skip-link:focus,
.skip-link:focus-visible {
    left: 1rem;
    top: 1rem;
    outline: none;
}

/* Focus styles for keyboard users */
a:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}


/* ---------------------------- About & Prose ---------------------------- */
.about {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--layout-section) var(--layout-padding) 2.75rem;
}

.prose {
    max-width: 820px;
}

.prose h2 {
    margin: 0 0 var(--space-3);
    font-size: var(--text-fluid-h2);
}

.prose h3 {
    margin: 1.25rem 0 var(--space-2);
    font-size: var(--text-fluid-h3);
}

.prose p {
    margin: .85rem 0;
    color: var(--color-fg);
    line-height: 1.65;
}

.prose ul {
    margin: var(--space-2) 0 0 1.1rem;
    line-height: 1.6;
}

.prose li {
    margin: .2rem 0
}

/* Special prose for Contact Section */
#contact .prose {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#contact .prose p {
    font-size: var(--text-xl);
    color: var(--color-muted);
    margin-bottom: var(--space-4);
    font-style: italic;
}


/* ---------------------------- Dynamic Phrase ---------------------------- */

.phrase-container {
    position: relative;
    width: 90%;
    max-width: var(--layout-content-width);
    margin: 0.1rem !important;
    /* Removed min-height and fixed rows to keep text compact vertically */
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-2);
    padding: 1.2rem 1.1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.phrase-container::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--color-muted);
    border-left: 2px solid var(--color-muted);
    opacity: 0.5;
}

.phrase-container::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid var(--color-muted);
    border-right: 2px solid var(--color-muted);
    opacity: 0.5;
}

.phrase-part {
    font-size: var(--text-fluid-phrase);
    font-weight: 350;
    color: var(--color-muted);
    line-height: 1.2;
}

.phrase-part.top-left {
    grid-column: 1 / 2;
    grid-row: 1;
    align-self: start;
    justify-self: start;
    text-align: left;
    white-space: nowrap;
}

.phrase-part.center {
    grid-column: 1 / 3;
    grid-row: 2;
    align-self: center;
    justify-self: center;
    font-size: var(--text-fluid-display);
    font-weight: 600;
    z-index: 1;
    text-align: center;
    white-space: nowrap;
}

.phrase-part.bottom-right {
    grid-column: 2 / 3;
    grid-row: 3;
    align-self: end;
    justify-self: end;
    text-align: right;
}

#dynamic-word {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    padding: 0.15em 0.2em; 
    line-height: 1.0; 
    margin: -0.15em 0;
}

/* ---------------------------- Timeline ---------------------------- */
.timeline {
    position: relative;
    padding-left: var(--space-8);
    margin-top: var(--layout-section);
}

.timeline::before {
    content: '';
    position: absolute;
    left: -0.05rem;
    top: var(--layout-section);
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.55) 0%, 
        rgba(255, 255, 255, 0.2) 80%, 
        rgba(255, 255, 255, 0.1) 95%, 
        rgba(0, 0, 0, 0) 100%
    );
}

.timeline-item {
    position: relative;
    margin-bottom: var(--space-12);
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2.45rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-muted);
    z-index: var(--layer-base);
    transition: all var(--ease-snappy);
}

.timeline-marker::before,
.timeline-marker::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid var(--color-muted);
    opacity: 0;
    transition: all var(--ease-snappy);
    z-index: var(--layer-below);
}

.timeline-item:hover .timeline-marker {
    background: #fff;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.timeline-item:hover .timeline-marker::before {
    opacity: 0.6;
    transform: translate(-4px, -4px);
    border-color: #fff;
}

.timeline-item:hover .timeline-marker::after {
    opacity: 0.6;
    transform: translate(4px, 4px);
    border-color: #fff;
}

.timeline-content h3 {
    margin-top: 0;
    font-size: var(--text-xl);
    color: var(--color-fg);
}

.timeline-company {
    font-size: var(--text-l);
    font-weight: 300;
    color: var(--color-lightly-muted);
    /* font-family: var(--font-mono); */
    margin-top: -0.3rem;
    margin-bottom: -0.5rem; /* Compensates for .timeline-date's negative margin */
}

.timeline-date {
    font-size: var(--text-m-base);
    color: var(--color-lightly-muted);
    margin-top: var(--space-4);
    /* margin-bottom: var(--space-4); */
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    line-height: 1.65;
}

/* --- Variant 2: Cross Interference --- */
.timeline-item.variant-2 .timeline-marker {
    background: transparent;
    border: 2px solid var(--color-muted);
    transition: all var(--ease-snappy);
}
.timeline-item.variant-2:hover .timeline-marker {
    border-color: var(--color-fg);
    transform: rotate(45deg);
}
.timeline-item.variant-2 .timeline-marker::before {
    content: ''; position: absolute; top: -2px; left: -2px;
    width: 100%; height: 100%;
    border: 1px solid var(--color-muted);
    opacity: 0;
    transition: all var(--ease-snappy);
}
.timeline-item.variant-2:hover .timeline-marker::before {
    opacity: 0.6;
    border-color: var(--color-fg);
    transform: rotate(-90deg) scale(1.1) translate(4px, -4px);
}

/* --- Variant 3: Ghost Shift --- */
.timeline-item.variant-3 .timeline-marker {
    background: transparent;
    border: 2px solid var(--color-muted);
    transition: all var(--ease-snappy);
}
.timeline-item.variant-3:hover .timeline-marker {
    border-color: var(--color-fg);
    transform: skewX(-10deg);
}
.timeline-item.variant-3 .timeline-marker::before,
.timeline-item.variant-3 .timeline-marker::after {
    content: ''; position: absolute; top: -2px; left: -2px;
    width: 100%; height: 100%;
    border: 1px solid var(--color-muted);
    opacity: 0;
    transition: all var(--ease-snappy);
}
.timeline-item.variant-3:hover .timeline-marker::before {
    opacity: 0.5;
    transform: translate(4px, 4px);
    border-color: var(--color-fg);
}
.timeline-item.variant-3:hover .timeline-marker::after {
    opacity: 0.3;
    transform: translate(8px, 8px);
    border-color: var(--color-fg);
}

/* --- Variant 4: Skewed Interference --- */
.timeline-item.variant-4 .timeline-marker {
    background: transparent;
    border: 2px solid var(--color-muted);
}
.timeline-item.variant-4:hover .timeline-marker {
    border-color: var(--color-fg);
    transform: skew(-10deg) scale(1.1);
    background: rgba(255,255,255,0.1);
}
.timeline-item.variant-4 .timeline-marker::before {
    border: 1px solid var(--color-fg);
    opacity: 0;
}
.timeline-item.variant-4:hover .timeline-marker::before {
    opacity: 0.5;
    transform: translate(4px, -4px) skew(20deg);
}


/* ---------------------------- Footer ---------------------------- */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--layout-site-width);
    margin: 0 auto;
    width: 100%;
    padding: var(--layout-section) var(--layout-padding);
    box-sizing: border-box;
    color: var(--color-muted);
    font-size: var(--text-s);
    border-top: 1px solid var(--color-border);
}

.footer .legal {
    margin: 0;
    font-size: var(--text-xs);
    padding-left: var(--space-2);
}

.footer .links {
    display: flex;
    align-items: center;
    padding-right: var(--space-2);
}

.footer .links a {
    color: var(--color-fg);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer .links a:hover {
    opacity: 1;
}


/* ============================ Desktop version ============================ */
@media (min-width: 900px) {
    .topbar-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0;
    }

    nav {
        width: auto;
        overflow: visible;
        padding-bottom: 0;
        gap: var(--space-8);
    }

    .logo {
        align-self: center;
    }

    .split { grid-template-columns: auto auto; gap: 0.5rem; padding: 0; max-width: var(--layout-content-width); margin: 0 auto; }
    .hero { min-height: 60vh;}
    .left { justify-content: flex-end; padding-right: .5rem; }
    .right { padding-left: .5rem; }
    .hero-img { max-width: min(38vw, 520px); max-height: 40vh; width: auto; min-width: 245px; min-height: 245px;}
    .stack-lines span { white-space: nowrap; }
    
    .cta-block { flex-direction: row; align-items: center; justify-content: center; gap: 1.5rem; flex-wrap: nowrap; }
    .cta-block .lead { margin: 0; width: auto; max-width: 56ch; padding-bottom: 0;}
    .cta-block .btn { flex-shrink: 0; }
    
    .topbar { position: fixed; top: 0; height: var(--layout-header-h); }
    body { padding-top: var(--layout-header-h); }
    .footer { flex-direction: row; gap: 0; text-align: left; }
    .footer .links { justify-content: flex-start; }

    /* Offset anchor links to account for fixed header */
    section[id] {
        scroll-margin-top: calc(var(--layout-header-h) + 0rem);
    }
}
