/* CSS Reset & Root Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-base: #000000;
    --surface-color: rgba(20, 20, 22, 0.6);
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --text-muted: #515154;
    --accent: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-base);
    overflow-x: hidden;
}

/* VisionOS Style Noise Layer */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Nav - Minimalist Top Left */
nav {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1000;
}

.logo {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease, letter-spacing 0.5s ease;
}

.logo:hover {
    opacity: 0.7;
    letter-spacing: 0.15em;
}

.logo span {
    color: var(--text-secondary);
    margin-left: 0.3rem;
    font-weight: 500;
    transition: margin-left 0.5s ease;
}

.logo:hover span {
    margin-left: 0.5rem;
}

/* Scroll Reveal Utility */
.reveal {
    opacity: 0;
    transform: translateY(20px) scale(0.99);
    transition: opacity 1s var(--ease-spring), transform 1s var(--ease-spring);
    will-change: opacity, transform;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

.delay-4 {
    transition-delay: 0.4s;
}

.delay-5 {
    transition-delay: 0.5s;
}

/* Hero Section & Canvas */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10rem 2rem 6rem;
    position: relative;
    z-index: 1;
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

/* 3D Canvas Background */
#network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.hero-content {
    max-width: 860px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(20, 20, 24, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-badge .badge-text {
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-badge .badge-separator {
    width: 1px;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.8rem;
}

.hero-badge .badge-coord {
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.hero h1 {
    font-size: clamp(3rem, 7vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #ffffff 20%, #86868b 40%, #86868b 60%, #ffffff 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-shine 6s linear infinite;
}

@keyframes text-shine {
    to {
        background-position: 200% center;
    }
}

.hero-subheadline {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 640px;
    margin: 0 auto 3rem;
    letter-spacing: -0.01em;
}

.hero-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-stat {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease, background 0.3s ease;
}

.hero-stat:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Magnetic CTA */
.primary-cta {
    margin-top: 3.5rem;
    padding: 0.8rem 1.75rem;
    border-radius: 999px;
    background: #ffffff;
    color: #000000;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 20px rgba(255, 255, 255, 0.15);
    text-decoration: none;
}

.primary-cta span {
    display: inline-block;
    transition: transform 0.4s var(--ease-spring);
    will-change: transform;
}

.primary-cta svg {
    width: 16px;
    height: 16px;
    transition: transform 0.4s var(--ease-spring);
    will-change: transform;
}

.primary-cta:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 16px 32px rgba(255, 255, 255, 0.25);
}

/* Bento Grid */
.about {
    padding: 6rem 2rem;
    position: relative;
    z-index: 1;
}

.about-container {
    max-width: 1040px;
    margin: 0 auto;
}

.about-header {
    max-width: 680px;
    margin: 0 auto 4rem;
    text-align: center;
}

.section-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.about h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.about p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* NEW Bento Layout Math */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    perspective: 1000px;
}

@media (min-width: 769px) {
    .feature:nth-child(1) {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    /* Span 2 Cols */
    .feature:nth-child(2) {
        grid-column: 3 / 4;
        grid-row: 1;
    }

    /* Span 1 Col (Square) */
    .feature:nth-child(3) {
        grid-column: 1 / 4;
        grid-row: 2;
        /* Full width row */
        flex-direction: row;
        align-items: center;
        gap: 3rem;
    }

    .feature:nth-child(3) .feature-icon {
        margin-bottom: 0;
        flex-shrink: 0;
        width: 56px;
        height: 56px;
    }
}

.feature {
    --rotate-x: 0deg;
    --rotate-y: 0deg;
    --scale: 1;

    background: var(--surface-color);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    text-align: left;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);

    transform: perspective(1000px) rotateX(var(--rotate-x)) rotateY(var(--rotate-y)) scale3d(var(--scale), var(--scale), var(--scale));
    transition: transform 0.6s var(--ease-spring), background 0.6s var(--ease-spring), box-shadow 0.6s var(--ease-spring), border-color 0.6s var(--ease-spring);
}

.feature:hover {
    background: rgba(30, 30, 32, 0.6);
    border-color: var(--glass-highlight);
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.06), transparent 40%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.feature:hover::before {
    opacity: 1;
}

.feature>*:not(.feature-bg) {
    position: relative;
    z-index: 2;
}

/* Card Background Abstract Visuals */
.feature-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.05;
    transition: opacity 0.5s ease;
    mask-image: linear-gradient(to bottom, black 20%, transparent 95%);
    -webkit-mask-image: linear-gradient(to bottom, black 20%, transparent 95%);
}

.feature:hover .feature-bg {
    opacity: 0.12;
}

/* Card 1: Layered Glass Panels */
.feature-bg.bg-layered-glass {
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 800px;
}

.feature:hover .feature-bg.bg-layered-glass {
    opacity: 1;
}

.glass-container {
    position: relative;
    width: 240px;
    height: 160px;
    transform-style: preserve-3d;
    animation: float-glass 6s infinite alternate ease-in-out;
}

@keyframes float-glass {
    0% {
        transform: translateY(4px);
    }

    100% {
        transform: translateY(-4px);
    }
}

.glass-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* Slower, gentler transition when hovering away (returning to resting state) */
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 1.2s ease, background 1.2s ease, box-shadow 1.2s ease;
}

/* Snappy, springy transition when hovering over (expanding state) */
.feature:hover .glass-panel {
    transition: transform 0.6s var(--ease-spring), border-color 0.6s var(--ease-spring), background 0.6s var(--ease-spring), box-shadow 0.6s var(--ease-spring);
}

.panel-1 {
    transform: rotateX(15deg) rotateY(-15deg) translateZ(-20px);
    z-index: 1;
}

.panel-2 {
    transform: rotateX(15deg) rotateY(-15deg) translateZ(0px);
    z-index: 2;
}

.panel-3 {
    transform: rotateX(15deg) rotateY(-15deg) translateZ(20px);
    border-color: rgba(255, 255, 255, 0.15);
    z-index: 3;
}

.feature:hover .panel-1 {
    transform: rotateX(25deg) rotateY(-20deg) translateZ(-40px) translateX(10px) translateY(10px);
    border-color: rgba(255, 255, 255, 0.12);
}

.feature:hover .panel-2 {
    transform: rotateX(25deg) rotateY(-20deg) translateZ(0px);
    border-color: rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.feature:hover .panel-3 {
    transform: rotateX(25deg) rotateY(-20deg) translateZ(40px) translateX(-10px) translateY(-10px);
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.04) 100%);
    box-shadow: -10px 20px 30px rgba(0, 0, 0, 0.4);
}

