/* ==========================================================================
   TABLE OF CONTENTS
   ==========================================================================
   1. Fonts
   2. Variables
   3. Reset & Global Basics
   4. Layout & Containers
   5. Components: Logo & Header
   6. Components: Services & Cards
   7. Components: Identity & CTA Links
   8. Interactive Elements (Canvas, Cursor, Menu)
   9. Footer
   10. Legal Pages
   11. Media Queries
   ========================================================================== */

/* ==========================================================================
   1. Fonts
   ========================================================================== */
/* Orbitron – locally hosted Variable Font */
@font-face {
    font-family: 'Orbitron';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('/font/Orbitron-VariableFont_wght.ttf') format('truetype');
}

/* ==========================================================================
   2. Variables
   ========================================================================== */
:root {
    /* Colors */
    --bg: #000;
    --fg: #f6ffff;
    --accent: #19e9d7;

    /* Effects */
    --shadow-glow:
        0 0 14px var(--accent),
        0 0 4px var(--accent);

    --shadow-depth:
        2px 4px 0 #012,
        4px 8px 0 #023,
        6px 12px 0 #034;
}

/* ==========================================================================
   3. Reset & Global Basics
   ========================================================================== */
html {
    height: 100%;
    overflow-y: auto; /* Only show scrollbar when necessary */
    overflow-x: hidden;
    scrollbar-color: var(--accent) #001020; /* Firefox Support */
    scrollbar-width: thin;
}

body {
    margin: 0;
    padding: 0;
    width: 100%; /* Use 100% instead of 100vw to prevent horizontal scrollbar caused by vertical scrollbar */
    min-height: 100vh;
    min-height: 100dvh; /* Better mobile browser bar support */
    height: auto;
    box-sizing: border-box;
    background: #000;
    overflow-x: hidden;
    overflow-y: visible;
    font-family: 'Orbitron', Arial, sans-serif;

    /* Sticky Footer Flex Layout */
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar Styling (WebKit) */
::-webkit-scrollbar {
    width: 10px;
    background: #001020;
}

::-webkit-scrollbar-track {
    background: #000810;
    border-left: 1px solid #002030;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent);
    border: 2px solid #000810;
}

::-webkit-scrollbar-thumb:hover {
    background: #fff;
    box-shadow: 0 0 15px #fff;
}

/* ==========================================================================
   4. Layout & Containers
   ========================================================================== */
/* Main wrapper for content centering */
#center-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    position: relative;
    z-index: 10;
    flex: 1; /* Take up available vertical space to push footer down */

    width: 100%;
    max-width: 100vw;
    text-align: center;
    pointer-events: none; /* Allows clicks to pass through to canvas where needed, children re-enable */
    flex-wrap: nowrap;

    padding-top: clamp(2em, 4vh, 4em);
}

/* Services Section */
#services-section {
    position: relative;
    z-index: 20;
    width: 95%;
    max-width: 1200px;
    margin: clamp(1.5rem, 4vh, 3rem) auto 0 auto;
    padding: 2em 1.5em 2em 1.5em;
    color: var(--fg);
    pointer-events: none; /* Let clicks pass through gaps */
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 0.95fr));
    gap: 2em;
    width: 100%;
}

/* CTA Terminal Section */
#cta-terminal {
    display: flex;
    justify-content: center;
    margin-top: clamp(1.2em, 2.5vh, 2.0em);
    margin-bottom: clamp(1.0em, 2vh, 1.6em);
    position: relative;
    z-index: 1000;
}

/* Identity Links Section */
#identity-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: clamp(14px, 2vw, 22px);
    margin-top: clamp(1.5em, 2.5vh, 3em);
    margin-bottom: clamp(1.5em, 2.5vh, 3em);
    position: relative;
    z-index: 1000;
}

/* ==========================================================================
   5. Components: Logo & Header
   ========================================================================== */
/* Coordinate System & Logo */
#coord-system {
    position: relative;
    width: fit-content;
    min-width: 3em;
    min-height: 3.5em;
    margin: 0 auto 1em auto;
    pointer-events: none;
    padding: 0 1.6em;
}

.axis-x, .axis-y {
    position: absolute;
    opacity: 0.8;
    z-index: 1;
    border-radius: 3px;
}

.axis-x {
    left: -2.6em; right: -2.6em;
    top: 94%;
    height: 0.5em;
    background: linear-gradient(90deg, transparent 0 10%, var(--accent) 20% 50%, transparent 90% 100%);
    opacity: 0.7;
}

