/* ========================================
   CSS Variables - Design System
   ======================================== */
:root {
    /* Colors */
    --color-bg: #0a0a0f;
    --color-surface: #12121a;
    --color-border: #1e1e2e;
    --color-primary: #00d4ff;
    --color-secondary: #ff6b35;
    --color-text: #e0e0e0;
    --color-muted: #6b7280;
    
    /* Steampunk colors - slightly darker brass */
    --color-brass-light: #c49a4a;
    --color-brass: #a68032;
    --color-brass-mid: #8a6828;
    --color-brass-dark: #6e5220;
    --color-copper: #9a6030;
    --color-bronze: #b07028;
    --color-iron: #3a3a48;
    --color-steam: rgba(240, 238, 230, 0.7);
    
    /* Glow effects */
    --glow-primary: 0 0 20px rgba(0, 212, 255, 0.3);
    --glow-secondary: 0 0 20px rgba(255, 107, 53, 0.3);
    --glow-primary-strong: 0 0 40px rgba(0, 212, 255, 0.5);
    
    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --font-body: 'Inter', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;
    --space-2xl: 8rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

a {
    color: inherit;
    text-decoration: none;
}

/* ========================================
   Animated Background
   ======================================== */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(30, 30, 46, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 30, 46, 0.3) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -2;
    animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.6; }
}

.bg-glow {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(255, 107, 53, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: glowShift 12s ease-in-out infinite alternate;
}

@keyframes glowShift {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-20px) scale(1.05); }
}

/* ========================================
   Steampunk Elements
   ======================================== */
.steampunk-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

/* Gears - darker brass colors */
.gear {
    position: absolute;
    color: var(--color-brass);
    opacity: 0.3;
    filter: drop-shadow(0 0 3px rgba(166, 128, 50, 0.35));
}

/* Extra large gear - main anchor top left */
.gear-xl.gear-1 {
    width: 280px;
    height: 280px;
    top: -80px;
    left: -80px;
    color: var(--color-brass-mid);
    opacity: 0.32;
    animation: gearRotate 40s linear infinite;
}

/* Secondary gear interlocking with gear-1 */
.gear-md.gear-1b {
    width: 120px;
    height: 120px;
    top: 120px;
    left: 100px;
    color: var(--color-brass);
    opacity: 0.28;
    animation: gearRotateReverse 22s linear infinite;
}

/* Large gear - top right */
.gear-lg.gear-2 {
    width: 200px;
    height: 200px;
    top: -40px;
    right: -50px;
    color: var(--color-brass);
    opacity: 0.3;
    animation: gearRotateReverse 32s linear infinite;
}

/* Small gear interlocking top right */
.gear-sm.gear-2b {
    width: 90px;
    height: 90px;
    top: 100px;
    right: 80px;
    color: var(--color-copper);
    opacity: 0.26;
    animation: gearRotate 18s linear infinite;
}

/* Small gear - left side */
.gear-sm.gear-3 {
    width: 100px;
    height: 100px;
    top: 50%;
    left: -35px;
    color: var(--color-bronze);
    opacity: 0.25;
    animation: gearRotate 20s linear infinite;
}

/* Large gear - bottom right */
.gear-lg.gear-4 {
    width: 220px;
    height: 220px;
    bottom: -70px;
    right: 5%;
    color: var(--color-brass-mid);
    opacity: 0.32;
    animation: gearRotateReverse 35s linear infinite;
}

/* Medium gear interlocking bottom right */
.gear-md.gear-4b {
    width: 110px;
    height: 110px;
    bottom: 80px;
    right: calc(5% + 140px);
    color: var(--color-brass);
    opacity: 0.26;
    animation: gearRotate 20s linear infinite;
}

/* Extra small floating gears for depth */
.gear-xs.gear-5 {
    width: 70px;
    height: 70px;
    top: 25%;
    right: 15%;
    color: var(--color-brass-dark);
    opacity: 0.2;
    animation: gearRotate 15s linear infinite;
}

.gear-xs.gear-6 {
    width: 60px;
    height: 60px;
    bottom: 35%;
    left: 8%;
    color: var(--color-copper);
    opacity: 0.22;
    animation: gearRotateReverse 14s linear infinite;
}

.gear-tiny.gear-7 {
    width: 50px;
    height: 50px;
    top: 60%;
    right: 25%;
    color: var(--color-bronze);
    opacity: 0.18;
    animation: gearRotate 12s linear infinite;
}

@keyframes gearRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes gearRotateReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Pipes - darker brass/copper metallic look */
.pipe {
    position: absolute;
    background: linear-gradient(
        to bottom,
        var(--color-brass-dark) 0%,
        var(--color-brass-mid) 25%,
        var(--color-brass) 40%,
        var(--color-brass-mid) 60%,
        var(--color-brass-dark) 100%
    );
    opacity: 0.3;
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.35);
}

.pipe-horizontal {
    height: 16px;
    border-radius: 8px;
}

.pipe-vertical {
    width: 16px;
    border-radius: 8px;
}

.pipe-1 {
    width: 35%;
    top: 15%;
    left: -5%;
}

