/* ============================================================
   FRACTALUM — Style System
   Dark theme with electric cyan/purple/magenta fractal accents
   ============================================================ */

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

:root {
    --bg-deep: #0a0a0f;
    --bg-card: #0f0f18;
    --bg-card-hover: #141422;
    --cyan: #00f0ff;
    --purple: #8b5cf6;
    --magenta: #f472b6;
    --text: #e0e0e8;
    --text-dim: #6b6b80;
    --text-accent: #00f0ff;
    --font-main: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-deep);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

::selection {
    background: rgba(0, 240, 255, 0.2);
    color: #fff;
}

/* --- Background Canvas --- */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Sections --- */
.section {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 120px 40px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 60px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    margin: 20px auto 0;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
#hero {
    flex-direction: column;
    text-align: center;
    padding: 0 20px;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* Title: Each letter individually animated */
#hero-title {
    font-size: clamp(3rem, 12vw, 10rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-bottom: 30px;
    user-select: none;
}

.title-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(60px);
    background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 50%, var(--magenta) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    transition: text-shadow 0.3s;
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.15));
}

.title-letter:hover {
    filter: drop-shadow(0 0 40px rgba(0, 240, 255, 0.4));
}

/* Tagline */
.hero-tagline {
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    font-family: var(--font-mono);
    font-weight: 300;
    color: var(--text-dim);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 60px;
    opacity: 0;
}

.tag-dot {
    color: var(--cyan);
    margin: 0 12px;
    font-size: 0.7em;
}

.tag-segment {
    display: inline-block;
}

/* Hero button wrapper */
.hero-btn-wrapper {
    margin-bottom: 80px;
    opacity: 0;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
}

.scroll-hint span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(180deg, var(--cyan), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ============================================================
   FRACTAL BUTTONS — The Star of the Show
   ============================================================ */
.fractal-btn {
    position: relative;
    display: inline-block;
    padding: 16px 48px;
    background: transparent;
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.4s, color 0.4s, background 0.4s;
    overflow: visible;
    z-index: 1;
}

.fractal-btn:hover {
    border-color: var(--cyan);
    color: #fff;
    background: rgba(0, 240, 255, 0.05);
}

.fractal-btn .btn-text {
    position: relative;
    z-index: 3;
    pointer-events: none;
}

/* Canvas overlay for fractal branches — extends beyond button */
.fractal-btn .btn-fractal-canvas,
.cap-card .btn-fractal-canvas {
    position: absolute;
    top: -80px;
    left: -80px;
    right: -80px;
    bottom: -80px;
    width: calc(100% + 160px);
    height: calc(100% + 160px);
    pointer-events: none;
    z-index: 2;
}

.fractal-btn--sm {
    padding: 10px 28px;
    font-size: 0.75rem;
}

/* ============================================================
   ABOUT SECTION
   ============================================================ */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
}

.about-lead {
    font-size: 1.5rem !important;
    font-weight: 500;
    color: var(--cyan) !important;
    margin-bottom: 30px !important;
}

.about-accent {
    font-family: var(--font-mono);
    font-size: 0.9rem !important;
    color: var(--text-dim) !important;
    border-left: 2px solid var(--purple);
    padding-left: 20px;
    line-height: 2 !important;
}

.about-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

#about-fractal-canvas {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* ============================================================
   CAPABILITIES CARDS
   ============================================================ */
.cap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.cap-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid rgba(0, 240, 255, 0.08);
    border-radius: 4px;
    padding: 40px 30px;
    text-align: center;
    transition: border-color 0.4s, background 0.4s, transform 0.4s;
    overflow: visible;
    cursor: default;
}

.cap-card:hover {
    border-color: rgba(0, 240, 255, 0.25);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

.cap-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 24px;
    color: var(--cyan);
    opacity: 0.8;
}

.cap-card h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}

.cap-card p {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.7;
}

/* ============================================================
   INTERACTIVE SECTION
   ============================================================ */
.interactive-subtitle {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: -40px;
    margin-bottom: 40px;
    letter-spacing: 0.1em;
}

.interactive-canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 70vh;
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    background: rgba(5, 5, 12, 0.8);
}

#interactive-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.canvas-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 5;
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 20px 40px;
}

#footer-divider-canvas {
    width: 100%;
    height: 60px;
    display: block;
    margin-bottom: 30px;
}

.footer-mark {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--cyan);
    margin-bottom: 10px;
}

.footer-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.footer-link {
    color: var(--purple);
}

.footer-copy {
    font-size: 0.75rem;
    color: rgba(107, 107, 128, 0.5);
    font-style: italic;
}

/* ============================================================
   REVEAL ANIMATIONS (initial states — GSAP handles the rest)
   ============================================================ */
.reveal-text,
.reveal-block {
    opacity: 0;
    transform: translateY(40px);
}

.reveal-card {
    opacity: 0;
    transform: translateY(60px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .about-visual {
        max-height: 400px;
    }
    
    .section-inner {
        padding: 80px 24px;
    }
}

@media (max-width: 600px) {
    #hero-title {
        letter-spacing: 0.02em;
    }
    
    .hero-tagline {
        font-size: 0.65rem;
        letter-spacing: 0.1em;
    }
    
    .tag-dot {
        display: block;
        margin: 6px 0;
    }
    
    .tag-segment {
        display: block;
    }
    
    .fractal-btn {
        padding: 14px 36px;
        font-size: 0.8rem;
    }
    
    .cap-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .section-inner {
        padding: 60px 16px;
    }
    
    .interactive-canvas-wrapper {
        aspect-ratio: 3/4;
    }
    
    .canvas-controls {
        bottom: 12px;
        right: 12px;
    }
}

/* Subtle glow on scroll for active sections */
.section.is-active .section-title {
    text-shadow: 0 0 40px rgba(0, 240, 255, 0.1);
}

/* Disable hover effects on touch devices for cleaner UX */
@media (hover: none) {
    .fractal-btn:hover {
        background: transparent;
        border-color: rgba(0, 240, 255, 0.3);
    }
    
    .cap-card:hover {
        transform: none;
        background: var(--bg-card);
    }
}
