/* =========================================
   1. RESET & VARIABLES
   ========================================= */
   :root {
    /* Kolory Deep Space */
    --bg-void: #030303;
    --bg-panel: #0a0a0a;
    
    /* Akcenty */
    --accent-primary: #6366f1;   /* Indigo */
    --accent-secondary: #a855f7; /* Purple */
    
    /* Tekst */
    --text-main: #ededed;
    --text-muted: #9ca3af;
    --text-dim: #4b5563;

    /* Elementy UI */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(10, 10, 10, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;

    /* Typografia (Fluid - naprawia skakanie tekstu) */
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Zmniejszony start (1.8rem) dla lepszego dopasowania na mobile */
    --fs-display: clamp(1.8rem, 4.5vw + 1rem, 4rem); 
    --fs-h3: clamp(1.2rem, 2vw, 1.5rem);

    /* Layout */
    --bento-gap: clamp(16px, 2vw, 24px);
    --card-radius: 20px;
    --content-max-width: 1240px;
    
    /* Animacje */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    background-color: var(--bg-void);
}

body {
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   2. AMBIENT BACKGROUND
   ========================================= */
.ambient-canvas {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    overflow: hidden;
}

.noise-overlay {
    position: absolute; inset: 0; opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.ambient-glow {
    position: absolute; width: 40vw; height: 40vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    animation: float-glow 20s infinite alternate ease-in-out;
    opacity: 0.6;
}
.spot-1 { top: -10%; left: -10%; }
.spot-2 { bottom: -10%; right: -10%; background: radial-gradient(circle, rgba(168, 85, 247, 0.05) 0%, transparent 70%); animation-delay: -5s; }

@keyframes float-glow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* =========================================
   3. LAYOUT & GRID
   ========================================= */
.main-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: clamp(1.5rem, 5vw, 6rem) 1.5rem;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--bento-gap);
    margin-bottom: 4rem;
}

/* =========================================
   4. BENTO CARDS (Z FIXAMI)
   ========================================= */
.bento-item {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--card-radius);
    position: relative;
    display: flex; flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s var(--ease-out-expo), opacity 0.6s ease;
    
    /* Inicjalny stan (ukryty) */
    opacity: 0;
    transform: translateY(20px);
}

.bento-item:hover { transform: translateY(-4px); }
.bento-item.in-view { opacity: 1; transform: translateY(0); }

/* --- SPOTLIGHT MAGIC --- */
.spotlight-overlay {
    pointer-events: none; position: absolute; inset: 0; z-index: 2; opacity: 0;
    transition: opacity 0.5s ease;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.06), transparent 40%);
}

.bento-item::before {
    content: ""; position: absolute; inset: 0; border-radius: var(--card-radius);
    padding: 1px; /* Border width */
    background: radial-gradient(500px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.4), transparent 40%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    z-index: 3; opacity: 0; transition: opacity 0.5s ease;
}

.bento-grid:hover .spotlight-overlay,
.bento-grid:hover .bento-item::before { opacity: 1; }

.card-content {
    position: relative; z-index: 5;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    height: 100%; display: flex; flex-direction: column;
}

/* =========================================
   5. COMPONENT STYLING
   ========================================= */

/* Typography & Typewriter */
.mono-text {
    font-family: var(--font-mono); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}

.title-display {
    font-size: var(--fs-display); font-weight: 600;
    letter-spacing: -0.03em; line-height: 1.1;
    margin: 1.5rem 0; color: var(--text-main);
}
.dot { color: var(--accent-primary); }

.typewriter-wrapper {
    display: block;
    font-size: 0.5em; /* Połowa wielkości nagłówka */
    color: var(--text-muted);
    font-family: var(--font-mono); font-weight: 400;
    margin-top: 0.5em;
    /* Zapobiega łamaniu w połowie słowa */
    white-space: nowrap; 
    overflow: hidden; text-overflow: ellipsis;
}

