/* ===== CSS Custom Properties (Design Tokens) ===== */
:root {
    /* Color Palette - Modern Dark Theme */
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #12121a;
    --color-bg-tertiary: #1a1a25;
    --color-bg-card: #15151f;
    --color-bg-card-hover: #1c1c28;

    --color-text-primary: #f0f0f5;
    --color-text-secondary: #a0a0b0;
    --color-text-muted: #6a6a7a;

    --color-accent-primary: #6366f1;
    --color-accent-secondary: #8b5cf6;
    --color-accent-tertiary: #ec4899;
    --color-accent-success: #10b981;
    --color-accent-warning: #f59e0b;

    /* Gradients */
    --gradient-primary: linear-gradient(
        135deg,
        var(--color-accent-primary),
        var(--color-accent-secondary)
    );
    --gradient-accent: linear-gradient(
        135deg,
        var(--color-accent-secondary),
        var(--color-accent-tertiary)
    );
    --gradient-radial: radial-gradient(
        ellipse at center,
        var(--color-bg-secondary) 0%,
        var(--color-bg-primary) 70%
    );

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Typography */
    --font-primary: "Space Grotesk", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;

    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
    --text-4xl: clamp(2.5rem, 2rem + 3vw, 4rem);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:
        0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg:
        0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl:
        0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --shadow-glow-accent: 0 0 60px rgba(139, 92, 246, 0.2);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --container-max: 1200px;
    --header-height: 4rem;
}

/* ===== Reset & Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Background Effects ===== */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.gradient-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--color-accent-primary);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--color-accent-secondary);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--color-accent-tertiary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    opacity: 0.2;
}

@keyframes float {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.05);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(-30px, -20px) scale(1.02);
    }
}

/* ===== Header & Navigation ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    text-decoration: none;
    transition: transform var(--transition-base);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.logo-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    list-style: none;
}

.nav-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base);
}

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

.nav-links a:hover::after {
    width: 100%;
}

.github-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base);
}

.github-link::after {
    display: none;
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ===== Demo Hero ===== */
.demo-hero {
    padding-top: var(--header-height);
}

.demo-hero-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-lg) var(--space-lg) var(--space-3xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* Full-bleed screen. 200 scanlines tall; the framebuffer width follows this
   box's aspect ratio so the pixels stay square instead of stretching. */
.demo-screen {
    position: relative;
    width: 100%;
    height: clamp(300px, 60vh, 620px);
    background: #000;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 -60px 90px -60px rgba(99, 102, 241, 0.35),
        0 30px 80px -50px rgba(0, 0, 0, 0.9);
}

.demo-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.demo-scanlines,
.demo-glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.demo-scanlines {
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.28) 0 1px,
        transparent 1px 3px
    );
}

.demo-glare {
    background:
        linear-gradient(
            108deg,
            rgba(255, 255, 255, 0.07) 0 22%,
            transparent 44%
        ),
        radial-gradient(130% 120% at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.55));
}

.demo-hero .hero-content {
    align-items: center;
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

.demo-hero .hero-cta {
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .demo-hero-inner {
        gap: var(--space-xl);
    }

    .demo-screen {
        height: clamp(220px, 42vh, 360px);
    }

    .demo-hero .hero-cta {
        flex-direction: column;
        width: 100%;
    }
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--space-4xl);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: calc(var(--header-height) + var(--space-4xl)) var(--space-lg)
        var(--space-4xl);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.hero-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    max-width: 500px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow:
        var(--shadow-md),
        0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        var(--shadow-lg),
        0 0 30px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ===== Hero Visual (Arcade Screen) ===== */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.arcade-screen {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 0 8px #1a1a25,
        0 0 0 10px #2a2a35,
        var(--shadow-xl),
        0 0 100px rgba(99, 102, 241, 0.2);
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 10;
}

.screen-content {
    position: absolute;
    inset: 20px;
    background: #0a0a1a;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ===== Project Carousel ===== */
.project-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    flex-direction: column;
}

.carousel-slide.active {
    opacity: 1;
}

.slide-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.slide-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--text-xs);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 2;
}

.slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Pacman Slide */
.pacman-slide {
    background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%);
}

.pacman-slide .ghost {
    position: absolute;
}

.pacman-slide .ghost-1 {
    left: 15%;
    top: 30%;
}

.pacman-slide .ghost-2 {
    left: 45%;
    top: 50%;
}

.pacman-slide .ghost-3 {
    right: 15%;
    top: 35%;
}

/* Racer Slide */
.racer-slide {
    background: linear-gradient(
        180deg,
        #87ceeb 0%,
        #228b22 30%,
        #333 60%,
        #333 100%
    );
}

.racer-slide .road {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 50%;
    background: #333;
    transform-origin: bottom center;
    transform: translateX(-50%) perspective(300px) rotateX(60deg);
}

.racer-slide .trees {
    position: absolute;
    top: 30%;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.racer-slide .trees span {
    width: 20px;
    height: 30px;
    background: linear-gradient(180deg, #228b22 70%, #8b4513 70%);
    clip-path: polygon(
        50% 0%,
        100% 70%,
        80% 70%,
        80% 100%,
        20% 100%,
        20% 70%,
        0% 70%
    );
    animation: treeSway 2s ease-in-out infinite;
}

.racer-slide .trees span:nth-child(2) {
    animation-delay: -0.5s;
}
.racer-slide .trees span:nth-child(3) {
    animation-delay: -1s;
}
.racer-slide .trees span:nth-child(4) {
    animation-delay: -1.5s;
}

@keyframes treeSway {
    0%,
    100% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

/* Coming Soon Slide */
.coming-soon-slide {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    flex-direction: column;
}

.coming-soon-slide .code-rain {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    overflow: hidden;
}

.coming-soon-slide .code-rain span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(99, 102, 241, 0.4);
    animation: codeRain 3s linear infinite;
}

.coming-soon-slide .code-rain span:nth-child(1) {
    animation-delay: 0s;
}
.coming-soon-slide .code-rain span:nth-child(2) {
    animation-delay: -0.3s;
}
.coming-soon-slide .code-rain span:nth-child(3) {
    animation-delay: -0.6s;
}
.coming-soon-slide .code-rain span:nth-child(4) {
    animation-delay: -0.9s;
}
.coming-soon-slide .code-rain span:nth-child(5) {
    animation-delay: -1.2s;
}
.coming-soon-slide .code-rain span:nth-child(6) {
    animation-delay: -1.5s;
}
.coming-soon-slide .code-rain span:nth-child(7) {
    animation-delay: -1.8s;
}
.coming-soon-slide .code-rain span:nth-child(8) {
    animation-delay: -2.1s;
}
.coming-soon-slide .code-rain span:nth-child(9) {
    animation-delay: -2.4s;
}
.coming-soon-slide .code-rain span:nth-child(10) {
    animation-delay: -2.7s;
}

@keyframes codeRain {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(200px);
        opacity: 0;
    }
}

.coming-soon-slide .question-mark {
    font-size: 3rem;
    z-index: 1;
}

/* Carousel Indicators */
.carousel-indicators {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-sm);
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    padding: 0;
}

.indicator:hover {
    background: rgba(255, 255, 255, 0.5);
}

.indicator.active {
    background: var(--color-accent-primary);
    box-shadow: 0 0 10px var(--color-accent-primary);
}

.pixel-art {
    position: relative;
    width: 200px;
    height: 100px;
}

.ghost {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 12px 12px 0 0;
    animation: ghostFloat 3s ease-in-out infinite;
}

.ghost::before {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 24px;
    height: 8px;
    background: inherit;
    clip-path: polygon(
        0 0,
        8px 0,
        8px 100%,
        0 100%,
        0 0,
        8px 0,
        12px 0,
        12px 100%,
        8px 100%,
        16px 0,
        16px 100%,
        24px 100%,
        24px 0
    );
}

