/* ======== BOLD & FUNKY UI - PRECIBEL.COM ======== */
:root {
    /* Cyber-Punk Color Palette */
    --neon-green: #00ff88;
    --neon-pink: #ff00ff;
    --neon-cyan: #00ffff;
    --neon-yellow: #fff200;
    --dark-bg: #121418; /* Charcoal background */
    --card-bg: rgba(30, 34, 40, 0.8);
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    
    --primary-glow: 0 0 10px var(--neon-green), 0 0 20px rgba(0, 255, 136, 0.3);
    --pink-glow: 0 0 10px var(--neon-pink), 0 0 20px rgba(255, 0, 255, 0.3);
    --cyan-glow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 255, 255, 0.3);
    
    --font-heading: 'Syncopate', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-body: 'Inter', sans-serif;
}

/* Import Modern Fonts */
@import url('https://fonts.googleapis.com/css2?family=Syncopate:wght@400;700&family=JetBrains+Mono:wght@400;700&family=Inter:wght@300;400;700&display=swap');

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    background: var(--dark-bg);
}

body {
    font-family: var(--font-body);
    color: var(--text-main);
    line-height: 1.6;
    background-color: var(--dark-bg);
    overflow-x: hidden;
}

/* Grid Background */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 136, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 4px;
}

.tech-heading {
    color: var(--text-main);
    text-shadow: 2px 2px var(--neon-pink), -2px -2px var(--neon-cyan);
}

/* Glitch Effects Re-Enabled */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-bg);
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 var(--neon-pink);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 var(--neon-cyan);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    20% { clip: rect(62px, 9999px, 42px, 0); }
    100% { clip: rect(89px, 9999px, 98px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(10px, 9999px, 85px, 0); }
    100% { clip: rect(50px, 9999px, 30px, 0); }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.navbar.scrolled {
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid var(--neon-green);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--neon-green);
    text-decoration: none;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--neon-pink);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 10%;
    position: relative;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 0.9;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.hero-subtitle {
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    font-size: 1.2rem;
    margin-bottom: 3rem;
    max-width: 600px;
}

/* Buttons */
.btn-funky {
    padding: 1.5rem 3rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    background: transparent;
    color: var(--neon-green);
    border: 2px solid var(--neon-green);
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-funky::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--neon-green);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: -1;
}

.btn-funky:hover {
    color: var(--dark-bg);
    box-shadow: var(--primary-glow);
}

.btn-funky:hover::before {
    left: 0;
}

/* Sections */
section {
    padding: 10rem 10%;
    position: relative;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 5rem;
    border-left: 10px solid var(--neon-pink);
    padding-left: 2rem;
}

/* Grid Layout */
.funky-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 4rem;
}

.funky-card {
    background: var(--card-bg);
    padding: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    transition: all 0.5s;
    overflow: hidden;
}

.funky-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    background: var(--neon-green);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    opacity: 0.3;
}

.funky-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--neon-green);
    box-shadow: var(--primary-glow);
}

.funky-card h3 {
    color: var(--neon-cyan);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.funky-card p {
    color: var(--text-dim);
    font-size: 1rem;
}

/* Oscilloscope / Data Viz Element */
.data-viz {
    width: 100%;
    height: 150px;
    border-bottom: 1px solid rgba(0, 168, 107, 0.1);
    position: relative;
    margin-top: 6rem;
    cursor: pointer; /* Indication for hover */
}

.data-viz:hover .wave {
    animation-duration: 0.5s;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path d="M0,50 Q250,0 500,50 T1000,50" fill="none" stroke="%2300ff88" stroke-width="2"/></svg>');
    background-size: 1000px 100%;
    animation: wave-anim 2s linear infinite;
}

@keyframes wave-anim {
    from { background-position-x: 0; }
    to { background-position-x: 1000px; }
}

/* Footer */
footer {
    padding: 5rem 10%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-family: var(--font-mono);
    color: var(--text-dim);
}

footer span {
    color: var(--neon-pink);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero h1 { font-size: 3.5rem; }
    .section-title { font-size: 2rem; }
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-top: 0.25rem;
    flex-shrink: 0;
    accent-color: var(--primary-color);
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 400;
    line-height: 1.5;
    cursor: pointer;
}

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* Enhanced Contact Grid */
.contact-grid {
    gap: 3rem;
}

.contact-details {
    background: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-subtle);
}

