:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --accent: #10b981;
    --secondary: #666666;
    --card-bg: #fafafa;
    --card-inner: #ffffff;
    --header-start: #f0f7ff;
    --header-end: #ffffff;
    --border: #eeeeee;
    --contact-bg: #1a1a1a;
    --contact-text: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] {
    --bg: #02010a; /* Jeszcze głębsza czerń/granat */
    --text: #e0e6ed; /* Chłodna biel */
    --accent: #34d399;
    --secondary: #a0a0c0; /* Szaro-niebieski */
    --card-bg: #050314; /* Tło sekcji */
    --card-inner: linear-gradient(145deg, #100860, #0a0440); /* Subtelny gradient Indygo */
    --header-start: #0d0652;
    --header-end: #02010a;
    --border: #1e1e50; /* Dopasowana, ciemniejsza ramka */
    --contact-bg: #02010a;
    --contact-text: #e0e6ed;
    --nav-bg: rgba(13, 6, 82, 0.25); /* Przezroczyste szkło (Glassmorphism) */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--bg);
    transition: background-color 0.8s ease, color 0.3s ease;
}

h1, h2, h3 {
    font-family: 'Montserrat', sans-serif;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }

header {
    padding: 40px 0 100px 0;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://images.unsplash.com/photo-1555066931-4365d14bab8c?q=80&w=1920&auto=format&fit=crop');
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    color: #ffffff;
    transition: background 0.3s ease;
}

nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 80px; position: sticky; top: 0; z-index: 1000; transition: all 0.3s ease; flex-wrap: wrap; }

nav.scrolled {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 15px 20px;
    border-radius: 0 0 15px 15px;
    margin-top: -40px; /* Kompensacja paddingu headera, aby przykleiło się do samej góry */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Szklana ramka */
    border-top: none;
}

.logo { font-weight: 700; font-size: 1.2rem; color: var(--accent); }

.hero-content h1 { font-size: 3rem; line-height: 1.1; margin-bottom: 20px; color: #ffffff; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.hero-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-side-text {
    text-align: right;
    font-family: 'Montserrat', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.15); /* Efekt znaku wodnego */
    text-transform: uppercase;
    user-select: none;
    transition-delay: 0.5s;
}

/* Efekt Glitch */
.glitch-text {
    color: var(--accent);
    position: relative;
    display: inline-block;
}

.glitch-text:hover::before,
.glitch-text:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.glitch-text:hover::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1; /* Magenta */
    clip-path: inset(0 0 0 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch-text:hover::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9; /* Cyan */
    clip-path: inset(0 0 0 0);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); }
    20% { clip-path: inset(60% 0 10% 0); }
    40% { clip-path: inset(40% 0 50% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(10% 0 70% 0); }
    100% { clip-path: inset(30% 0 20% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); }
    20% { clip-path: inset(30% 0 20% 0); }
    40% { clip-path: inset(10% 0 80% 0); }
    60% { clip-path: inset(70% 0 10% 0); }
    80% { clip-path: inset(50% 0 30% 0); }
    100% { clip-path: inset(0% 0 90% 0); }
}

/* Kursor maszyny do pisania */
.hero-content h1::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent);
    margin-left: 4px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #ffffff;
}
.hero-content p { font-size: 1.25rem; color: #e0e0e0; margin-bottom: 30px; max-width: 600px; }

.btn-main {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

.btn-sm { text-decoration: none; color: var(--accent); font-weight: 600; border: 1px solid var(--accent); padding: 8px 16px; border-radius: 6px; transition: background-color 0.3s, color 0.3s; background-color: transparent; cursor: pointer; font-family: inherit; }

.btn-sm:hover {
    background-color: var(--accent);
    color: white;
}

#theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin-right: 10px;
    transition: transform 0.5s ease;
}

[data-theme="dark"] #theme-toggle {
    transform: rotate(360deg);
}

#share-btn {
    margin-right: 10px;
}

.about { padding: 80px 0; border-top: 1px solid var(--border); transition: border-color 0.3s ease; }
.about h2 { margin-bottom: 20px; }

.stats { padding: 60px 0; background: var(--card-bg); text-align: center; transition: background-color 0.3s ease; }
.stats-grid { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 30px; margin-top: 20px; }
.stat-item { flex: 1; min-width: 200px; }
.stat-number { font-size: 3rem; font-weight: 700; color: var(--accent); font-family: 'Montserrat', sans-serif; margin-bottom: 10px; }
.stat-item p { font-size: 1.1rem; color: var(--secondary); }

