:root {
    --bg-color: #050510; /* Lekki odcień ciemnego fioletu/granatu dla lepszego kontrastu z modelem */
    --text-color: #ffffff;
    --primary-color: #00f0ff; /* Neon Cyan */
    --secondary-color: #7000ff; /* Deep purple */
    --accent-color: #ff003c; /* Accent red */
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.06);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Ambient glow - rozjaśniony by model lepiej odcinał się od tła */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200vw;
    height: 200vh;
    background: radial-gradient(circle at 30% 70%, rgba(112, 0, 255, 0.25) 0%, transparent 40%),
                radial-gradient(circle at 70% 30%, rgba(0, 240, 255, 0.15) 0%, transparent 40%);
    z-index: -2;
    pointer-events: none;
    animation: ambientShift 15s infinite alternate ease-in-out;
}

@keyframes ambientShift {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(-3%, 3%); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: rgba(3, 3, 3, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 3rem;
}

.nav-links a {
    color: #ccc;
    text-decoration: none;
    font-weight: 400;
    font-size: 1.1rem;
    transition: color 0.3s;
    position: relative;
    padding-bottom: 5px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background: var(--primary-color);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

.nav-links a:hover {
    color: #fff;
}

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

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 4rem;
    position: relative;
}

.hero-content {
    flex: 1;
    z-index: 20; /* Wyżej niż oba modele 3D */
    max-width: 600px;
    margin-top: -5vh; /* Slight optical adjustment */
    pointer-events: none; /* Let events pass to the 3D canvas behind */
}

.hero-content * {
    pointer-events: auto; /* Re-enable events for buttons and text selection */
}

/* Tech Text Styling */
.hero h1 {
    font-size: clamp(3.5rem, 6vw, 6rem);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    color: #fff;
}

.glitch {
    position: relative;
    /* Przezroczyste tło, by nie zasłaniał robota */
    background: transparent;
}

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    -webkit-text-fill-color: transparent;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--accent-color);
    clip: rect(24px, 1200px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
    z-index: -1;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--primary-color);
    clip: rect(85px, 1200px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
    z-index: -2;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 86px, 0); }
    10% { clip: rect(41px, 9999px, 8px, 0); }
    20% { clip: rect(31px, 9999px, 93px, 0); }
    100% { clip: rect(100px, 9999px, 10px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 100px, 0); }
    10% { clip: rect(52px, 9999px, 74px, 0); }
    20% { clip: rect(79px, 9999px, 85px, 0); }
    100% { clip: rect(10px, 9999px, 120px, 0); }
}

.hero-description {
    position: absolute;
    right: 15%; /* Tak samo wysunięte jak kostka .hero-cube */
    top: calc(40% + 30vh + 1rem); /* Równomierne podniesienie w ślad za kostką, zachowując przestrzeń na to, by zajmował dół a dół "wymuszał" scrollowanie */
    width: 35vw; /* Ta sama szerokość co kostka */
    max-width: 450px;
    z-index: 20; /* Na wierzchu nad modelami 3D */
    pointer-events: auto;
}

.hero-description .subtitle {
    font-size: 1.15rem;
    color: #bbb;
    margin-bottom: 0;
    max-width: 100%;
    font-weight: 300;
}

.hero-description strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Spline 3D Container dla Hero (Robot) */
.hero-3d {
    position: absolute;
    right: 0; /* Odsunięcie robota od napisu */
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: auto;
    overflow: hidden; /* Odcina elementy wewnątrz, np. tagi */
}

/* Spline 3D Container dla Hero (Szklana Kostka) */
.hero-cube {
    position: absolute;
    right: 15%; /* Tak jak wcześniej logo */
    top: 40%; /* Podniesione trochę do góry */
    transform: translateY(-50%);
    width: 35vw;
    height: 60vh;
    max-width: 450px;
    z-index: 1; /* Pund ponad robotem, ale pod tekstem */
    pointer-events: auto;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5));
    border-radius: 20px;
    overflow: hidden; /* Odcina elementy w iframe, np. logo, które stąd wychodzi */
}

/* Powiększamy iframe by logo zsunęło się poza krawędzie, minimalizując destrukcję układu */
.hero-cube iframe {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    outline: none;
    border: none;
}

.hero-3d spline-viewer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% + 80px); /* Poszerzamy tylko w dół by ukryć logo, bez psucia skalowania szerokości */
    outline: none;
    border: none;
}

/* Dodatkowa próba ukrycia logo Spline przez atrybuty web-component z regułami ShadowDOM jeśli zadziała */
spline-viewer::part(logo) {
    display: none !important;
}