.axis-y {
    top: -2.6em; bottom: -3.6em;
    left: 27.5%;
    width: 0.50em;
    transform: translateX(-50%);
    background: linear-gradient(transparent 0 13%, var(--accent) 50% 90%, transparent 98% 100%);
    opacity: 0.7;
}

.origin-zero {
    position: absolute;
    font-family: 'Orbitron', Arial, sans-serif;
    font-weight: 700;
    font-size: 1.2em;
    color: var(--accent);
    left: 30%; top: 105%;
    opacity: 0.7;
    user-select: none;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.axis-x.hidden, .axis-y.hidden, .origin-zero.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.4s;
}

.quad-row {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.16em;
    z-index: 2;
}

.quad {
    font-family: 'Orbitron', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(3em, 16vw, 16em);
    color: var(--fg);
    text-shadow: var(--shadow-glow), var(--shadow-depth);
    user-select: none;
    pointer-events: none;
    letter-spacing: 0.12em;
}

/* Subtitle */
#subtitle {
    font-size: clamp(1.1em, 2.6vw, 3em);
    margin-top: clamp(1.5em, 2.5vh, 3em);
    letter-spacing: 0.09em;
    color: var(--fg);
    font-weight: 900;
    text-align: center;
    opacity: 0.96;
    z-index: 5;
}

/* Slogan */
#slogan {
    font-size: clamp(1em, 1.6vw, 1.6em);
    margin-top: clamp(1.5em, 2.5vh, 3em);
    color: var(--accent);
    letter-spacing: 0.06em;
    opacity: 0.91;
    font-family: inherit;
    text-align: center;
    font-weight: 900;
    z-index: 5;
}

/* ==========================================================================
   6. Components: Services & Cards
   ========================================================================== */
.service-card {
    backdrop-filter: blur(4px);
    border-radius: 1em;
    padding: 1.5em;
    text-align: left;
    cursor: none;
    user-select: none;
    transition: transform 0.3s, box-shadow 0.3s;
    pointer-events: none;
    box-shadow: none;
    border: 1px solid rgba(25,233,215,0.25);
    background: rgba(0,0,0,0.35);
}

.service-card h3 {
    margin-top: 0;
    margin-bottom: 0.5em;
    font-size: clamp(0.75em, 3.5vw, 1.1em);
    color: var(--accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.service-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-card li {
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.55em, 2.5vw, 0.9em);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    padding-left: 1.2em;
    position: relative;
}

.service-card li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

/* ==========================================================================
   7. Components: Buttons & Links
   ========================================================================== */
/* Smart Solutions Buttons in Slogan */
#slogan .smart-button {
    display: inline-block;
    padding: 0.13em 0.32em;
    border: 1.6px solid rgba(0, 255, 255, 0.7);
    border-radius: 0.3em;
    cursor: none;
    transition: box-shadow 0.22s, border-color 0.22s, background 0.2s, filter 0.18s;
    pointer-events: auto;
    background: rgba(0,255,255,0.16);
    box-shadow: 0 0 8px #0ff2, 0 0 1px #fff2;
    color: #0ff;
    font-weight: 900;
    margin: 0 0.13em;
}

#slogan .smart-button.toggle-active {
    background: rgba(54, 236, 9, 0.8);
    border-color: rgb(11, 248, 42);
    color: #56ff07;
    box-shadow: 0 0 30px #0ff6, 0 0 12px #fff3 inset;
}

#slogan .smart-button.trigger {
    border-color: #f0f;
    color: #fff;
    background: rgba(255,0,255,0.16);
    box-shadow: 0 0 14px #f0f2;
}

#slogan .smart-button.trigger:active {
    background: rgba(255,0,255,0.32);
    box-shadow: 0 0 24px #fff7, 0 0 10px #f0f8;
}

#slogan .smart-button:active,
#slogan .smart-button:focus {
    outline: none;
    filter: brightness(1.25);
}

#slogan .smart-button:hover,
#slogan .smart-button:focus-visible {
    box-shadow: 0 0 24px #0ffb, 0 0 8px #fff7, 0 0 1px #fff2;
    filter: brightness(1.35);
    z-index: 1;
}

#slogan .smart-button.trigger:hover,
#slogan .smart-button.trigger:focus-visible {
    box-shadow: 0 0 32px #f0fb, 0 0 12px #fff7, 0 0 1px #fff2;
    filter: brightness(1.35);
    z-index: 1;
}

/* Identity / Social Links */
.identity-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: clamp(100px, 14vw, 180px);
    padding: clamp(8px, 1vw, 12px) clamp(10px, 1.4vw, 14px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(135deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 4px),
        rgba(0,0,0,0.22);
    color: #fff;
    text-decoration: none;
    pointer-events: auto;
}