.ghost-1 {
    background: #ff0000;
    left: 20px;
    top: 30px;
    animation-delay: 0s;
}

.ghost-2 {
    background: #00ffff;
    left: 80px;
    top: 50px;
    animation-delay: -1s;
}

.ghost-3 {
    background: #ffb8ff;
    left: 140px;
    top: 35px;
    animation-delay: -2s;
}

.pacman {
    position: absolute;
    right: 30px;
    top: 40px;
    width: 28px;
    height: 28px;
    background: #ffff00;
    border-radius: 50%;
    clip-path: polygon(100% 50%, 50% 50%, 30% 15%, 50% 50%, 30% 85%, 50% 50%);
    animation: chomp 0.3s steps(2) infinite;
}

@keyframes ghostFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes chomp {
    0% {
        clip-path: polygon(
            100% 50%,
            50% 50%,
            40% 25%,
            50% 50%,
            40% 75%,
            50% 50%
        );
    }
    100% {
        clip-path: polygon(
            100% 50%,
            50% 50%,
            50% 0%,
            50% 50%,
            50% 100%,
            50% 50%
        );
    }
}

/* ===== Section Styles ===== */
.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.section-label {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent-primary);
    margin-bottom: var(--space-sm);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ===== Projects Section ===== */
.projects-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-lg);
}

/* Project Categories */
.project-category {
    margin-bottom: var(--space-3xl);
}

.category-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: white;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-xl);
}

.projects-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.projects-grid.compact .project-card {
    background: var(--color-bg-card);
}

.projects-grid.compact .project-content {
    padding: var(--space-lg);
}

.projects-grid.compact .project-title {
    font-size: var(--text-base);
}

.projects-grid.compact .project-description {
    font-size: var(--text-xs);
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-glow);
}

.project-card.featured {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .project-card.featured {
        grid-column: span 1;
        grid-template-columns: 1fr;
    }
}

.project-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-card.featured .project-image {
    aspect-ratio: auto;
    min-height: 280px;
}

.project-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-preview-image {
    object-fit: contain;
    object-position: center;
    max-width: 75%;
    max-height: 75%;
}

/* Thumbnail for non-featured cards with images */
.project-card.has-image {
    flex-direction: row;
    align-items: stretch;
}

.project-thumb {
    width: 100px;
    min-width: 100px;
    overflow: hidden;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.projects-grid.compact .project-card.has-image .project-content {
    padding: var(--space-md);
}

/* Pacman Preview Animation */
.pacman-preview {
    background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%);
    position: relative;
    overflow: hidden;
}

.maze-lines {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            90deg,
            transparent 49%,
            rgba(33, 33, 255, 0.2) 49%,
            rgba(33, 33, 255, 0.2) 51%,
            transparent 51%
        ),
        linear-gradient(
            0deg,
            transparent 49%,
            rgba(33, 33, 255, 0.2) 49%,
            rgba(33, 33, 255, 0.2) 51%,
            transparent 51%
        );
    background-size: 40px 40px;
}

.pac-demo {
    width: 40px;
    height: 40px;
    background: #ffff00;
    border-radius: 50%;
    position: relative;
    animation:
        pacMove 4s linear infinite,
        chomp 0.3s steps(2) infinite;
    clip-path: polygon(100% 50%, 50% 50%, 40% 25%, 50% 50%, 40% 75%, 50% 50%);
}

@keyframes pacMove {
    0%,
    100% {
        transform: translateX(-80px) rotate(0deg);
    }
    25% {
        transform: translateX(80px) rotate(0deg);
    }
    26% {
        transform: translateX(80px) rotate(180deg);
    }
    50% {
        transform: translateX(-80px) rotate(180deg);
    }
    51% {
        transform: translateX(-80px) rotate(0deg);
    }
}

