/* ==========================================
   1. VARIABLES & THEMING
   ========================================== */
:root {
    --bg-primary: #0f172a;
    --bg-glass: rgba(15, 23, 42, 0.45); 
    --bg-card: rgba(0, 0, 0, 0.2); 
    --bg-element: #0f172a; 
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #10b981;
    --accent-hover: #059669;
    --accent-faded: rgba(16, 185, 129, 0.1);
    --border-color: rgba(255, 255, 255, 0.08); 
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

body.light-mode {
    --bg-primary: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.6); 
    --bg-card: #f8fafc;
    --bg-element: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-faded: rgba(37, 99, 235, 0.08);
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
}

/* Language Toggle Logic */
:lang(pl) .lang-en { display: none !important; }
:lang(en) .lang-pl { display: none !important; }

/* ==========================================
   2. RESET & BASE LAYOUT (SPA)
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    height: 100dvh;
    overflow: hidden; 
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==========================================
   3. BACKGROUND EFFECTS
   ========================================== */
.bg-filler {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--bg-primary);
    background-image: radial-gradient(circle at 85% 15%, var(--accent-faded) 0%, transparent 60%);
}

/* ==========================================
   4. TYPOGRAPHY & UTILITIES
   ========================================== */
.section-desc {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 40px;
    letter-spacing: 0.3px;
    opacity: 0.9; 
}

.section-title::after {
    content: "";
    height: 1px;
    flex-grow: 1;
    background-color: var(--border-color);
    margin-left: 20px;
}

.section-title + p {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 40px;
    letter-spacing: 0.3px;
    opacity: 0.9; 
}

body.light-mode .section-desc {
    font-weight: 600;
}

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s;
    border: none;
}

.btn:hover { background-color: var(--accent-hover); color: #ffffff; }

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover { background-color: var(--accent-color); color: #ffffff; }

/* ==========================================
   5. HEADER & NAVIGATION
   ========================================== */
header {
    flex: 0 0 auto;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.logo span { color: var(--accent-color); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links {
    display: flex;
    gap: 20px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active { color: var(--accent-color); }

.icon-btn, .lang-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    font-family: inherit;
}

.lang-btn {
    font-weight: 700;
    font-size: 1rem;
    width: 35px;
    text-align: center;
}

.icon-btn:hover, .lang-btn:hover { color: var(--accent-color); }

.action-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
}

/* Logo Theme Switcher */
.logo-light { 
    display: none; 
}

body.light-mode .logo-dark { 
    display: none; 
}

body.light-mode .logo-light { 
    display: block; 
}

/* ==========================================
   6. FLOATING ISLAND ARCHITECTURE
   ========================================== */
.main-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden; 
}

.island {
    display: none; 
    width: 100%;
    max-width: 1100px;
    max-height: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px); 
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow);
    overflow-y: auto; 
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.island::-webkit-scrollbar { width: 6px; }
.island::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 10px; }

.island.active {
    display: flex;
    flex-direction: column;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================
   7. COMPONENTS: HERO
   ========================================== */
.hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.hero-text { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    align-items: flex-start; 
}

.hero-image-wrapper { 
    flex: 0.8; 
    display: flex; 
    justify-content: center; 
}

.profile-img {
    width: 100%; 
    max-width: 400px; 
    aspect-ratio: 1 / 1; 
    object-fit: cover;
    border-radius: 50%;
    -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 95%);
    mask-image: radial-gradient(circle, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 95%);
    transition: filter 0.3s;
}

.profile-img:hover { filter: grayscale(0%); }

.greeting { 
    display: inline-block;
    background: var(--accent-faded);
    border: 1px solid var(--border-color);
    color: var(--accent-color); 
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600; 
    font-family: monospace; 
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.hero-text h1 { 
    font-size: 3.5rem; 
    line-height: 1.1; 
    margin-bottom: -10px; 
    color: var(--text-primary);
}

.hero-text h2 { 
    font-size: 1.4rem; 
    color: var(--text-primary); 
    font-weight: 400; 
    line-height: 1.4;
}

.hero-text p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: 5px;
}

/* ==========================================
   8. COMPONENTS: ABOUT & TERMINAL
   ========================================== */