.identity-label {
    font-family: 'Orbitron', system-ui, sans-serif;
    font-weight: 900;
    letter-spacing: .4px;
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
    line-height: 1.15;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.identity-source {
    font: 600 clamp(0.72rem, 0.9vw, 0.85rem)/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: rgba(255,255,255,0.72);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.identity-link:hover {
    border-color: rgba(0,234,255,0.6);
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(135deg, rgba(0,0,0,0.06) 0 1px, transparent 1px 4px),
        rgba(0,234,255,0.10);
}

.identity-link:focus { outline: none; }
.identity-link:focus-visible {
    box-shadow: 0 0 0 2px rgba(0,234,255,0.6);
    border-color: rgba(0,234,255,0.8);
}

/* CTA Specifics */
.identity-link.identity-link--cta {
    width: min(560px, 92vw);
    border-radius: 12px;
    align-items: center;
    text-align: center;
    padding: 14px 18px;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.identity-link--cta .identity-label {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: normal;
}

.identity-link--cta .identity-source {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 500;
    opacity: 0.75;
}

.identity-link.identity-link--cta:hover {
    border-color: rgba(0,234,255,0.85);
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(135deg, rgba(0,0,0,0.08) 0 1px, transparent 1px 4px),
        rgba(0,234,255,0.14);
    transform: translateY(-2px);
}

/* ==========================================================================
   8. Interactive Elements (Canvas, Cursor, Menu)
   ========================================================================== */
#fluidCanvas, #crosshairCanvas {
    position: fixed; /* Fixed for scrolling parallax effect */
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    display: block;
}

#crosshairCanvas {
    z-index: 1;
    pointer-events: none;
}

#fluidCanvas {
    background: #000 !important;
    z-index: 0;
    pointer-events: auto; /* Keep interactive */
    touch-action: pan-y; /* Allow vertical scroll on touch */
    cursor: none;
}

#canvas-fade {
    position: absolute;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 2;
    background: #000;
    opacity: 1;
    pointer-events: none;
    transition: opacity 1.6s cubic-bezier(.66,0,.22,1);
}
#canvas-fade.fadeout { opacity: 0; }

/* LED Cursor */
#canvas-led-cursor {
    position: fixed;
    z-index: 199999;
    width: 36px; height: 36px;
    pointer-events: none;
    left: 0; top: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent) 60%, #00d8ff44 90%, transparent 100%);
    box-shadow: 0 0 18px 6px #0ff6, 0 0 0 3px #0ff2;
    opacity: 0.86;
    animation: pulse-cursor 3.2s infinite cubic-bezier(.4, 0, .6, 1);
    transition: opacity 0.14s;
    will-change: transform, opacity;
    display: none;
}

@keyframes pulse-cursor {
    0%,100% { box-shadow: 0 0 18px 6px #0ff6, 0 0 0 3px #0ff2; opacity: 0.86; }
    50% { box-shadow: 0 0 28px 14px #0ff9, 0 0 0 6px #0ff2; opacity: 1; }
}

.cursor { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* FPS Info */
#fps-info {
    position: fixed;
    top: 1.1em; left: 1.5em;
    color: var(--accent);
    font-family: 'Orbitron', monospace;
    font-size: 1.2em;
    background: rgba(0,15,20,0.55);
    border-radius: 0.4em;
    padding: 0.2em 0.9em;
    z-index: 88888;
    pointer-events: none;
    letter-spacing: 0.02em;
    text-shadow: 0 0 8px #0ff8;
}

/* Nerd Menu */
.nerd-menu-corner {
    position: fixed;
    left: 0; right: 1em; bottom: 1em;
    z-index: 188888;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none; /* Let clicks pass through the container */
}

.nerd-menu-corner > * {
    pointer-events: auto; /* Re-enable clicks for buttons/menus */
}

#nerd-menu-toggle {
    font-size: 1.5em;
    padding: 0.06em 0.22em;
    line-height: 1;
    background: rgba(1,40,50,0.88);
    border: 2.5px solid #0ff8;
    border-radius: 0.53em;
    padding: 0.12em 0.6em;
    box-shadow: 0 0 8px #0ff4;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    outline: none;
    transition: background 0.18s, box-shadow 0.18s;
}

#nerd-menu-toggle:focus,
#nerd-menu-toggle:hover {
    background: rgba(0,255,255,0.13);
    box-shadow: 0 0 15px #0ffb;
}