.dots {
    position: absolute;
    display: flex;
    gap: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dots span {
    width: 8px;
    height: 8px;
    background: #ffb8ae;
    border-radius: 50%;
    animation: dotFade 4s linear infinite;
}

.dots span:nth-child(1) {
    animation-delay: 0.3s;
}
.dots span:nth-child(2) {
    animation-delay: 0.5s;
}
.dots span:nth-child(3) {
    animation-delay: 0.7s;
}
.dots span:nth-child(4) {
    animation-delay: 0.9s;
}
.dots span:nth-child(5) {
    animation-delay: 1.1s;
}

@keyframes dotFade {
    0%,
    20%,
    100% {
        opacity: 1;
    }
    25%,
    45% {
        opacity: 0;
    }
    50%,
    70% {
        opacity: 1;
    }
    75%,
    95% {
        opacity: 0;
    }
}

/* Racer Preview Animation */
.racer-preview {
    background: linear-gradient(180deg, #1a3a1a 0%, #0a2a0a 50%, #2a2a2a 100%);
    position: relative;
    overflow: hidden;
    perspective: 300px;
}

.road {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 70%;
    background: #333;
    transform-origin: bottom center;
    transform: translateX(-50%) rotateX(60deg);
}

.road-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 40px;
    background: white;
    animation: roadScroll 0.5s linear infinite;
}

.road-line:nth-child(1) {
    bottom: 20%;
    animation-delay: 0s;
}
.road-line:nth-child(2) {
    bottom: 50%;
    animation-delay: -0.17s;
}
.road-line:nth-child(3) {
    bottom: 80%;
    animation-delay: -0.33s;
}

@keyframes roadScroll {
    0% {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(200%);
        opacity: 0;
    }
}

.car {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    background: linear-gradient(180deg, #ff3333 0%, #cc0000 100%);
    border-radius: 5px 5px 3px 3px;
    animation: carSway 2s ease-in-out infinite;
}

.car::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 3px;
    right: 3px;
    height: 15px;
    background: rgba(100, 200, 255, 0.5);
    border-radius: 3px;
}

@keyframes carSway {
    0%,
    100% {
        transform: translateX(-50%) rotate(-2deg);
    }
    50% {
        transform: translateX(-50%) rotate(2deg);
    }
}

/* Mystery Preview */
.mystery-preview {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    flex-direction: column;
    gap: var(--space-md);
}

.question-mark {
    font-size: 4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.1);
    animation: questionPulse 3s ease-in-out infinite;
}

@keyframes questionPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.2;
    }
}

.sparkles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.sparkles span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkles span:nth-child(1) {
    top: 20%;
    left: 30%;
    animation-delay: 0s;
}

.sparkles span:nth-child(2) {
    top: 60%;
    left: 70%;
    animation-delay: -0.7s;
}

.sparkles span:nth-child(3) {
    top: 40%;
    left: 50%;
    animation-delay: -1.4s;
}