.typewriter-text { color: var(--accent-primary); font-weight: 500; }
.cursor {
    display: inline-block; width: 2px; height: 1em;
    background-color: var(--accent-primary);
    margin-left: 4px; vertical-align: bottom;
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Badges & Buttons */
.status-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle); border-radius: 100px;
    width: fit-content;
}
.pulse-dot {
    width: 6px; height: 6px; background: #10b981; border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.micro-nav { margin-top: 3rem; display: flex; gap: 1.5rem; }
.btn-link {
    font-family: var(--font-mono); font-size: 0.85rem;
    color: var(--text-main); text-decoration: none;
    border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px;
    transition: 0.3s;
}
.btn-link:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.btn-link.muted { color: var(--text-muted); border-color: transparent; }

/* Image Card FIX */
.image-card {
    /* Używamy aspect-ratio na mobile (proporcje zdjęcia) */
    aspect-ratio: 4 / 5;
    min-height: auto;
    height: auto;
}
.image-wrapper { 
    position: absolute; inset: 0; 
    border-radius: var(--card-radius); overflow: hidden; 
}
.cover-image {
    width: 100%; height: 100%; 
    object-fit: cover;
    /* To zakotwicza zdjęcie do góry - głowa zawsze widoczna */
    object-position: top center; 
    filter: grayscale(100%) contrast(1.1);
    transition: filter 0.5s ease, transform 0.6s ease;
}
.bento-item:hover .cover-image { filter: grayscale(0%); transform: scale(1.05); }

.image-overlay {
    position: absolute; bottom: 1.5rem; left: 1.5rem; z-index: 2;
    background: var(--glass-bg); backdrop-filter: blur(8px);
    padding: 6px 12px; border-radius: 6px;
    border: 1px solid var(--glass-border);
}

/* Tech & Social */
.centered { align-items: center; justify-content: center; text-align: center; }
.tech-icon-row { font-size: 2.2rem; display: flex; gap: 1.5rem; margin-bottom: 1rem; color: var(--text-muted); }
.tech-icon-row i { transition: 0.3s; }
.tech-card:hover i { color: var(--text-main); transform: translateY(-5px); }

.space-between { justify-content: space-between; align-items: center; flex-direction: row; }
.social-links-row { display: flex; gap: 10px; }
.social-btn {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255,255,255,0.03);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-main); text-decoration: none;
    border: 1px solid var(--border-subtle); transition: 0.3s; z-index: 10;
}
.social-btn:hover { background: var(--bg-void); border-color: var(--accent-secondary); color: var(--accent-secondary); transform: rotate(15deg); }

/* Projects */
.project-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    opacity: 0.5; transition: transform 0.6s ease, opacity 0.5s ease;
}
.bento-item:hover .project-bg { transform: scale(1.04); opacity: 0.3; }
.content-end { justify-content: flex-end; }
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 1.5rem; border-radius: 16px; border: 1px solid var(--glass-border);
    transform: translateY(0); transition: transform 0.3s ease; width: 100%;
}
.project-meta { display: flex; gap: 8px; margin-bottom: 8px; }
.tag { font-size: 0.65rem; background: rgba(255,255,255,0.08); padding: 4px 8px; border-radius: 6px; }
.project-info h3 { font-size: var(--fs-h3); font-weight: 500; }
.full-card-link { position: absolute; inset: 0; z-index: 20; }

/* Footer */
.minimal-footer {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
    padding-top: 2rem; border-top: 1px solid var(--border-subtle); font-size: 0.75rem; margin-top: auto;
}
.dim { color: var(--text-dim); }
.system-status { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-family: var(--font-mono); }
.status-indicator { width: 6px; height: 6px; background: #10b981; border-radius: 50%; box-shadow: 0 0 8px rgba(16,185,129,0.3); }

/* =========================================
   6. RESPONSIVE
   ========================================= */
@media (min-width: 768px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .span-2-col { grid-column: span 2; }
    .span-2-row { grid-row: span 2; }
    .hero-card { min-height: 380px; }
}

@media (min-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(2, minmax(280px, auto));
    }
    .hero-card { grid-column: span 2; grid-row: span 2; }
    
    /* Resetujemy ustawienia mobilne dla karty zdjęcia na Desktopie */
    .image-card { 
        grid-column: span 1; 
        grid-row: span 2; 
        aspect-ratio: auto; /* Wyłączamy wymuszanie proporcji */
        height: 100%;       /* Wypełniamy grid */
    }
    
    .tech-card, .social-card, .philosophy-card, .project-card[data-project="accountant"] { grid-column: span 1; grid-row: span 1; }
    .project-card[data-project="walletflow"] { grid-column: span 2; }
}

@media (max-width: 767px) {
    .bento-item:hover { transform: none; }
    .glass-panel { backdrop-filter: none; background: rgba(10,10,10,0.9); }
    .spotlight-overlay, .bento-item::before { display: none; }
    
    /* Na mobile tekst może być mniejszy, by nie łamał linii */
    .title-display { margin: 1rem 0; }
}