/* Card 2: The Infinite Server Rack */
.feature-bg.bg-server-rack {
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
}

.feature:hover .feature-bg.bg-server-rack {
    opacity: 1;
}

.rack-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin-left: 60px; /* Shift right away from icon */
    margin-top: -10px; /* Shift up away from the bottom text block */
    transform-style: preserve-3d;
    transform: rotateX(60deg) rotateZ(-45deg);
    animation: float-rack 8s infinite alternate ease-in-out;
}

@keyframes float-rack {
    0% {
        transform: rotateX(60deg) rotateZ(-45deg) translateZ(5px);
    }

    100% {
        transform: rotateX(60deg) rotateZ(-45deg) translateZ(-5px);
    }
}

.server-blade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(20, 20, 25, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Gentler transition when returning to rest */
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 1.2s ease, background 1.2s ease, opacity 1.2s ease;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 10px 20px rgba(0, 0, 0, 0.4);
}

/* Fast, deep spring out on hover */
.feature:hover .server-blade {
    transition: transform 0.6s var(--ease-spring), border-color 0.6s var(--ease-spring), background 0.6s var(--ease-spring), opacity 0.6s ease;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(30, 30, 38, 0.9);
}

.server-blade .led {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    /* bright green */
    box-shadow: 0 0 8px #4ade80, 0 0 12px #4ade80;
}

@keyframes blink-led {

    0%,
    70%,
    100% {
        opacity: 0.8;
    }

    75%,
    85% {
        opacity: 0.1;
    }
}

/* Distinct LEDs */
.blade-1 .led {
    animation: blink-led 2.5s infinite 0s;
    background: #3b82f6;
    box-shadow: 0 0 8px #3b82f6;
}

/* Blue */
.blade-2 .led {
    animation: blink-led 3s infinite 0.5s;
}

.blade-3 .led {
    animation: blink-led 2s infinite 1.2s;
}

