:root {
    --black: #000000;
    --white: #ffffff;
    --purple: #484558;
    --teal: #00FFEE;
    --grid-size: 50px;
    --animation-speed: 15s;
    --node-color: rgba(72, 69, 88, 0.5);
    --connection-color: rgba(72, 69, 88, 0.2);
    --special-node-color: var(--teal);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Work Sans', sans-serif;
    background-color: var(--black);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Direct Special Nodes */
.special-node-direct {
    position: fixed;
    width: 30px;
    height: 30px;
    background-color: var(--teal);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    box-shadow: 0 0 15px var(--teal), 0 0 30px var(--teal);
    cursor: pointer;
    pointer-events: auto;
    animation: flicker 4s infinite;
    will-change: transform, opacity;
}

.special-node-direct:hover {
    transform: translate(-50%, -50%) scale(1.5);
    animation: none;
    opacity: 1;
    box-shadow: 0 0 30px var(--teal), 0 0 50px var(--teal);
}

/* Neural Network */
.neural-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -5;
    overflow: hidden;
}

.node {
    position: absolute;
    border-radius: 50%;
    background: var(--node-color);
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    transition: all 0.3s ease;
}

.connection {
    position: absolute;
    height: 1px;
    background: var(--connection-color);
    transform-origin: left center;
    z-index: -1;
    opacity: 0.3;
    pointer-events: none;
}

.special-node {
    background: var(--special-node-color);
    box-shadow: 0 0 15px var(--special-node-color), 0 0 30px var(--special-node-color);
    cursor: pointer;
    animation: flicker 4s infinite;
    z-index: 200;
    width: 25px !important;
    height: 25px !important;
    pointer-events: auto !important;
    position: absolute !important;
}

@keyframes flicker {
    0% { opacity: 0.8; box-shadow: 0 0 15px var(--special-node-color); }
    25% { opacity: 0.4; box-shadow: 0 0 5px var(--special-node-color); }
    50% { opacity: 1; box-shadow: 0 0 25px var(--special-node-color); }
    75% { opacity: 0.6; box-shadow: 0 0 10px var(--special-node-color); }
    100% { opacity: 0.8; box-shadow: 0 0 15px var(--special-node-color); }
}

.special-node:nth-child(odd) {
    animation-delay: 1s;
    animation-duration: 6s;
}

.special-node:nth-child(even) {
    animation-delay: 2s;
    animation-duration: 5s;
}

.special-node:nth-child(3n) {
    animation-delay: 0.5s;
    animation-duration: 7s;
}

.special-node:hover {
    transform: translate(-50%, -50%) scale(1.8);
    animation: none;
    opacity: 1;
    box-shadow: 0 0 30px var(--special-node-color), 0 0 50px var(--special-node-color);
}

/* Grid Background */
.containment-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(to right, rgba(72, 69, 88, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(72, 69, 88, 0.1) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    transform-origin: center;
    animation: grid-rotate var(--animation-speed) linear infinite;
    z-index: -10;
}

@keyframes grid-rotate {
    0% {
        transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    }
    50% {
        transform: perspective(1000px) rotateX(5deg) rotateY(3deg);
    }
    100% {
        transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    }
}

/* Non-Euclidean Elements */
.non-euclidean-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -5;
}

.disruption {
    position: absolute;
    background: transparent;
    border: 2px solid var(--teal);
    opacity: 0.6;
    filter: blur(0.5px);
    transform-style: preserve-3d;
    backdrop-filter: invert(5%);
}

#disruption1 {
    top: 25%;
    left: 8%;
    width: 150px;
    height: 150px;
    clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 75% 75%, 75% 100%, 0% 100%);
    animation: float 20s ease-in-out infinite;
}

#disruption2 {
    top: 20%;
    right: 10%;
    width: 100px;
    height: 200px;
    border-radius: 0% 50% 0% 50% / 50% 0% 50% 0%;
    animation: float 15s ease-in-out infinite reverse;
}

#disruption3 {
    bottom: 15%;
    left: 45%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    animation: pulse 8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* Logo and Header */
header {
    margin-bottom: 5rem;
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: absolute;
    top: 2rem;
    left: 2rem;
}