@keyframes sparkle {
    0%,
    100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Project Overlay */
.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.play-btn {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transform: scale(0.8);
    transition: transform var(--transition-spring);
    box-shadow: var(--shadow-lg);
}

.project-card:hover .play-btn {
    transform: scale(1);
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn svg {
    margin-left: 3px;
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.wip {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Project Content */
.project-content {
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    padding: var(--space-xs) var(--space-sm);
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-primary);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.project-title {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.project-description {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.project-links {
    margin-top: auto;
    padding-top: var(--space-md);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.project-link.primary {
    color: var(--color-accent-primary);
}

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

.project-link svg {
    transition: transform var(--transition-fast);
}

.project-link:hover svg {
    transform: translate(2px, -2px);
}

/* ===== About Section ===== */
.about-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-lg);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-2xl);
}

.tech-stack {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 140px;
    transition: all var(--transition-base);
}

.tech-item:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-glow);
}

.tech-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: white;
}

.tech-item span {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: var(--space-4xl);
}

.footer-content {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand p {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.footer-links {
    display: flex;
    gap: var(--space-md);
}

.footer-links a {
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

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

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: var(--space-lg);
    text-align: center;
}

.footer-bottom p {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ===== Feature Page Styles ===== */

/* Per-emulator accent overrides */
.feature-a2e {
    --feature-accent: #5dbb4f;
    --feature-accent-rgb: 93, 187, 79;
    --feature-accent-secondary: #f26522;
    --feature-gradient: linear-gradient(135deg, #5dbb4f, #f5e51b, #f26522, #e23838, #b43896, #0070c9);
}

.feature-spec {
    --feature-accent: #d62816;
    --feature-accent-rgb: 214, 40, 22;
    --feature-accent-secondary: #0022c7;
    /* Hard stops rather than a blend. Repeating each position gives a clean
       edge between bands, so these stay the Spectrum's own colours instead of
       fading through the muddy in-between tones a smooth gradient invents. */
    --feature-gradient: linear-gradient(
        135deg,
        #d62816 0 16.667%,
        #ccc82a 16.667% 33.333%,
        #00c525 33.333% 50%,
        #00c7c9 50% 66.667%,
        #0022c7 66.667% 83.333%,
        #cb3fd5 83.333% 100%
    );
}

/* Per-letter Spectrum colours, for spelling a word out in the machine's own
   palette rather than sweeping a gradient across it. Same values as the
   stripe and the flash, so the page stays on one set of colours. */
.zx-red {
    color: #d62816;
}
.zx-yellow {
    color: #ccc82a;
}
.zx-green {
    color: #00c525;
}
.zx-cyan {
    color: #00c7c9;
}

.feature-page .feature-gradient {
    background: var(--feature-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feature-page .btn-primary {
    background: var(--feature-gradient);
    box-shadow: var(--shadow-md), 0 0 20px rgba(var(--feature-accent-rgb), 0.3);
}

.feature-page .btn-primary:hover {
    box-shadow: var(--shadow-lg), 0 0 30px rgba(var(--feature-accent-rgb), 0.4);
}

.feature-page .feature-icon,
.feature-page .tool-icon {
    background: var(--feature-gradient);
}

.feature-page .section-label {
    color: var(--feature-accent);
}

.feature-page .tag {
    background: rgba(var(--feature-accent-rgb), 0.1);
    color: var(--feature-accent);
}

.feature-page .spec-tag {
    background: rgba(var(--feature-accent-rgb), 0.15);
    color: var(--feature-accent);
}

.feature-page .model-badge {
    background: var(--feature-gradient);
}

/* Feature Hero */
.feature-hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--space-4xl);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: calc(var(--header-height) + var(--space-4xl)) var(--space-lg) var(--space-4xl);
}

.feature-hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.feature-hero-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.feature-hero-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    max-width: 520px;
    line-height: 1.7;
}

.feature-hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Emulator Screen */
.emulator-screen {
    width: 100%;
    max-width: 440px;
}

.screen-bezel {
    background: #1a1a25;
    border-radius: var(--radius-xl);
    padding: 12px;
    box-shadow:
        0 0 0 2px #2a2a35,
        var(--shadow-xl),
        0 0 80px rgba(var(--feature-accent-rgb), 0.15);
    position: relative;
    overflow: hidden;
}

.screen-glass {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}

.screen-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.crt-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 2;
}

.screen-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-md);
    padding: 0 var(--space-xs);
}

.label-model {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
}

.label-detail {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--color-text-muted);
}

/* Spectrum Rainbow Stripe */
.spectrum-stripe {
    display: flex;
    height: 4px;
    margin-bottom: 4px;
    border-radius: 2px 2px 0 0;
    overflow: hidden;
}

.spectrum-stripe span {
    flex: 1;
}