.pipe-2 {
    height: 40%;
    top: 10%;
    right: 8%;
}

.pipe-3 {
    width: 25%;
    bottom: 20%;
    right: -5%;
}

.pipe-4 {
    height: 35%;
    bottom: 5%;
    left: 5%;
}

/* Pipe Joints - darker brass look */
.pipe-joint {
    position: absolute;
    width: 28px;
    height: 28px;
    background: radial-gradient(
        circle at 35% 35%,
        var(--color-brass) 0%,
        var(--color-brass-mid) 40%,
        var(--color-brass-dark) 80%,
        #4a3a18 100%
    );
    border-radius: 50%;
    box-shadow: 
        inset -2px -2px 4px rgba(0, 0, 0, 0.5),
        inset 2px 2px 4px rgba(255, 255, 255, 0.12),
        0 0 6px rgba(140, 104, 40, 0.25);
}

.pipe-horizontal .pipe-joint {
    top: 50%;
    transform: translateY(-50%);
}

.pipe-vertical .pipe-joint {
    left: 50%;
    transform: translateX(-50%);
}

.pipe-joint-left { left: -4px; }
.pipe-joint-right { right: -4px; }
.pipe-joint-top { top: -4px; }
.pipe-joint-bottom { bottom: -4px; }

/* Steam Vents */
.steam-vent {
    position: absolute;
    width: 14px;
    height: 10px;
    background: linear-gradient(
        to right,
        var(--color-brass-dark) 0%,
        var(--color-brass) 50%,
        var(--color-brass-dark) 100%
    );
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 4px rgba(196, 151, 61, 0.4);
}

.pipe-horizontal .steam-vent {
    top: -10px;
    left: 60%;
}

.pipe-horizontal .steam-vent-2 {
    top: -10px;
    left: 30%;
}

.steam-vent-side {
    width: 10px;
    height: 14px;
    border-radius: 0 3px 3px 0;
    top: 35%;
    left: 100%;
}

.steam-vent-lower {
    top: 65%;
}

/* Steam Particles - brighter, more visible puffs */
.steam {
    position: absolute;
    width: 14px;
    height: 14px;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.85) 0%,
        rgba(245, 242, 235, 0.6) 30%,
        rgba(230, 225, 215, 0.35) 60%,
        transparent 100%
    );
    border-radius: 50%;
    filter: blur(3px);
    opacity: 0;
}

.pipe-horizontal .steam {
    bottom: 100%;
    left: 50%;
}

.steam-vent-side .steam {
    left: 100%;
    top: 50%;
}

/* Steam animation timing - staggered puffs */
.steam-1 {
    animation: steamRise 2.5s ease-out infinite;
    animation-delay: 0s;
}

.steam-2 {
    animation: steamRise 2.8s ease-out infinite;
    animation-delay: 0.8s;
    margin-left: -6px;
    width: 10px;
    height: 10px;
}

.steam-3 {
    animation: steamRise 2.6s ease-out infinite;
    animation-delay: 1.6s;
    margin-left: 6px;
    width: 14px;
    height: 14px;
}

/* Side steam vents */
.steam-vent-side .steam-1 {
    animation: steamRiseSide 2.5s ease-out infinite;
    animation-delay: 0.3s;
}

.steam-vent-side .steam-2 {
    animation: steamRiseSide 2.7s ease-out infinite;
    animation-delay: 1.1s;
    margin-top: -5px;
    margin-left: 0;
}

.steam-vent-side .steam-3 {
    animation: steamRiseSide 2.4s ease-out infinite;
    animation-delay: 1.9s;
    margin-top: 5px;
    margin-left: 0;
}

@keyframes steamRise {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    15% {
        opacity: 0.95;
        transform: translateY(-8px) scale(1);
    }
    40% {
        opacity: 0.7;
        transform: translateY(-20px) scale(1.5);
    }
    70% {
        opacity: 0.4;
        transform: translateY(-35px) scale(2);
    }
    100% {
        opacity: 0;
        transform: translateY(-55px) scale(2.8);
    }
}

@keyframes steamRiseSide {
    0% {
        opacity: 0;
        transform: translateX(0) translateY(0) scale(0.5);
    }
    15% {
        opacity: 0.9;
        transform: translateX(5px) translateY(-3px) scale(1);
    }
    40% {
        opacity: 0.6;
        transform: translateX(15px) translateY(-10px) scale(1.5);
    }
    70% {
        opacity: 0.3;
        transform: translateX(28px) translateY(-18px) scale(2);
    }
    100% {
        opacity: 0;
        transform: translateX(45px) translateY(-25px) scale(2.5);
    }
}

/* Extra steam particles for more volume */
.steam-4 {
    animation: steamRise 3s ease-out infinite;
    animation-delay: 0.4s;
    margin-left: -3px;
    width: 8px;
    height: 8px;
}

.steam-5 {
    animation: steamRise 2.9s ease-out infinite;
    animation-delay: 1.2s;
    margin-left: 3px;
    width: 10px;
    height: 10px;
}

.steam-vent-side .steam-4 {
    animation: steamRiseSide 2.8s ease-out infinite;
    animation-delay: 0.7s;
    margin-top: -2px;
    margin-left: 0;
}

