/* ═══════════════════════════════════════════════════════════════
   RAPID-PCB — Design System & Global Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --primary-glow: rgba(57, 255, 20, 0.5);
    --secondary-glow: rgba(0, 243, 255, 0.3);
    --neon-green: #39ff14;
    --electric-cyan: #00f3ff;
    --deep-black: #000000;
    --surface-dark: #131313;
    --surface-card: rgba(17, 17, 17, 0.7);
    --border-subtle: #2A2A2A;
    --text-primary: #e5e2e1;
    --text-muted: #baccb0;
    --gold: #ffd700;

    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--neon-green) #0e0e0e;
}

html::-webkit-scrollbar {
    width: 6px;
}
html::-webkit-scrollbar-track {
    background: #0e0e0e;
}
html::-webkit-scrollbar-thumb {
    background: var(--neon-green);
    border-radius: 3px;
}

body {
    background-color: var(--deep-black);
    background-image: radial-gradient(#111 1px, transparent 1px);
    background-size: 32px 32px;
    color: var(--text-primary);
    overflow-x: hidden;
    font-family: 'Inter', sans-serif;
}

/* ── Loading Screen ── */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--deep-black);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-ring {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    border-top-color: var(--neon-green);
    border-radius: 50%;
    animation: loaderSpin 1s linear infinite;
    position: relative;
}

.loader-ring::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 3px solid transparent;
    border-top-color: var(--electric-cyan);
    border-radius: 50%;
    animation: loaderSpin 0.6s linear infinite reverse;
}

@keyframes loaderSpin {
    to { transform: rotate(360deg); }
}

.loader-text {
    margin-top: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.15em;
    color: var(--neon-green);
    animation: loaderBlink 1.2s steps(2) infinite;
}

@keyframes loaderBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── Scroll Progress Bar ── */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-green), var(--electric-cyan));
    z-index: 9998;
    transition: width 0.05s linear;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ── Glass Surface ── */
.glass-surface {
    background: var(--surface-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    transition: all 0.3s var(--ease-smooth);
}

.glass-surface:hover {
    border-color: rgba(57, 255, 20, 0.3);
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.05);
    transform: translateY(-2px);
}

/* ── Circuit Border Corners ── */
.circuit-border {
    position: relative;
}

.circuit-border::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 12px;
    height: 12px;
    border-top: 2px solid var(--neon-green);
    border-left: 2px solid var(--neon-green);
    transition: all 0.3s ease;
}

.circuit-border::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-bottom: 2px solid var(--neon-green);
    border-right: 2px solid var(--neon-green);
    transition: all 0.3s ease;
}

.circuit-border:hover::before {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

.circuit-border:hover::after {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

/* ── Neon Pulse Nodes ── */
.neon-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(57, 255, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0); }
}

/* ── Scroll Reveal ── */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s var(--ease-spring), transform 1.2s var(--ease-spring);
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 1s var(--ease-spring), transform 1s var(--ease-spring);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 1s var(--ease-spring), transform 1s var(--ease-spring);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s var(--ease-spring), transform 0.8s var(--ease-spring);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Staggered children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-spring), transform 0.6s var(--ease-spring);
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: translateY(0); }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }

/* ── Marquee ── */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-flex;
    animation: marquee 30s linear infinite;
}

.marquee-content:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ── 3D PCB Canvas ── */
#pcb-canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ── Technical Grid Background ── */
@keyframes slowRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.technical-grid-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200vw;
    height: 200vh;
    background-image:
        linear-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(57, 255, 20, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(57, 255, 20, 0.02) 2px, transparent 2px),
        linear-gradient(90deg, rgba(57, 255, 20, 0.02) 2px, transparent 2px);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
    animation: slowRotate 120s linear infinite;
    z-index: -1;
    pointer-events: none;
}

/* ── Hero Typed Text Cursor ── */
.typed-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--neon-green);
    margin-left: 4px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s steps(2) infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── Hero Floating Particles ── */
#particle-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ── Stats Counter ── */
.stat-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 48px;
    font-weight: 700;
    color: var(--neon-green);
    line-height: 1;
    text-shadow: 0 0 20px var(--primary-glow);
}

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
}

