:root {
    --bg-base: #050505;
    --surface: #0E0E11;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(6, 182, 212, 0.5); /* Cyan */
    --accent: #06B6D4;
    --accent-glow: rgba(6, 182, 212, 0.2);
    --text-primary: #FFFFFF;
    --text-secondary: #A1A1AA;
    --nav-bg: rgba(14, 14, 17, 0.8);
    --btn-bg: #FFFFFF;
    --btn-text: #050505;
    --font: 'Inter', sans-serif;
}

body.light-mode {
    --bg-base: #F4F4F5;
    --surface: #FFFFFF;
    --border: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(6, 182, 212, 0.8);
    --accent-glow: rgba(6, 182, 212, 0.3);
    --text-primary: #09090B;
    --text-secondary: #52525B;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --btn-bg: #09090B;
    --btn-text: #FFFFFF;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font);
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient Background */
.ambient-glow {
    position: fixed;
    top: -20vh;
    left: 20vw;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
}

/* Navigation */
.pill-nav {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    width: 90%;
    max-width: 600px;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.logo {
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 1.1rem;
    background: linear-gradient(to right, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--surface);
    color: var(--accent);
}

.magnetic-btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.1, 0, 0.1, 1), background 0.3s;
}

body.light-mode .magnetic-btn:hover { background: var(--accent); color: white; }
body:not(.light-mode) .magnetic-btn:hover { background: var(--accent); color: #000; }

.magnetic-btn::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(128,128,128,0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    transform: translate(var(--mx, 0), var(--my, 0));
}

.magnetic-btn:hover::after { opacity: 0.3; }

/* Header */
.header {
    margin-top: 12rem;
    text-align: center;
    padding: 0 5%;
}

h1 {
    font-size: clamp(3.5rem, 8vw, 6rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.text-gradient {
    background: linear-gradient(to right, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 280px;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 5rem auto;
    padding: 0 5%;
}

.bento-cell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}

.bento-cell:hover {
    border-color: var(--border-hover);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

body.light-mode .bento-cell {
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

body.light-mode .bento-cell:hover {
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Specific Cell Spans */
.bento-large { grid-column: span 2; grid-row: span 2; }
.bento-tall { grid-row: span 2; }
.bento-wide { grid-column: span 2; }

/* Bento Content */
.bento-content {
    position: relative;
    z-index: 2;
}

.bento-cell h2 { font-size: 2.5rem; font-weight: 600; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
.bento-cell h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-primary); }
.bento-cell p { color: var(--text-secondary); font-size: 1.1rem; }

.bento-icon {
    font-size: 2rem;
    margin-bottom: auto;
    background: rgba(6, 182, 212, 0.1);
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px;
    color: var(--accent);
}

/* Images in Bento */
.bento-img-overlap {
    position: absolute;
    right: -20%;
    bottom: -15%;
    width: 80%;
    border-radius: 20px;
    box-shadow: -10px -10px 40px rgba(0,0,0,0.3);
    transform: rotate(-5deg);
    transition: transform 0.5s ease;
}

.bento-large:hover .bento-img-overlap {
    transform: rotate(0deg) translateY(-10px);
}

.bento-img-bottom {
    position: absolute;
    bottom: -15%;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    border-radius: 20px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
    transition: transform 0.5s ease;
}

.bento-tall:hover .bento-img-bottom {
    transform: translateX(-50%) translateY(-20px);
}

.bento-tall .bento-content {
    position: relative;
    z-index: 2;
}

body.light-mode .bento-tall .bento-content {
    /* Kept for backwards compatibility if needed, but not strictly required now */
}

.bento-tall .bento-content h3 { margin: 0; font-size: 1.1rem; }

.bento-content-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.bento-text { flex: 1; padding-right: 2rem; }

.bento-img-side {
    height: 130%;
    border-radius: 20px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    transform: translateY(10%);
    transition: transform 0.5s ease;
}

.bento-wide:hover .bento-img-side { transform: translateY(0); }

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 4rem 5% 2rem;
    margin-top: 4rem;
    background: var(--surface);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.author-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.author-link:hover {
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.social-links a {
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
}

body.light-mode .social-links a {
    background: var(--bg-base);
}

.social-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

/* Animations */
.reveal-text, .reveal-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-text.visible, .reveal-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* Responsive Grid */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 280px;
    }
    .bento-wide { grid-column: span 2; }
    .bento-large { grid-column: span 2; grid-row: span 2; }
    .bento-img-overlap { right: 0; width: 60%; }
}

@media (max-width: 600px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    .bento-large, .bento-tall, .bento-wide {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 350px;
    }
    .bento-content-row { flex-direction: column; text-align: center; }
    .bento-text { padding-right: 0; margin-bottom: 2rem; }
    .bento-img-side { height: auto; width: 80%; transform: none; }
    .bento-img-overlap { position: relative; right: auto; bottom: auto; width: 100%; margin-top: 2rem; transform: none; }
}