.logo svg {
    width: 55px;
    height: 55px;
}

.aleph-symbol, .zero-symbol {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: draw 3s forwards ease-out;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

h1 {
    font-family: 'Monaspace Krypton', monospace;
    font-size: 2.5rem;
    letter-spacing: 3px;
}

.zero {
    color: var(--teal);
    letter-spacing: 0px;
}

/* Main Content */
.content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.heading-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
  }
  
  /* Background element only for the h2 */
  .heading-background {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    /* Only extend to the bottom of the h2, not the whole container */
    bottom: calc(100% - 20px - 3.5rem - 1.2rem - 20px); /* Adjust based on heading size */
    background-color: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 40px 30px rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    z-index: 1;
  }
  
  /* Heading styles remain the same */
  h2 {
    position: relative;
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--white), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    z-index: 2;
    padding: 10px 20px;
  }
  
  /* Add z-index to paragraph to ensure it stays on top */
  .content p {
    position: relative; /* Needed for z-index to work */
    font-size: 1.2rem;
    margin-bottom: 3rem;
    opacity: 0.8;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    z-index: 3; /* Higher than both the heading and its background */
  }

/* Product Styles */
.product-data {
    display: none; /* Hide the original container */
}

.product {
    position: fixed;
    top: 0;
    left: 0;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.8), rgba(72, 69, 88, 0.3));
    border: 1px solid rgba(72, 69, 88, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 1.5rem;
    width: 320px;
    pointer-events: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 255, 238, 0.3);
}

/* Standard product appearance */
.product.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
    pointer-events: auto;
}

/* First-time product appearance - grow from node */
.product.first-appear {
    /* Reset all transformations and transitions */
    transform: scale(0) translateY(0) !important;
    transform-origin: left center !important;
    transition: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* When first-appear becomes active, apply clean animation */
.product.first-appear.active {
    transform: scale(1) translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.product::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--teal), transparent);
}

.product-content {
    position: relative;
}