.about-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 40px; }
.about-text p { margin-bottom: 15px; color: var(--text-secondary); }

.terminal-box {
    background-color: var(--bg-element);
    border: 1px solid var(--border-color);
    border-radius: 8px; 
    padding: 20px;
    font-family: monospace; 
    font-size: 0.9rem;
    white-space: nowrap; 
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.term-user { color: #ef4444; }
.term-path { color: var(--accent-color); }
.term-output { color: var(--text-secondary); }

.about-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.about-text .lead-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 25px;
}

.about-highlights {
    list-style: none !important;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.about-highlights li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.about-highlights i {
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-top: 4px;
    min-width: 24px; 
}

.highlight-content {
    display: flex;
    flex-direction: column;
}

.about-highlights span {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.about-highlights strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* ==========================================
   9. COMPONENTS: GENERIC CARDS (Services)
   ========================================== */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 13px; margin-top:30px;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px; 
    padding: 30px 25px;
    transition: transform 0.2s, border-color 0.2s;
    display: flex; 
    flex-direction: column; 
    height: 100%;
}

body.light-mode .card {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.card:hover { transform: translateY(-5px); border-color: var(--accent-color); }
.card-icon { font-size: 2.5rem; color: var(--accent-color); margin-bottom: 20px; }
.card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }

.card-desc strong {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color); 
    background: var(--bg-element);     
    border-radius: 8px;
    color: var(--accent-color);                
    font-family: monospace;                    
    font-size: 0.95rem;
}

.card-desc strong::before {
    content: "$ ";
    opacity: 0.6;
}

/* ==========================================
   10. COMPONENTS: TECHNOLOGIES (POD STYLE)
   ========================================== */
.tech-categories {
    display: flex;
    flex-direction: column;
    gap: 16px; 
}

.tech-group {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 8px;
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s;
}

body.light-mode .tech-group {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.tech-group:hover { background: var(--bg-element); }

.tech-group-title {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: monospace; 
    letter-spacing: 0.5px;
}

.tech-group-title i { color: var(--text-secondary); }

.tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tech-item {
    background-color: var(--bg-element); 
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, border-color 0.2s;
}

body.light-mode .tech-item {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.tech-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

body.light-mode .tech-item:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* ==========================================
   11. COMPONENTS: CERTIFICATIONS & ROADMAP
   ========================================== */
.cert-card { align-items: center; text-align: center; padding: 25px 20px; }
.cert-icon { font-size: 3rem; margin-bottom: 15px; }

.card-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
}

.cert-code {
    font-family: monospace; 
    font-size: 0.85rem; 
    color: var(--text-secondary);
    margin-bottom: 20px; 
    background-color: var(--bg-element);
    border: 1px solid var(--border-color);
    padding: 4px 10px; 
    border-radius: 4px;
}

#certs .grid-cards {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 15px;
}

#certs .grid-cards .cert-card {
    display: grid;
    grid-template-columns: auto 1fr auto; 
    grid-template-rows: auto auto; 
    align-items: center;
    text-align: left;
    padding: 15px 25px;
    column-gap: 20px;
    height: auto;
}

#certs .grid-cards .cert-card .cert-icon { grid-column: 1; grid-row: 1 / 3; font-size: 2.2rem; margin-bottom: 0; }
#certs .grid-cards .cert-card .card-title { grid-column: 2; grid-row: 1; font-size: 1.05rem; margin-bottom: 4px; }
#certs .grid-cards .cert-card .cert-code { grid-column: 2; grid-row: 2; margin-bottom: 0; width: fit-content; }
#certs .grid-cards .cert-card .btn { grid-column: 3; grid-row: 1 / 3; margin-top: 0 !important; white-space: nowrap; }

.roadmap-path { display: grid; grid-template-columns: repeat(5, 1fr); gap: 30px; margin-top: 25px; align-items: stretch; }
.roadmap-path .card { margin-bottom: 0; position: relative; }
.roadmap-path .card:not(:last-child)::after {
    content: "\f061"; font-family: "Font Awesome 6 Free"; font-weight: 900;
    color: var(--accent-color); font-size: 1.5rem; position: absolute;
    right: -25px; top: 50%; transform: translateY(-50%); opacity: 0.8;
}

