/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Color & Font Variables */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0A0A0A;
    --bg-card: #111111;
    --accent-green: #A3E635;
    --accent-green-dim: #A3E63533;
    --accent-red: #ef4444;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-tertiary: #666666;
    --font-hero: 'Space Mono', monospace;
    --font-body: 'Inter', sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
    --font-brand: 'Montserrat', sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ========================================
   INTRO ANIMATION STYLES
   ======================================== */

.intro-animation {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.intro-animation.transitioning {
    pointer-events: none;
}

.intro-animation.complete {
    display: none;
}

.stage {
    position: relative;
    aspect-ratio: 1/1;
    width: clamp(320px, min(90vmin, 96vw), 860px);
    contain: layout paint size;
    perspective: 1400px;
    opacity: 0;
}

.layer {
    position: absolute;
    inset: 0;
}

/* Canvas Container for Matrix Rain */
.canvas-container {
    position: fixed;
    inset: 0;
    z-index: 100;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Tic-Tac-Toe Game Elements */
.grid, .board, .logo {
    visibility: hidden;
}

.board {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.cell {
    position: absolute;
    width: 33.3333%;
    height: 33.3333%;
    display: grid;
    place-items: center;
}

.cell[data-i="0"]{left:0;top:0}
.cell[data-i="1"]{left:33.3333%;top:0}
.cell[data-i="2"]{left:66.6666%;top:0}
.cell[data-i="3"]{left:0;top:33.3333%}
.cell[data-i="4"]{left:33.3333%;top:33.3333%}
.cell[data-i="5"]{left:66.6666%;top:33.3333%}
.cell[data-i="6"]{left:0;top:66.6666%}
.cell[data-i="7"]{left:33.3333%;top:66.6666%}
.cell[data-i="8"]{left:66.6666%;top:66.6666%}

.glyph {
    font-family: var(--font-brand);
    font-weight: 900;
    font-size: clamp(64px, 11vmin, 100px);
    line-height: 1;
    color: var(--text-primary);
    opacity: 0;
    will-change: transform, opacity;
}

.grid {
    z-index: 1;
}

.grid path {
    stroke: var(--accent-green);
    stroke-width: 7;
    stroke-linecap: round;
    fill: none;
    will-change: stroke-dashoffset;
}

/* Logo Animation Container */
.logo {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-container {
    position: relative;
    width: 65%;
    height: 65%;
    flex-shrink: 0;
}

.logo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    gap: 2.5%;
    position: absolute;
    inset: 0;
}

.logo-tile {
    background-color: var(--accent-green);
    display: grid;
    place-items: center;
    border-radius: 0;
    transform-origin: center center;
    visibility: hidden;
}

.logo-char {
    font-family: var(--font-brand);
    font-weight: 900;
    font-size: clamp(6rem, 25vmin, 15rem);
    color: #000000;
    line-height: 1;
}

.logo-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5%;
    color: var(--text-primary);
    flex-shrink: 0;
}

.reveal-line {
    width: 100%;
    height: 1px;
    background-color: var(--accent-green);
    transform: scaleX(0);
    margin-bottom: 1.5em;
}

.data-text {
    font-size: clamp(1.8rem, 6vmin, 3.5rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    opacity: 0;
}

.tagline {
    font-size: clamp(0.9rem, 2.2vmin, 1.4rem);
    font-weight: 400;
    opacity: 0;
    margin-top: 0.75em;
}

.scanline {
    position: absolute;
    left: 0;
    top: -10%;
    width: 100%;
    height: 5%;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.4), #fff, rgba(255,255,255,0.4), transparent);
    opacity: 0;
    filter: blur(2px);
    z-index: 30;
}

/* ========================================
   MAIN SITE STYLES
   ======================================== */

.main-site {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out, visibility 0s linear 0.8s;
}

.main-site.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease-in-out, visibility 0s linear 0s;
}

/* Data Flow Background Styling */
#tsparticles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
    will-change: transform;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* Hero Logo (2x2 Grid) */
.hero-logo-container {
    width: 140px;
    height: 140px;
    margin-bottom: 3rem;
    opacity: 0;
    transform: scale(0.8);
}

.hero-logo-container.visible {
    animation: fadeInHeroLogo 1s ease-out forwards;
}

@keyframes fadeInHeroLogo {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(-15px);
    }
    60% {
        opacity: 1;
        transform: scale(1.02) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hero-logo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    gap: 3.5%;
}

.hero-logo-tile {
    background-color: var(--accent-green);
    display: grid;
    place-items: center;
    border-radius: 0;
    filter: drop-shadow(0 0 20px var(--accent-green-dim));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-logo-container.visible .hero-logo-tile {
    animation: subtleGlow 2s ease-in-out 0.5s;
}

@keyframes subtleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px var(--accent-green-dim));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(163, 230, 53, 0.5));
    }
}