.product h3 {
    font-family: 'Space Mono', monospace;
    color: var(--teal);
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

.product h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--teal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.product.active h3::after {
    transform: scaleX(1);
    transition-delay: 0.2s;
}

.product p {
    margin-bottom: 0;
    font-size: 0.95rem;
    opacity: 0.7;
    max-width: 100%;
    color: var(--white);
}

/* Interaction hint */
.interaction-hint {
    position: absolute;
    z-index: 200;
    pointer-events: none;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Glitch effect for product cards */
@keyframes glitch {
    0% {
        clip-path: inset(80% 0 0 0);
        transform: translate(-2px, 2px);
    }
    10% {
        clip-path: inset(10% 0 85% 0);
        transform: translate(2px, -2px);
    }
    20% {
        clip-path: inset(80% 0 0 0);
        transform: translate(-2px, 2px);
    }
    30% {
        clip-path: inset(10% 0 85% 0);
        transform: translate(0px, 0px);
    }
    40% {
        clip-path: inset(50% 0 30% 0);
        transform: translate(2px, 3px);
    }
    50% {
        clip-path: inset(10% 0 85% 0);
        transform: translate(-2px, -2px);
    }
    60% {
        clip-path: inset(40% 0 43% 0);
        transform: translate(2px, 2px);
    }
    70% {
        clip-path: inset(50% 0 30% 0);
        transform: translate(-1px, -1px);
    }
    80% {
        clip-path: inset(80% 0 5% 0);
        transform: translate(2px, -2px);
    }
    90% {
        clip-path: inset(30% 0 60% 0);
        transform: translate(-2px, 2px);
    }
    100% {
        clip-path: inset(80% 0 0 0);
        transform: translate(0px, 0px);
    }
}

.product.glitch::before {
    animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

/* Footer */
footer {
    margin-top: 5rem;
    width: 100%;
}

.launch-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.counter-label {
    font-family: 'Space Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.counter {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    color: var(--teal);
    letter-spacing: 2px;
}

.footer-text {
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    h2 {
        font-size: 2.5rem;
    }
    
    .content p {
        max-width: 100%;
    }
    
    .logo svg {
        width: 50px;
        height: 50px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .counter {
        font-size: 1.5rem;
    }
    
    .product {
        width: 290px;
    }
}

/* Hide hover-dependent elements on touch devices */
@media (pointer: coarse) {
    .special-node,
    .special-node-direct,
    .product,
    .disruption {
        display: none !important;
    }
    
    /* Hide the interaction hint on touch devices */
    .interaction-hint {
        display: none !important;
    }
    
    /* Make all connections dimmer on phones */
    .connection {
        opacity: 0.15 !important;
        background: var(--connection-color) !important;
    }
}

/* Modern CSS features */
@supports (backdrop-filter: blur(10px)) {
    .product {
        backdrop-filter: blur(10px);
        background: rgba(0, 0, 0, 0.6);
    }
}

@supports (mix-blend-mode: overlay) {
    .disruption {
        mix-blend-mode: overlay;
    }
    
    .connection {
        mix-blend-mode: screen;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--black);
}

::-webkit-scrollbar-thumb {
    background: var(--purple);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--teal);
}

/* Copyright footer positioned at the bottom */
.copyright-footer {
    position: fixed;
    bottom: 1.5rem;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    opacity: 0.5;
    z-index: 10;
    pointer-events: none;
}

.copyright-footer .contact-link {
    color: #00FFEE;
    text-decoration: underline;
    display: block;
    margin-bottom: 8px;
    transition: opacity 0.2s ease;
    pointer-events: auto;
    font-family: 'Monaspace Krypton', 'Space Mono', monospace;
}

/* Floating Text Snippets */
.floating-text-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-text {
    position: absolute;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
    color: rgba(180, 180, 180, var(--opacity, 0.3));
    animation-name: float-text-fade;
    animation-duration: var(--duration, 5s);
    animation-fill-mode: forwards;
    text-shadow: 0 0 3px rgba(150, 150, 150, 0.3);
}

/* Different styling for each type */
.floating-text.math {
    font-family: 'Cambria Math', serif;
    font-weight: 500;
}

.floating-text.term {
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
}

.floating-text.code {
    font-family: 'Courier New', monospace;
    opacity: 0.8;
}

/* Keyframes for standard text animation - continuous movement during fade-in and fade-out */
@keyframes float-text-fade {
    0% { 
        opacity: 0; 
        transform: translateX(0);
    }
    10% { 
        opacity: 0.5; 
        transform: translateX(calc(var(--travel-distance, 100px) * 0.1));
    }
    80% { 
        opacity: 0.5; 
        transform: translateX(calc(var(--travel-distance, 100px) * 0.8));
    }
    100% { 
        opacity: 0; 
        transform: translateX(var(--travel-distance, 100px));
    }
}

/* Keyframes for math symbols with rotation */
@keyframes float-text-math {
    0% { 
        opacity: 0; 
        transform: translateX(0) rotate(0);
    }
    10% { 
        opacity: 0.5; 
        transform: translateX(calc(var(--travel-distance, 100px) * 0.1)) rotate(calc(var(--rotate, 0deg) * 0.2));
    }
    80% { 
        opacity: 0.5; 
        transform: translateX(calc(var(--travel-distance, 100px) * 0.8)) rotate(calc(var(--rotate, 0deg) * 0.8));
    }
    100% { 
        opacity: 0; 
        transform: translateX(var(--travel-distance, 100px)) rotate(var(--rotate, 0deg));
    }
}

/* Teal pulse effect for desktop only - will be applied by JavaScript */
@media (pointer: fine) {
    .connection.pulse {
        animation: pulse-teal 2s forwards;
        z-index: 50 !important;
    }

    @keyframes pulse-teal {
        0% {
            background: var(--connection-color);
            opacity: 0.3;
            box-shadow: none;
            height: 1px;
        }
        20% {
            background: var(--teal);
            opacity: 0.9;
            box-shadow: 0 0 8px var(--teal);
            height: 2px;
        }
        60% {
            background: var(--teal);
            opacity: 0.7;
            box-shadow: 0 0 4px var(--teal);
            height: 1.5px;
        }
        100% {
            background: var(--connection-color);
            opacity: 0.3;
            box-shadow: none;
            height: 1px;
        }
    }
}