.form-container {
    background: var(--card-bg-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-subtle);
}

/* Responsive Form Styles */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .form-container,
    .contact-details {
        padding: 1.5rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem;
    }
}
.contact-details strong {
    color: var(--white);
    font-family: var(--font-family-heading);
}
.contact-details a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.contact-details a:hover {
    color: var(--primary-color);
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

/* ======== CLIENT LOGOS ======== */
.client-logos {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    align-items: stretch;
}

.logo-box {
    background: var(--body-bg-color);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.logo-box:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
    background: var(--card-bg-alt);
}

.logo-box img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(100%) opacity(0.6);
    transition: all 0.3s ease;
}

.logo-box:hover img {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.05);
}

/* ======== PROJECT BADGES ======== */
.project-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-family-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-badge.testing {
    background-color: rgba(0, 255, 136, 0.15);
    color: var(--primary-light);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

.project-badge.research {
    background-color: rgba(255, 193, 7, 0.15);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.2);
}

.project-badge.development {
    background-color: rgba(100, 181, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.2);
}

/* ======== ACCESSIBILITY IMPROVEMENTS ======== */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: #000;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-color: #ffffff;
        --body-bg-color: #000000;
        --card-bg-color: #1a1a1a;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ======== IMAGE ERROR HANDLING ======== */
img {
    transition: opacity 0.3s ease;
}

/* Image error handling is handled via JavaScript if needed */

/* ======== RESPONSIVE DESIGN (MOBILE-FIRST) ======== */

@media (max-width: 1024px) {
    .grid-col-3 {
        grid-template-columns: 1fr 1fr;
    }
    .grid-col-4 {
        grid-template-columns: 1fr 1fr;
    }
    .client-logos {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 80px; /* Ensure content isn't hidden */
    }
    
    h1 { font-size: 2.5rem; }
    h2, .section-title { font-size: 1.8rem; }
    
    section { padding: 4rem 0; }
    
    .grid-col-2,
    .grid-col-3,
    .grid-col-4 {
        grid-template-columns: 1fr; /* Stack all grids on mobile */
    }
    
    .client-logos {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .logo-box {
        height: 120px;
    }

    .home-about img {
        grid-row: 1; /* Make image appear on top */
        margin-bottom: 2rem;
    }
    
    /* Contact page grid swap */
    .contact-grid .form-container {
        grid-row: 1; /* Form on top */
    }

    /* --- Mobile Navigation --- */
    .nav-links {
        position: fixed;
        top: 80px; /* Below navbar */
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--card-bg-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem;
        
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
    }
    
    .nav-open .nav-links {
        transform: translateX(0);
    }
    
    .nav-links a {
        font-size: 1.2rem;
        width: 100%;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-links .btn {
        margin-top: 1rem;
        width: 100%;
        text-align: center;
    }
    
    .nav-toggle {
        display: block; /* Show hamburger */
    }

    /* Animate hamburger to 'X' */
    .nav-open .hamburger {
        background: transparent;
    }
    .nav-open .hamburger::before {
        background: var(--white);
        transform: rotate(45deg) translate(5px, 5px);
    }
    .nav-open .hamburger::after {
        background: var(--white);
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    .hero {
        padding: 4rem 0;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero .btn {
        display: block;
        width: 100%;
        margin: 1rem 0;
    }

    .footer .grid-col-4 {
        gap: 3rem;
    }
    
    /* Mobile Table Styles */
    .tech-table, .tech-table thead, .tech-table tbody, .tech-table th, .tech-table td, .tech-table tr {
        display: block;
    }
    
    .tech-table thead {
        display: none; /* Hide table header on mobile */
    }
    
    .tech-table tr {
        border: 1px solid var(--border-color);
        margin-bottom: 1rem;
        border-radius: 4px;
        background: var(--card-bg-color);
    }
    
    .tech-table td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%; /* Make space for label */
        background: transparent;
    }
    
    .tech-table td:before {
        /* Use data-label for mobile view */
        position: absolute;
        left: 1rem;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 700;
        color: var(--white);
        font-family: var(--font-family-heading);
        content: attr(data-label);
    }
    
    .tech-table tr:last-child td:last-child {
        border-bottom: none;
    }
}