/* Spinner */
.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    z-index: 5;
    transition: opacity 0.5s ease;
}

@keyframes spin { 
    to { transform: translate(-50%, -50%) rotate(360deg); } 
}

/* Button */
.cta-button {
    display: inline-block;
    padding: 1.2rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #030303;
    background: var(--primary-color);
    text-decoration: none;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 10;
    border: none;
    cursor: pointer;
}

.cta-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.8), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
    z-index: -1;
}

.cta-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.6);
    background: #00ffff;
}

.cta-button:hover::after {
    opacity: 1;
    left: 100%;
    top: 100%;
}

/* Sections */
.about, .contact {
    padding: 6rem 0;
    position: relative;
    z-index: 10;
}

/* Glass Panels */
.glass-panel {
    background: rgba(10, 10, 15, 0.7); /* Zmiana na twardy kolor tła z pzrezroczystością bez blura dla wydajności */
    border: 1px solid var(--glass-border);
    /* Usunięcie backdrop-filter: blur(20px) - główne źródło input-lagów formularza! */
    border-radius: 30px;
    padding: 5rem 4rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    will-change: transform, opacity; /* Wskazówka dla GPU przy scroll animations */
}

/* Scroll Reveal Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s cubic-bezier(0.165, 0.84, 0.44, 1), transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.glass-panel h2 {
    font-size: 3.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -1px;
}

.about-text > p, .glass-panel > p {
    font-size: 1.3rem;
    color: #aaa;
    max-width: 800px;
    margin-bottom: 4rem;
}

/* About Grid Layout */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-3d {
    width: 100%;
    height: 600px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.about-3d iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Features inside About */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.feature-card {
    background: rgba(255,255,255, 0.01);
    padding: 3rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(0, 240, 255, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.1);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.6rem;
    font-weight: 600;
}

.feature-card p {
    color: #999;
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 700px;
}

.input-group {
    position: relative;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 1.5rem 1rem 0.5rem;
    background: rgba(3, 3, 5, 0.4); /* Wstawiono czarne lekko przezroczyste tło */
    border: none;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    color: var(--text-color);
    font-size: 1.2rem;
    font-family: inherit;
    transition: all 0.3s;
    outline: none;
    border-radius: 8px 8px 0 0; /* Górne zaokrąglenie wlotu */
}

.input-group label {
    position: absolute;
    top: 1rem;
    left: 0;
    color: #777;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.2rem;
}

.input-group input:focus,
.input-group textarea:focus {
    border-bottom-color: var(--primary-color);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:not(:placeholder-shown) ~ label {
    top: -1.8rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

.contact-form button {
    align-self: flex-start;
    margin-top: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem;
    border-top: 1px solid var(--glass-border);
    color: #555;
    background: rgba(0,0,0,0.5);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.5;
    transition: opacity 0.3s;
    z-index: 10;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-indicator span {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    color: #999;
}

.mouse {
    width: 24px;
    height: 38px;
    border: 2px solid #777;
    border-radius: 15px;
    position: relative;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 2px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 1.5s infinite;
}

@keyframes scroll {
    0% { top: 6px; opacity: 1; }
    100% { top: 20px; opacity: 0; }
}

/* Responsive */
@media (max-width: 1024px) {
    .hero h1 { font-size: 4rem; }
    .hero-3d { width: 50%; }
    .glass-panel { padding: 4rem 3rem; }
}

@media (max-width: 768px) {
    .navbar { padding: 1.5rem; }
    .nav-links { display: none; } /* Hamburger in next version */
    .hero { flex-direction: column; padding: 6rem 1.5rem 2rem; text-align: center; }
    .hero-content { max-width: 100%; margin-top: 10vh; }
    .hero-3d { position: absolute; width: 100%; height: 60%; bottom: 0; right: 0; top: auto; opacity: 0.8; z-index: 0; pointer-events: none; }
    .hero-cube { width: 50vw; height: 35vh; top: auto; bottom: 25%; right: 5%; transform: none; }
    .hero-description { width: 90vw; top: auto; bottom: 5%; right: 5%; text-align: right; }
    .hero-description .subtitle { font-size: 0.95rem; }
    .hero-3d::before { background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%); width: 100%; height: 30%; bottom: 0; top: auto; }
    .hero h1 { font-size: 3.5rem; }
    .subtitle { margin: 0 auto 2rem; }
    .scroll-indicator { left: 50%; transform: translateX(-50%); bottom: 20px; }
    .glass-panel { padding: 3rem 1.5rem; margin: 2rem 0; border-radius: 15px; }
    .glass-panel h2 { font-size: 2.5rem; }
}