.steam-vent-side .steam-5 {
    animation: steamRiseSide 2.6s ease-out infinite;
    animation-delay: 1.5s;
    margin-top: 2px;
    margin-left: 0;
}

/* ========================================
   Main Layout
   ======================================== */
main {
    position: relative;
    z-index: 1;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.hero-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo / Wordmark */
.logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 8vw, 6rem);
    letter-spacing: 0.1em;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.logo-thick {
    color: var(--color-primary);
    text-shadow: var(--glow-primary);
}

.logo-ideas {
    color: var(--color-text);
}

.logo-labs {
    font-size: 0.35em;
    font-weight: 500;
    letter-spacing: 0.5em;
    color: var(--color-muted);
    margin-top: var(--space-sm);
}

/* Tagline */
.tagline {
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-muted);
    margin-top: var(--space-lg);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    animation: fadeInUp 1s ease-out 0.3s both;
}

/* ========================================
   Apps Grid Section
   ======================================== */
.apps {
    padding: var(--space-xl) var(--space-lg) var(--space-2xl);
    max-width: 1200px;
    margin: 0 auto;
}

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

/* App Card */
.app-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: 
        transform var(--transition-base),
        box-shadow var(--transition-base),
        border-color var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    /* Initial state for scroll animation */
    opacity: 0;
    transform: translateY(40px);
}

.app-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: 
        opacity var(--transition-slow),
        transform var(--transition-slow),
        box-shadow var(--transition-base),
        border-color var(--transition-base);
}

/* Staggered animation delays */
.app-card:nth-child(1) { transition-delay: 0ms; }
.app-card:nth-child(2) { transition-delay: 100ms; }
.app-card:nth-child(3) { transition-delay: 200ms; }
.app-card:nth-child(4) { transition-delay: 300ms; }
.app-card:nth-child(5) { transition-delay: 400ms; }

.app-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 212, 255, 0.05) 0%,
        transparent 50%,
        rgba(255, 107, 53, 0.03) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--glow-primary);
    border-color: var(--color-primary);
}

.app-card:hover::before {
    opacity: 1;
}

/* App Icon */
.app-icon {
    width: 64px;
    height: 64px;
    color: var(--color-primary);
    margin-bottom: var(--space-lg);
    transition: 
        transform var(--transition-base),
        filter var(--transition-base);
}

.app-card:hover .app-icon {
    transform: scale(1.1);
    filter: drop-shadow(var(--glow-primary));
}

.app-icon svg {
    width: 100%;
    height: 100%;
}

/* App Name */
.app-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.05em;
}

/* App Description */
.app-desc {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-bottom: var(--space-lg);
    flex-grow: 1;
}

/* App Link */
.app-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: gap var(--transition-base);
}

.app-link svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-base);
}

.app-card:hover .app-link {
    gap: var(--space-md);
}

.app-card:hover .app-link svg {
    transform: translateX(4px);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-muted);
    letter-spacing: 0.05em;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .logo {
        font-size: clamp(2rem, 12vw, 3.5rem);
    }
    
    .logo-labs {
        letter-spacing: 0.3em;
    }
    
    .apps {
        padding: var(--space-lg) var(--space-md) var(--space-xl);
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .app-card {
        padding: var(--space-lg);
    }
    
    .app-icon {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: var(--space-md);
    }
    
    .tagline {
        font-size: 0.9rem;
        letter-spacing: 0.15em;
    }
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .app-card {
        opacity: 1;
        transform: none;
    }
    
    .bg-grid, .bg-glow {
        animation: none;
    }
    
    .gear {
        animation: none;
    }
    
    .steam {
        display: none;
    }
}

/* Adjust steampunk elements on smaller screens */
@media (max-width: 768px) {
    .gear-xl.gear-1 {
        width: 160px;
        height: 160px;
        top: -50px;
        left: -50px;
    }
    
    .gear-md.gear-1b {
        width: 80px;
        height: 80px;
        top: 70px;
        left: 60px;
    }
    
    .gear-lg.gear-2 {
        width: 120px;
        height: 120px;
        top: -30px;
        right: -35px;
    }
    
    .gear-sm.gear-2b,
    .gear-xs.gear-5,
    .gear-xs.gear-6,
    .gear-tiny.gear-7 {
        display: none;
    }
    
    .gear-sm.gear-3 {
        width: 70px;
        height: 70px;
        left: -25px;
    }
    
    .gear-lg.gear-4 {
        width: 140px;
        height: 140px;
        bottom: -45px;
    }
    
    .gear-md.gear-4b {
        width: 70px;
        height: 70px;
        bottom: 50px;
        right: calc(5% + 90px);
    }
    
    .pipe-1, .pipe-3 {
        display: none;
    }
    
    .pipe-2, .pipe-4 {
        opacity: 0.25;
    }
}

/* ========================================
   Selection Styling
   ======================================== */
::selection {
    background: rgba(0, 212, 255, 0.3);
    color: var(--color-text);
}

/* ========================================
   Focus States (Accessibility)
   ======================================== */
.app-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}