.spectrum-stripe span:nth-child(1) { background: #d62816; }
.spectrum-stripe span:nth-child(2) { background: #d62816; }
.spectrum-stripe span:nth-child(3) { background: #ccc82a; }
.spectrum-stripe span:nth-child(4) { background: #00c525; }
.spectrum-stripe span:nth-child(5) { background: #00c7c9; }
.spectrum-stripe span:nth-child(6) { background: #00c7c9; }
.spectrum-stripe span:nth-child(7) { background: #0022c7; }
.spectrum-stripe span:nth-child(8) { background: #0022c7; }

/* Feature Sections */
.feature-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-lg);
}

.feature-section-alt {
    background: var(--color-bg-secondary);
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.feature-section-alt > .section-header,
.feature-section-alt > .section-intro,
.feature-section-alt > .features-grid,
.feature-section-alt > .specs-grid,
.feature-section-alt > .tools-grid,
.feature-section-alt > .arch-grid {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

.section-intro {
    text-align: center;
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    max-width: 650px;
    margin: calc(-1 * var(--space-xl)) auto var(--space-2xl);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.feature-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-base);
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--feature-accent-rgb), 0.3);
    box-shadow: 0 0 40px rgba(var(--feature-accent-rgb), 0.1);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: white;
    margin-bottom: var(--space-md);
}

.feature-card h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    letter-spacing: -0.01em;
}

.feature-card p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Specs Grid (Expansion Cards / Peripherals) */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.spec-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-base);
}

.spec-card:hover {
    border-color: rgba(var(--feature-accent-rgb), 0.2);
}

.spec-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.spec-tag {
    padding: var(--space-xs) var(--space-sm);
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-accent-primary);
    font-size: var(--text-xs);
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.spec-header h3 {
    font-size: var(--text-base);
    font-weight: 600;
}

.spec-card p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Models Grid (Spectrum) */
.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    max-width: var(--container-max);
    margin: 0 auto;
}

.model-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    transition: all var(--transition-base);
}

.model-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--feature-accent-rgb), 0.3);
    box-shadow: 0 0 40px rgba(var(--feature-accent-rgb), 0.1);
}

.model-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--gradient-primary);
    color: white;
    font-size: var(--text-sm);
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
}

.model-card h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.model-card p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Tools Grid (Developer Tools) */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.tool-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-base);
}

.tool-item:hover {
    border-color: rgba(var(--feature-accent-rgb), 0.2);
}

.tool-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: white;
}

.tool-item h4 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.tool-item p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Architecture Grid */
.arch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.arch-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-base);
}

.arch-card:hover {
    border-color: rgba(var(--feature-accent-rgb), 0.2);
}

.arch-card h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.arch-card p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Highlight Block (AI Integration) */
.highlight-block {
    max-width: 700px;
    margin: 0 auto;
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(var(--feature-accent-rgb), 0.2);
    padding: var(--space-2xl);
    box-shadow: 0 0 60px rgba(var(--feature-accent-rgb), 0.08);
}

.highlight-content h3 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.highlight-content p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

.highlight-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* Printer section: space the model grid from the capability grid and credit */
.specs-grid + .tools-grid {
    margin-top: var(--space-2xl);
}

.printer-credit {
    margin-top: var(--space-2xl);
}

.printer-credit .section-label {
    display: block;
    margin-bottom: var(--space-sm);
}

.feature-page .section-intro code,
.feature-page .tool-item code,
.feature-page .spec-card code {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9em;
    padding: 0.1em 0.4em;
    border-radius: var(--radius-sm);
    background: rgba(var(--feature-accent-rgb), 0.12);
    color: var(--color-text-primary);
}

/* Feature CTA */
.feature-cta {
    text-align: center;
    padding: var(--space-4xl) var(--space-lg);
    max-width: var(--container-max);
    margin: 0 auto;
}

.feature-cta h2 {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-md);
}

.feature-cta p {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xl);
}