.planned-card { 
    border-style: dashed !important; 
    border-width: 2px !important; 
    background-color: transparent !important; 
}

.planned-card:hover { 
    transform: translateY(-5px); 
    border-color: var(--accent-color) !important; 
}

.planned-badge { 
    margin-top: auto; 
    background-color: var(--bg-element); 
    color: var(--text-primary); 
    border: 1px solid var(--border-color);
    padding: 6px 16px; 
    border-radius: 20px; 
    font-size: 0.85rem; 
    font-weight: 600; 
}

/* ==========================================
   12. COMPONENTS: CONTACT & FOOTER
   ========================================== */
.contact-box {
    background-color: var(--bg-card);
    padding: 60px 40px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: auto;
}

body.light-mode .contact-box {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.contact-box h2 {
    font-size: 2.2rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.contact-box p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 35px auto;
    line-height: 1.6;
}

.contact-email {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-element);
    color: var(--accent-color);
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.contact-email:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -10px var(--accent-color);
}

.contact-nip {
    display: block;
    margin-top: 25px;
    font-family: monospace;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.social-icons {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 30px;
}

.social-icons a {
    color: var(--text-secondary);
    font-size: 2.2rem;
    transition: color 0.2s, transform 0.2s;
}

.social-icons a:hover {
    color: var(--accent-color);
    transform: translateY(-4px) scale(1.1);
}

/* Dark overlay that sits behind the open mobile menu */
.menu-overlay {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100dvh - 70px);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   13. RESPONSIVE MEDIA QUERIES
   ========================================== */
/* Mobile Menu Button - Hidden on Desktop */
.mobile-menu-btn {
    display: none; 
    font-size: 1.4rem;
}

@media (max-width: 1024px) {
    .roadmap-path { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .roadmap-path .card::after { display: none; }
}

@media (max-width: 768px) {
    /* 1. Show the hamburger button */
    .mobile-menu-btn {
        display: block; 
    }

    /* 2. Convert nav layout to keep buttons inline but push menu off-screen */
    nav { flex-direction: row; height: 70px; padding: 0; }
    
    /* 3. Slide Out Nav */
    .nav-links { 
        position: fixed;
        top: 70px; 
        right: -100%; 
        width: 250px;
        height: calc(100dvh - 70px);
        background: var(--bg-primary); 
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        justify-content: flex-start; 
        padding-top: 40px; 
        align-items: center;
        gap: 30px;
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1); 
        z-index: 1000;
        box-shadow: -5px 0 20px rgba(0,0,0,0.3); 
    }

    /* Add this rule to fix the terminal overflow */
    .terminal-box {
        white-space: nowrap !important; 
        overflow-x: auto !important; 
        font-size: 0.75rem !important; 
        padding: 15px !important;
    }

    /* 4. The class toggled by JavaScript to slide the menu in */
    .nav-links.menu-open {
        right: 0;
    }

    /* 5. Make links larger for touch targets on mobile */
    .nav-links a {
        font-size: 1.2rem;
    }

    /* General mobile tweaks */
    .island { padding: 25px; border-radius: 16px; } 
    .hero-layout { flex-direction: column-reverse; text-align: center; gap: 20px; }
    .hero-text { align-items: center; } 
    .hero-text h1 { font-size: 2.2rem; }
    .hero-text h2 { font-size: 1.4rem; }
    .about-grid { grid-template-columns: 1fr; }
    #certs .grid-cards { grid-template-columns: 1fr; }
    #certs .grid-cards .cert-card {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto auto;
    }
    #certs .grid-cards .cert-card .btn {
        grid-column: 1 / 3;
        grid-row: 3;
        margin-top: 15px !important;
        text-align: center;
        display: block;
    }

    /* Contact section mobile fixes */
    .contact-box { 
        padding: 35px 20px; 
    }
    
    .contact-email {
        font-size: 1rem;
        padding: 12px 15px;
        width: 100%;
        justify-content: center;
    }
}

footer {
    flex: 0 0 auto;
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: var(--bg-glass);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    z-index: 100;
}