.hero-logo-char {
    font-family: var(--font-brand);
    font-weight: 900;
    font-size: clamp(2.5rem, 8vw, 4rem);
    color: #000000;
    line-height: 1;
}

.hero h1 {
    font-family: var(--font-hero);
    font-size: clamp(1.75rem, 4.5vw, 3rem);
    color: var(--text-primary);
    min-height: 120px;
    font-weight: 400;
    letter-spacing: -0.02em;
}

#typed-element {
    color: var(--accent-green);
    text-shadow: 0 0 30px var(--accent-green-dim);
}

/* Content Sections */
.content-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 6rem 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.content-section h2 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.content-section p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
    line-height: 1.8;
}

/* Coming Soon Tag */
.coming-soon-tag {
    color: var(--accent-green);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 3px;
    margin-bottom: 2rem;
    font-size: 0.75rem !important;
    font-family: var(--font-hero);
}

/* Founders Section */
.founders-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 4rem;
    text-align: left;
}

.founder-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--text-tertiary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.founder-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, var(--accent-green), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.founder-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-green);
    box-shadow: 0 20px 40px rgba(163, 230, 53, 0.1);
}

.founder-card:hover::before {
    opacity: 1;
}

.founder-card h3 {
    color: var(--accent-green);
    margin-bottom: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.founder-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Footer */
footer {
    text-align: center;
    padding: 4rem 2rem;
    border-top: 1px solid var(--text-tertiary);
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: 4rem;
    position: relative;
    z-index: 1;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

footer a:hover {
    color: var(--accent-green);
}

footer a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-green);
    transition: width 0.3s ease;
}

footer a:hover::after {
    width: 100%;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet & Below */
@media (max-width: 1024px) {
    .founders-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .stage {
        width: clamp(300px, 85vmin, 700px);
    }
}

/* Mobile Landscape & Portrait */
@media (max-width: 768px) {
    #tsparticles {
        opacity: 0.25;
    }

    .hero h1 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        min-height: 100px;
    }

    .hero-logo-container {
        width: 100px;
        height: 100px;
        margin-bottom: 2rem;
    }

    .hero-logo-char {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }

    .content-section {
        padding: 4rem 1.5rem;
    }

    .content-section h2 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        margin-bottom: 1rem;
    }

    .content-section p {
        font-size: 1rem;
    }

    .founders-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2.5rem;
    }

    .founder-card {
        padding: 2rem;
    }

    footer {
        padding: 3rem 1.5rem;
        font-size: 0.813rem;
    }

    /* Mobile optimizations for intro animation */
    .stage {
        width: clamp(280px, 88vmin, 600px);
    }

    .logo-char {
        font-size: clamp(4rem, 20vmin, 10rem);
    }

    .glyph {
        font-size: clamp(48px, 9vmin, 80px);
    }

    .grid path {
        stroke-width: 5;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.375rem;
        min-height: 90px;
    }

    .hero-logo-container {
        width: 90px;
        height: 90px;
        margin-bottom: 1.75rem;
    }

    .hero-logo-char {
        font-size: 1.5rem;
    }

    .content-section {
        padding: 3rem 1rem;
    }

    .content-section h2 {
        font-size: 1.625rem;
    }

    .founder-card {
        padding: 1.5rem;
    }

    .stage {
        width: clamp(260px, 92vw, 500px);
    }

    .logo-char {
        font-size: clamp(3rem, 18vmin, 8rem);
    }

    .data-text {
        font-size: clamp(1.4rem, 5vmin, 2.5rem);
    }

    .tagline {
        font-size: clamp(0.75rem, 1.8vmin, 1.1rem);
    }
}

/* Landscape Mobile Specific */
@media (max-height: 500px) and (orientation: landscape) {
    .stage {
        width: min(60vh, 90vw);
    }

    .hero {
        min-height: auto;
        padding: 2rem 20px;
    }

    .hero-logo-container {
        margin-bottom: 1.5rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-logo-tile, .logo-tile {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .intro-animation {
        display: none !important;
    }

    .main-site {
        opacity: 1 !important;
        visibility: visible !important;
    }

    .hero-logo-container {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}
