/* ==========================================================================
   FOUR PI SYSTEMS — Retro-Future Corporate
   ========================================================================== */

/* --- Design Tokens --- */
:root {
    --bg: #050508;
    --bg-elevated: rgba(255, 255, 255, 0.025);
    --bg-elevated-hover: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #E8E6E3;
    --text-secondary: #9B9A97;
    --text-muted: #5C5B58;
    --neon-pink: #FF2D78;
    --neon-amber: #FFB020;
    --neon-green: #39FF14;
    --neon-blue: #00D4FF;
    --glow-pink: rgba(255, 45, 120, 0.15);
    --glow-amber: rgba(255, 176, 32, 0.15);
    --nav-height: 64px;
    --container: 1120px;
    --radius: 12px;
    --radius-sm: 8px;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; cursor: pointer; font: inherit; }
img, svg { display: block; }

/* --- Utility --- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}
.mono {
    font-family: 'Space Mono', 'Courier New', monospace;
}
.gradient-text {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Scanlines Overlay --- */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    opacity: 0.35;
}

/* --- Noise Overlay --- */
.noise {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Cursor Glow --- */
.cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 45, 120, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    will-change: transform;
    transform: translate(-50%, -50%);
}

/* --- Neon Divider --- */
.neon-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon-pink), var(--neon-amber), transparent);
    opacity: 0.3;
    margin-bottom: 0;
}

/* --- Navigation --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 24px;
    transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
    border-bottom: 1px solid transparent;
}
.nav-scrolled {
    background: rgba(5, 5, 8, 0.8);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-bottom-color: var(--border);
}
.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.nav-logo-icon {
    height: 28px;
    width: auto;
    filter: drop-shadow(0 0 6px rgba(255, 45, 120, 0.4)) drop-shadow(0 0 20px rgba(255, 45, 120, 0.15));
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}
.nav-links a {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    transition: color 0.3s;
}
.nav-links a:hover {
    color: var(--neon-pink);
}

/* Mobile toggle */
.nav-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 4px;
}
.nav-mobile-toggle span {
    display: block;
    width: 24px;
    height: 1.5px;
    background: var(--text);
    transition: transform 0.3s, opacity 0.3s;
}

/* Mobile menu */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(5, 5, 8, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.mobile-menu.active {
    opacity: 1;
    pointer-events: all;
}
.mobile-menu-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}
.mobile-menu-links a {
    font-family: 'Space Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text);
    transition: color 0.3s;
}
.mobile-menu-links a:hover {
    color: var(--neon-pink);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    white-space: nowrap;
}
.btn-ghost {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg-elevated-hover);
    border-color: rgba(255, 45, 120, 0.3);
    box-shadow: 0 0 20px rgba(255, 45, 120, 0.1), inset 0 0 20px rgba(255, 45, 120, 0.03);
}
.btn-large {
    padding: 16px 32px;
    font-size: 0.85rem;
}
.btn-small {
    padding: 8px 16px;
    font-size: 0.72rem;
}

/* --- Hero --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: var(--nav-height);
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    will-change: transform;
}
.orb-1 {
    width: 500px;
    height: 500px;
    background: rgba(255, 45, 120, 0.08);
    top: -10%;
    right: -5%;
    animation: orbFloat1 20s ease-in-out infinite;
}
.orb-2 {
    width: 400px;
    height: 400px;
    background: rgba(255, 176, 32, 0.06);
    bottom: -5%;
    left: -5%;
    animation: orbFloat2 25s ease-in-out infinite;
}
@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-30px, 40px); }
    66% { transform: translate(20px, -30px); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(40px, -30px); }
    66% { transform: translate(-20px, 40px); }
}

/* Grid background */
.grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 45, 120, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 45, 120, 0.03) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black, transparent);
}

/* Wireframe sphere */
.wireframe-sphere {
    position: absolute;
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--neon-pink);
    opacity: 0.06;
    animation: sphereRotate 40s linear infinite;
}
.wireframe-sphere svg {
    width: 100%;
    height: 100%;
}
@keyframes sphereRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Hero content */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
}