.feature-cta .hero-cta {
    justify-content: center;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .feature-hero {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
        text-align: center;
    }

    .feature-hero-content {
        align-items: center;
    }

    .feature-hero-subtitle {
        max-width: 600px;
    }

    .feature-hero-visual {
        order: -1;
    }

    .emulator-screen {
        max-width: 360px;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
        text-align: center;
    }

    .hero-content {
        align-items: center;
    }

    .hero-description {
        max-width: 600px;
    }

    .hero-visual {
        order: -1;
    }

    .arcade-screen {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .features-grid,
    .specs-grid,
    .tools-grid,
    .arch-grid {
        grid-template-columns: 1fr;
    }

    .models-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .feature-hero {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--space-2xl));
    }

    .feature-hero .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .nav-links {
        gap: var(--space-md);
    }

    .nav-links span {
        display: none;
    }

    .github-link span {
        display: none;
    }

    .hero {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--space-2xl));
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        justify-content: center;
    }

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

    .footer-content {
        flex-direction: column;
        gap: var(--space-lg);
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
        --space-3xl: 2.5rem;
        --space-4xl: 3rem;
    }

    .emulator-screen {
        max-width: 280px;
    }

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

    .arcade-screen {
        max-width: 280px;
    }

    .tech-stack {
        flex-direction: column;
        align-items: center;
    }

    .tech-item {
        width: 100%;
        max-width: 200px;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

:focus-visible {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
    background: var(--color-accent-primary);
    color: white;
}

/* =====================================================================
   Front page
   ---------------------------------------------------------------------
   The index has no orbs and no noise: the demo's starfield is the only
   atmosphere, and the two machine panels below it are the only colour.
   Everything under them is deliberately plain so they stay the point.
   ===================================================================== */

.home .demo-screen {
    height: clamp(260px, 48vh, 520px);
}

.home .demo-hero {
    background: #000;
}

/* ----- The two machines ------------------------------------------- */

.machines {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.machine {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 560px;
}

.machine-copy {
    padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3.5rem) 0;
    max-width: 34rem;
}

.machine-name {
    font-size: clamp(2.75rem, 5.5vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 1.1rem;
}

.machine-line {
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    line-height: 1.5;
    max-width: 30rem;
    margin-bottom: 1.75rem;
}

.machine-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.machine-launch {
    display: inline-block;
    padding: 0.8rem 1.4rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    transition:
        transform var(--transition-fast),
        background var(--transition-fast);
}

.machine-launch:hover {
    transform: translateY(-1px);
}

.machine-launch:focus-visible,
.machine-more:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.machine-more {
    text-decoration: underline;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
}

.machine-more:hover {
    text-decoration-thickness: 2px;
}

/* The screenshot sits low and to the right, bleeding off the panel like a
   photo pinned to a board, cropped to the emulated screen rather than the
   whole UI. */
.machine-shot {
    display: block;
    align-self: end;
    justify-self: end;
    width: min(88%, 620px);
    margin-top: 2.5rem;
    margin-right: -6%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.machine-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
}

/* Spectrum: black case, the 48K's stripe running off the bottom corner. */
.machine-spec {
    background: #000;
    color: #fff;
}

.machine-spec .machine-line {
    color: #c9c9d1;
}

.machine-spec .machine-launch {
    background: #fff;
    color: #000;
}

.machine-spec .machine-launch:hover {
    background: #ccc82a;
}

.machine-spec .machine-more {
    color: #00c7c9;
}

.machine-spec .machine-shot {
    /* Bleeds off the left edge, so the two panels bookend each other and
       the stripe keeps the bottom-right corner to itself. */
    justify-self: start;
    margin-right: 0;
    margin-left: -6%;
    border: 3px solid #1c1c1c;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}

.machine-spec .machine-shot img {
    /* The emulated screen is in the top-left of the capture. */
    width: 220%;
    height: auto;
    transform: translate(-3%, -7%);
}

.spec-stripe {
    position: absolute;
    right: -2rem;
    bottom: -1rem;
    width: 22rem;
    height: 8rem;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(
        112deg,
        transparent 0 40%,
        #d62816 40% 52%,
        #ccc82a 52% 64%,
        #00c525 64% 76%,
        #00c7c9 76% 88%,
        transparent 88%
    );
}

/* Apple: manual paper, Garamond, and the rainbow rule across the top. */
.machine-a2e {
    background: #f6f1e3;
    color: #312619;
    font-family: "Newsreader", "Iowan Old Style", Georgia, serif;
}

.machine-a2e .machine-name {
    font-weight: 500;
    letter-spacing: -0.01em;
}

.machine-a2e .machine-line {
    font-size: clamp(1.1rem, 1.35vw, 1.35rem);
    color: #4a3d2c;
}

.machine-a2e .machine-launch {
    background: #241b10;
    color: #f6f1e3;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.machine-a2e .machine-launch:hover {
    background: #4a3d2c;
}

.machine-a2e .machine-more {
    color: #241b10;
    font-style: italic;
    font-size: 1.1rem;
}

.machine-a2e .machine-shot {
    border: 1px solid #d9cdae;
    background: #e9e1cd;
    box-shadow: 0 30px 50px -30px rgba(49, 38, 25, 0.5);
}

.machine-a2e .machine-shot img {
    /* Crop to the emulated screen, top-left of the capture. */
    width: 205%;
    height: auto;
    transform: translate(-1%, -5%);
}

.a2e-stripe {
    display: block;
    height: 6px;
    background: linear-gradient(
        90deg,
        #5dbb4f 0 16.667%,
        #f5e51b 16.667% 33.333%,
        #f26522 33.333% 50%,
        #e23838 50% 66.667%,
        #b43896 66.667% 83.333%,
        #0070c9 83.333% 100%
    );
    grid-column: 1 / -1;
}

.machine-a2e {
    grid-template-rows: auto auto 1fr;
}

/* ----- Things to play --------------------------------------------- */

.play-section,
.source-section,
.home .about-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-lg) 0;
}

.section-heading {
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xl);
}