.blade-4 .led {
    animation: blink-led 3.5s infinite 0.2s;
    background: #3b82f6;
    box-shadow: 0 0 8px #3b82f6;
}

.blade-5 .led {
    animation: blink-led 2.8s infinite 2s;
}

/* Resting State: Stacked Tightly */
.blade-1 {
    transform: translateZ(30px);
    z-index: 5;
}

.blade-2 {
    transform: translateZ(15px);
    z-index: 4;
}

.blade-3 {
    transform: translateZ(0px);
    z-index: 3;
}

.blade-4 {
    transform: translateZ(-15px);
    z-index: 2;
    border-color: rgba(255, 255, 255, 0.08);
}

.blade-5 {
    transform: translateZ(-30px);
    z-index: 1;
    border-color: rgba(255, 255, 255, 0.04);
    opacity: 0.4;
}

/* Hover State: The Infinite Deep Expansion */
.feature:hover .blade-1 {
    transform: translateZ(60px);
}

.feature:hover .blade-2 {
    transform: translateZ(20px);
}

.feature:hover .blade-3 {
    transform: translateZ(-20px);
}

.feature:hover .blade-4 {
    transform: translateZ(-60px);
    opacity: 0.8;
    border-color: rgba(255, 255, 255, 0.2);
}

.feature:hover .blade-5 {
    transform: translateZ(-100px);
    opacity: 0.6;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Card 3: The 3D Matrix */
.bg-control-matrix {
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    transform-style: preserve-3d;
    transform: rotateX(60deg) rotateZ(45deg);
}

.feature-matrix .pillar {
    --h: 10px;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    transform-style: preserve-3d;
    transform: translateZ(var(--h));
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.8s var(--ease-spring), background 0.8s ease, border-color 0.8s ease;
}

.feature-matrix .pillar::before {
    content: '';
    position: absolute;
    top: 100%;
    left: -1px;
    width: calc(100% + 2px);
    height: var(--h);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.01));
    transform-origin: top;
    transform: rotateX(-90deg);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    transition: height 0.8s var(--ease-spring);
}

.feature-matrix .pillar::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 100%;
    width: var(--h);
    height: calc(100% + 2px);
    background: linear-gradient(to right, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
    transform-origin: left;
    transform: rotateY(90deg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: width 0.8s var(--ease-spring);
}

/* Hover active state for mouse dragging */
.feature-matrix.is-active .pillar {
    transition: transform 0.15s ease-out, background 0.15s ease, border-color 0.15s ease;
}

.feature-matrix.is-active .pillar::before {
    transition: height 0.15s ease-out;
}

.feature-matrix.is-active .pillar::after {
    transition: width 0.15s ease-out;
}

/* Icon & Typography Styling */
.feature-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.feature-icon svg {
    width: 22px;
    height: 22px;
    stroke: #d2d2d7;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.feature p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Footer */
footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6rem 2rem 4rem;
    text-align: center;
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: linear-gradient(to bottom, transparent 0%, #030303 90%);
    /* The Abyss */
}

.footer-topo {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
    /* Boosted base opacity safely */

    /* Increased line width to 2px to survive 3D perspective anti-aliasing */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.25) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.25) 2px, transparent 2px);
    background-size: 60px 60px;

    transform-origin: center bottom;
    transform: perspective(800px) rotateX(60deg) scale(2.5);

    /* Fixed mask coordinates so the grid firmly appears underneath the footer content */
    mask-image: linear-gradient(to bottom, black 10%, transparent 80%);
    -webkit-mask-image: linear-gradient(to bottom, black 10%, transparent 80%);

    animation: topo-pan 30s linear infinite;
}

@keyframes topo-pan {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 60px;
    }
}

footer>*:not(.footer-topo) {
    position: relative;
    z-index: 2;
}

.footer-logo {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.footer-descriptor {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.footer-offices {
    max-width: 300px;
    margin: 0 auto 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .features {
        grid-template-columns: 1fr;
    }

    .feature:nth-child(1),
    .feature:nth-child(2),
    .feature:nth-child(3) {
        grid-column: span 1;
        grid-row: span 1;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .feature:nth-child(3) .feature-icon {
        margin-bottom: 2rem;
    }

    .hero-stats {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .hero h1 {
        font-size: 2.75rem;
    }
}