.stat-divider {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--border-subtle), transparent);
}

/* ── Service Card Left Border Glow ── */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--neon-green);
    box-shadow: 0 0 15px var(--primary-glow);
}

.service-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.03), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.service-card:hover::after {
    opacity: 1;
}

/* ── Timeline ── */
.timeline-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--neon-green), transparent);
}

.timeline-node {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--neon-green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--deep-black);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    z-index: 10;
    position: relative;
    flex-shrink: 0;
}

/* ── Sector Card ── */
.sector-card {
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--ease-smooth);
}

.sector-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: height 0.3s ease;
}

.sector-card:hover {
    transform: translateY(-4px);
}

.sector-card:hover::after {
    height: 6px;
    box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
}

.sector-card.green::after {
    background: var(--neon-green);
}

.sector-card.cyan::after {
    background: var(--electric-cyan);
}

/* ── Form Styling ── */
.form-input {
    width: 100%;
    background: var(--deep-black);
    border: none;
    border-bottom: 1px solid #555;
    color: white;
    padding: 14px 0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    transition: border-color 0.3s ease;
    outline: none;
}

.form-input:hover {
    border-bottom-color: var(--neon-green);
}

.form-input:focus {
    border-bottom-color: var(--neon-green);
    box-shadow: 0 1px 0 0 var(--neon-green);
}

.form-input::placeholder {
    color: #555;
}

.form-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: #79ff5b;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-submit-btn {
    width: 100%;
    background: var(--neon-green);
    color: var(--deep-black);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 16px;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.form-submit-btn:hover {
    box-shadow: 0 0 25px var(--primary-glow);
    transform: translateY(-1px);
}

.form-submit-btn:active {
    transform: translateY(0);
}

.form-submit-btn .btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* ── Back to Top ── */
#back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: var(--surface-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neon-green);
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s var(--ease-smooth);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    border-color: var(--neon-green);
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-3px);
}

/* ── Mobile Hamburger ── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    z-index: 60;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: var(--neon-green);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: var(--neon-green);
}

/* ── Mobile Nav Panel ── */
.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s var(--ease-smooth);
}

.mobile-nav.open {
    opacity: 1;
    visibility: visible;
}

.mobile-nav a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.mobile-nav a:hover,
.mobile-nav a.active-link {
    color: var(--neon-green);
}

/* ── Utility: Section Anchor Offset ── */
section[id] {
    scroll-margin-top: 80px;
}

/* ── Cursor Glow (Desktop Only) ── */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(57, 255, 20, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .stat-number {
        font-size: 32px;
    }

    .stat-divider {
        width: 40px;
        height: 1px;
        background: linear-gradient(to right, transparent, var(--border-subtle), transparent);
    }

    .cursor-glow {
        display: none;
    }

    .timeline-line {
        left: 24px;
    }
}

@media (max-width: 480px) {
    .stat-number {
        font-size: 28px;
    }
}

/* ── Glow button pulse ── */
.glow-btn {
    position: relative;
    overflow: hidden;
}

.glow-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--neon-green), var(--electric-cyan), var(--neon-green));
    opacity: 0;
    z-index: -1;
    border-radius: inherit;
    transition: opacity 0.4s ease;
    filter: blur(8px);
}

.glow-btn:hover::before {
    opacity: 0.6;
}

/* ── Floating badge animation ── */
.float-badge {
    animation: floatBadge 3s ease-in-out infinite;
}

@keyframes floatBadge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ── Nav active indicator ── */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--neon-green);
    transition: width 0.3s var(--ease-smooth);
}

.nav-link:hover::after,
.nav-link.active-link::after {
    width: 100%;
}

/* ── 3D PCB Hover Tooltip ── */
#pcb-tooltip {
    pointer-events: none;
    position: absolute;
    z-index: 100;
    transition: opacity 0.2s ease, transform 0.1s ease;
    transform: translate(-50%, -125%);
    background: rgba(14, 14, 14, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(57, 255, 20, 0.4);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.2);
    min-width: 180px;
    will-change: transform, opacity;
}