#nerd-menu-list {
    display: none;
    background: rgba(0,12,24,0.95);
    color: var(--accent);
    border: 1.4px solid var(--accent);
    border-radius: 0.6em;
    font-family: 'Orbitron', monospace;
    font-size: 1.04em;
    margin-top: 0.35em;
    padding: 1em 1.6em;
    min-width: 15em;
    text-align: left;
    box-shadow: 0 2px 16px #0ff2;
    letter-spacing: 0.03em;
}

#nerd-menu-list code {
    background: rgba(0,255,255,0.1);
    border-radius: 0.18em;
    padding: 0.05em 0.23em;
    font-size: 1em;
    color: #fff;
    margin-right: 0.7em;
}

/* ==========================================================================
   9. Footer
   ========================================================================== */
#footer-bar {
    position: relative; /* Scrolls with content */
    margin-top: auto;
    width: 100%;

    background: rgba(0,16,32,0.8);
    backdrop-filter: blur(5px);

    color: var(--accent);
    font-family: 'Orbitron', Arial, monospace;
    font-size: 1em;
    letter-spacing: 0.01em;
    text-align: center;

    padding: 0.42em 1.2em 0.22em 1.2em;
    box-sizing: border-box;

    z-index: 100002; /* Must be higher than canvases */
    box-shadow: 0 0 22px #0ff3;
    pointer-events: auto;
    cursor: none;
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    margin: 0 0.7em;
    font-weight: 500;
    opacity: 0.97;
    transition: color 0.16s;
}

.footer-link:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-sep {
    color: #0ff8;
    opacity: 0.77;
    margin: 0 0.18em;
    font-size: 1.08em;
}

.footer-hint {
    color: #fff9;
    font-size: 0.95em;
    margin-top: 0.13em;
    letter-spacing: 0.03em;
}

/* ==========================================================================
   10. Legal Pages
   ========================================================================== */
html:has(body.legal) {
    height: auto;
    overflow: auto;
}

body.legal {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    width: auto;
    max-width: 700px;
    margin: 3em auto;
    padding: 2em;
    background: #010c12;
    color: #19e9d7;
    border-radius: 1em;
    box-shadow: 0 0 22px #0ff4;
}

body.legal h1 { color: #19e9d7; }
body.legal a { color: #f6ffff; }
body.legal .small { font-size: 0.95em; color: #0ff7; margin-top: 1.2em; }

/* ==========================================================================
   11. Media Queries
   ========================================================================== */
@media (pointer: coarse), (max-width: 650px) {
    #nerd-menu { display: none !important; }
}

@media (max-width: 700px), (max-height: 500px) {
    /* Coordinate System Adjustments */
    .axis-x {
        top: auto; bottom: -.3em;
        left: -1.2em; right: -1.2em;
        height: 0.28em;
    }
    .axis-y {
        top: -1.2em; bottom: -1.8em;
        left: 29%;
        width: 0.28em;
    }
    .origin-zero {
        bottom: .2em; left: 32.25%;
        font-size: 0.66em;
    }

    /* Typography Scaling */
    .quad { font-size: clamp(2.5em, 15vw, 6em); }
    #subtitle {
        margin-top: 1em; margin-bottom: 0.5em;
        font-size: clamp(0.5em, 4vw, 1.5em);
        line-height: 1.2;
    }
    #slogan {
        margin-top: 0.5em;
        font-size: clamp(0.6em, 3.5vw, 1.2em);
        line-height: 1.3;
    }

    /* Layout Adjustments */
    #center-wrapper {
        min-width: 85vw;
        max-width: 98vw;
        top: auto;
        transform: none;
        padding-top: 0.2em;
        margin-bottom: 2em;
    }

    /* Footer Adjustments */
    .footer-hint { font-size: 0.8em; margin-top: 0.2em; }
    .footer-link { font-size: 0.9em; margin: 0 0.5em; }
    .footer-sep { font-size: 0.8em; margin: 0 0.2em; }
}

/* Optimization for Vertical Space (Tablets Portrait / Short screens) */
@media (max-height: 850px) {
    #center-wrapper {
        padding-top: clamp(1em, 2vw, 2em);
    }
    #services-section {
        margin-top: 1rem;
        padding-top: 1em; padding-bottom: 1em;
    }
    #cta-terminal {
        margin-top: 1em; margin-bottom: 1em;
    }
    #identity-links {
        margin-top: 1em; margin-bottom: 1.5em;
    }
    #subtitle {
        margin-top: 1em;
    }
    #slogan {
        margin-top: 1em;
    }
}