.services { padding: 60px 0; background: var(--card-bg); transition: background-color 0.3s ease; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.card { background: var(--card-inner); padding: 30px; border-radius: 12px; border: 1px solid var(--border); transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease; }
.card:hover { transform: translateY(-10px); box-shadow: 0 12px 20px rgba(0,0,0,0.1), 0 0 15px var(--accent); border-color: var(--accent); }
.card h3 { margin-bottom: 15px; color: var(--accent); }

.portfolio { padding: 80px 0; }
.portfolio-links p { margin: 10px 0; font-size: 1.1rem; }

/* Custom Tooltip (Dymek z opisem) - Uogólniona klasa */
.custom-tooltip {
    position: relative;
    display: inline-block;
}

.custom-tooltip::before, .custom-tooltip::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Efekt sprężystości */
    pointer-events: none;
    z-index: 1100; /* Wyższy index, aby było nad menu */
}

/* Tekst dymka */
.custom-tooltip::after {
    content: attr(data-tooltip);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 12px;
}

/* Strzałka dymka */
.custom-tooltip::before {
    content: '';
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: #333;
    margin-bottom: 0px;
}

/* Efekt hover - pokazanie dymka */
.custom-tooltip:hover::before, .custom-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.contact { padding: 100px 0; text-align: center; background: var(--contact-bg); color: var(--contact-text); transition: background-color 0.3s ease, color 0.3s ease; }
.contact h2 { margin-bottom: 20px; }
.contact-details { margin-top: 30px; font-size: 1.2rem; }
.contact-details a { color: var(--contact-text); text-decoration: underline; }

.contact-form { max-width: 600px; margin: 30px auto 0; display: flex; flex-direction: column; gap: 15px; text-align: left; }
.contact-form input, .contact-form textarea { width: 100%; padding: 15px; border: none; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.contact-form button { border: none; cursor: pointer; font-size: 1rem; transition: opacity 0.3s; }
.contact-form button:disabled { opacity: 0.7; cursor: not-allowed; }

footer { padding: 40px; text-align: center; font-size: 0.9rem; color: #999; display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
footer a { color: var(--accent); text-decoration: none; }

.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-section.slide-in-right {
    transform: translateX(100px);
}

.fade-in-section.slide-in-right.is-visible {
    transform: translateX(0);
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    z-index: 2000;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    transform: translateY(100%);
    transition: transform 0.5s ease-out;
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner p { max-width: 800px; font-size: 0.9rem; margin: 0; }
.cookie-buttons { display: flex; gap: 10px; }

@media (max-width: 600px) {
    .hero-content h1 { font-size: 2.2rem; }

    .menu-toggle { display: block; }

    nav.scrolled .menu-toggle { color: var(--text); }

    .nav-links {
        display: flex;
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        margin-top: 0;
        padding-bottom: 0;
        transition: all 0.4s ease-in-out;
    }

    .nav-links.active {
        max-height: 500px;
        opacity: 1;
        margin-top: 20px;
        padding-bottom: 20px;
    }

    #theme-toggle, #share-btn { margin-right: 0; }
    .scroll-top-btn { display: none !important; }
}

@media (max-width: 900px) {
    .hero-side-text { display: none; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Potwierdzenie wysłania formularza */
.form-success {
    text-align: center;
    padding: 40px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 2px solid var(--accent);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.form-success h3 { color: var(--accent); margin-bottom: 15px; font-size: 1.8rem; }
.form-success p { color: var(--text); font-size: 1.1rem; }

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* Animacja błędu walidacji (Shake) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    border: 1px solid #e74c3c !important; /* Czerwona ramka błędu */
}

/* Efekt lupy dla wersji w stopce */
#version-text {
    display: inline-block;
    cursor: default;
}

#version-text span {
    display: inline-block;
    transition: transform 0.15s ease-out, color 0.15s ease-out, text-shadow 0.15s ease-out;
    will-change: transform;
}

#version-text span.magnified {
    transform: scale(1.8); /* Powiększenie x1.8 */
    color: var(--accent);
    text-shadow: 0 5px 10px rgba(0,0,0,0.2);
    font-weight: 700;
}