/* Hero badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 100px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--neon-green);
    margin-bottom: 32px;
}
.badge-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-green);
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px var(--neon-green);
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}
.cursor-blink {
    animation: blink 1s step-end infinite;
    color: var(--neon-green);
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Hero title */
.hero-title {
    margin-bottom: 24px;
    line-height: 0.85;
}
.hero-fp {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: clamp(3.5rem, 12vw, 9rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px rgba(255, 45, 120, 0.5)) drop-shadow(0 0 40px rgba(255, 45, 120, 0.2));
    letter-spacing: -0.02em;
}
.hero-systems {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: clamp(1.2rem, 4vw, 2.4rem);
    font-weight: 400;
    letter-spacing: 0.5em;
    color: var(--text-secondary);
    margin-top: 8px;
}
.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 40px;
    line-height: 1.7;
}
.hero-ctas {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Glitch animation */
@keyframes glitch {
    0%, 92%, 100% {
        transform: translate(0);
        background-image: linear-gradient(135deg, var(--neon-pink), var(--neon-amber));
    }
    93% {
        transform: translate(-3px, 1px);
        background-image: linear-gradient(135deg, var(--neon-green), var(--neon-blue));
    }
    94% {
        transform: translate(3px, -1px);
        background-image: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
    }
    95% {
        transform: translate(-1px, 2px);
        background-image: linear-gradient(135deg, var(--neon-green), var(--neon-pink));
    }
    96% {
        transform: translate(0);
        background-image: linear-gradient(135deg, var(--neon-pink), var(--neon-amber));
    }
}
.glitch-text {
    animation: glitch 8s step-end infinite;
}

/* Scroll indicator */
.hero-scroll-indicator {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
}
.scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, var(--neon-pink), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
    0%, 100% { opacity: 0.5; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.2); }
}

/* --- Sections --- */
.section {
    position: relative;
    padding: 120px 0;
}
.section-header {
    text-align: center;
    margin-bottom: 64px;
}
.section-tag {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-amber);
    margin-bottom: 16px;
}
.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* --- About --- */
.about-layout {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text);
    margin-top: 24px;
}
.about-text.secondary {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* --- Products --- */
.products-grid {
    max-width: 720px;
    margin: 0 auto;
}
.product-card {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 40px;
    background: var(--bg-elevated);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--border);
    border-left: 3px solid var(--neon-pink);
    border-radius: var(--radius);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.product-card:hover {
    border-color: rgba(255, 45, 120, 0.3);
    border-left-color: var(--neon-pink);
    box-shadow: 0 0 30px rgba(255, 45, 120, 0.08);
}
.product-card-left {
    flex-shrink: 0;
}
.product-logo {
    width: 64px;
    height: auto;
}
.product-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.product-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}
.product-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid rgba(57, 255, 20, 0.2);
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--neon-green);
}
.product-badge .badge-pulse {
    width: 5px;
    height: 5px;
}
.product-tagline {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.product-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 20px;
}

/* --- Contact --- */
.contact-layout {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.contact-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 32px;
}
.contact-email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    color: var(--neon-green);
    transition: text-shadow 0.3s;
}
.contact-email:hover {
    text-shadow:
        0 0 7px var(--neon-green),
        0 0 10px var(--neon-green),
        0 0 21px var(--neon-green),
        0 0 42px rgba(57, 255, 20, 0.4);
}
.terminal-prompt {
    color: var(--neon-green);
    opacity: 0.6;
}

/* --- Footer --- */
.footer {
    padding: 48px 0;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 0;
}
.footer-links {
    display: flex;
    gap: 24px;
}
.footer-links a {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.3s;
}
.footer-links a:hover {
    color: var(--neon-pink);
}
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.footer-bottom p {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.footer-location {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

/* --- Animations --- */
/* Fade up on load */
.anim-fade-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
body.loaded .anim-fade-up {
    opacity: 1;
    transform: translateY(0);
}
.anim-delay-1 { transition-delay: 0.1s; }
.anim-delay-2 { transition-delay: 0.2s; }
.anim-delay-3 { transition-delay: 0.3s; }
.anim-delay-4 { transition-delay: 0.5s; }

/* Scroll reveal */
.scroll-reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .glitch-text { animation: none; }
    .wireframe-sphere { animation: none; }
    .anim-fade-up { transition: none; opacity: 1; transform: none; }
    .scroll-reveal { transition: none; opacity: 1; transform: none; }
    .orb { animation: none; }
    .badge-pulse { animation: none; }
    .cursor-blink { animation: none; }
    .scroll-line { animation: none; }
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .nav-links { display: none; }
    .nav-mobile-toggle { display: flex; }
    .wireframe-sphere { width: 400px; height: 400px; }
    .hero-systems { letter-spacing: 0.3em; }
}

/* --- Responsive: Mobile --- */
@media (max-width: 640px) {
    .section { padding: 80px 0; }
    .hero { min-height: 100svh; }
    .hero-systems { letter-spacing: 0.2em; }
    .wireframe-sphere { width: 280px; height: 280px; }
    .cursor-glow { display: none; }
    .scanlines { opacity: 0.2; }
    .hero-scroll-indicator { display: none; }

    .product-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        padding: 28px;
    }

    .footer-content {
        flex-direction: column;
        gap: 24px;
        align-items: flex-start;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}