.section-note {
    color: var(--color-text-secondary);
    max-width: 40rem;
    margin-top: calc(-1 * var(--space-lg));
    margin-bottom: var(--space-xl);
}

.play-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xl);
}

.play-card {
    display: grid;
    grid-template-rows: auto 1fr;
    background: var(--color-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.play-shot {
    display: block;
    background: #000;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.play-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.play-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.play-title {
    font-size: var(--text-lg);
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.play-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

.play-desc {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    flex: 1;
}

.play-links {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    margin-top: var(--space-sm);
}

.play-links a {
    color: var(--color-text-primary);
    text-decoration: underline;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
    font-size: var(--text-sm);
}

.play-links a.play-primary {
    text-decoration: none;
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
    padding: 0.45rem 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.play-links a.play-primary:hover {
    background: #fff;
}

.play-links a:not(.play-primary):hover {
    text-decoration-thickness: 2px;
}

/* ----- Source ----------------------------------------------------- */

.source-list {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.source-row {
    display: grid;
    grid-template-columns: 11rem 1fr auto;
    gap: var(--space-lg);
    align-items: baseline;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    color: inherit;
}

.source-row:hover .source-title {
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

.source-title {
    font-weight: 600;
}

.source-desc {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.source-lang {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ----- About ------------------------------------------------------ */

.home .about-section {
    padding-bottom: var(--space-4xl);
}

.home .about-section p {
    max-width: 36rem;
    color: var(--color-text-secondary);
    font-size: var(--text-base);
}

/* ----- Small screens ---------------------------------------------- */

@media (max-width: 900px) {
    .machines {
        grid-template-columns: 1fr;
    }

    .machine {
        min-height: 0;
    }

    .machine-shot {
        width: 92%;
        margin-right: -8%;
    }

    .machine-spec .machine-shot {
        width: 78%;
        margin-left: -8%;
    }

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

    .source-row {
        grid-template-columns: 1fr auto;
    }

    .source-desc {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .nav-secondary {
        display: none;
    }

    .nav-links {
        gap: var(--space-md);
    }
}
