/* CSS Variables for theme switching */
:root {
    --bg-color: #fff;
    --text-color: #333;
    --header-bg: #fff;
    --border-color: #000;
    --grid-dot-color: #00000020;
    --grid-overlay-color: #00000015;
    --portfolio-bg: #f9f9f9;
    --portfolio-item-bg: #fff;
    --footer-bg: #000;
    --footer-text: #fff;
    --about-desc-color: #666;
    --pill-bg: rgba(255, 255, 255, 0.8);
    --pill-border: rgba(0, 0, 0, 0.1);
    --pill-hover-bg: rgba(255, 255, 255, 1);
    --pill-hover-border: rgba(0, 0, 0, 0.2);
    --pill-hover-shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #000;
    --text-color: #fff;
    --header-bg: #000;
    --border-color: #fff;
    --grid-dot-color: #ffffff20;
    --grid-overlay-color: #ffffff15;
    --portfolio-bg: #111;
    --portfolio-item-bg: #222;
    --footer-bg: #000;
    --footer-text: #fff;
    --about-desc-color: #fff;
    --pill-bg: rgba(255, 255, 255, 0.1);
    --pill-border: rgba(255, 255, 255, 0.2);
    --pill-hover-bg: rgba(255, 255, 255, 0.2);
    --pill-hover-border: rgba(255, 255, 255, 0.3);
    --pill-hover-shadow: rgba(255, 255, 255, 0.1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    /* Grid dot background - more visible */
    background-image: radial-gradient(circle, var(--grid-dot-color) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 0 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header Styles */
header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

nav h1 {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--border-color);
    transition: color 0.3s ease;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--border-color);
    font-weight: 500;
    transition: opacity 0.3s ease, color 0.3s ease;
}

nav a:hover {
    opacity: 0.7;
}

/* Main Content */
main {
    margin-top: 80px;
}

/* Hero Section */
#hero {
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-image: url('../images/hero-background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.hero-content {
    text-align: center;
    color: white;
    z-index: 2;
    position: relative;
    max-width: 800px;
    padding: 2rem;
}

.hero-content h1 {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    color: #f0f0f0;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s ease;
    border: 2px solid;
    backdrop-filter: blur(10px);
}

.btn-primary {
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    border-color: #ffd700;
}

.btn-primary:hover {
    background: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

section {
    padding: 4rem 0;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--border-color);
    transition: color 0.3s ease;
}

/* Bio Section */
#bio {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    /* Add subtle grid overlay to bio section too */
    background-image: radial-gradient(circle, var(--grid-overlay-color) 1px, transparent 1px);
    background-size: 20px 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#bio p {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto 1.5rem;
    text-align: center;
    color: #333;
    position: relative;
    z-index: 2;
}

/* Enhanced About Me Section */
.about-section {
    margin: 24px 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.about-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--border-color);
    transition: color 0.3s ease;
}

.about-description {
    font-size: 14px;
    line-height: 1.5;
    color: var(--about-desc-color);
    margin-bottom: 16px;
    transition: color 0.3s ease;
}

.interests-container {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.interest-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.interest-pill:hover {
    background: var(--pill-hover-bg);
    border-color: var(--pill-hover-border);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--pill-hover-shadow);
}

.interest-icon {
    font-size: 16px;
}

/* Portfolio Section */
#portfolio {
    background-color: var(--portfolio-bg);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    /* Prevent the section from moving up on scroll */
    contain: layout;
    /* Add grid pattern to portfolio section */
    background-image: radial-gradient(circle, var(--grid-overlay-color) 1px, transparent 1px);
    background-size: 22px 22px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    /* Ensure grid stays in place */
    position: relative;
    z-index: 1;
}

.portfolio-item {
    background-color: var(--portfolio-item-bg);
    border: 2px solid var(--border-color);
    padding: 0;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    will-change: transform, background-color, color;
    overflow: hidden;
    border-radius: 8px;
    color: var(--text-color);
}

.portfolio-header {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.portfolio-icon {
    font-size: 48px;
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-icon {
    transform: scale(1.2);
}

/* Portfolio Image Styles */
.portfolio-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-item.has-image:hover .portfolio-image {
    transform: scale(1.05);
}

/* Hide gradient header for items with images */
.portfolio-item.has-image .portfolio-header {
    display: none;
}

.portfolio-content {
    padding: 1.5rem;
}

/* Specific themes for each portfolio item */
.satoshi-education .portfolio-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.lucky100 .portfolio-header {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.3);
}

.lucky100:hover .portfolio-header {
    box-shadow: 0 6px 20px rgba(241, 196, 15, 0.5);
}

.weather-dashboard .portfolio-header {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

[data-theme="light"] .portfolio-item:hover {
    background-color: #000;
    color: #fff;
    transform: translateY(-5px);
}

[data-theme="dark"] .portfolio-item:hover {
    background-color: #fff;
    color: #000 !important;
    transform: translateY(-5px);
}

[data-theme="dark"] .portfolio-item:hover h3,
[data-theme="dark"] .portfolio-item:hover p {
    color: #000 !important;
    font-weight: bold !important;
}

.portfolio-item h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: inherit;
}

.portfolio-item p {
    margin-bottom: 1.5rem;
    color: inherit;
    opacity: 0.8;
}

.portfolio-item a {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border: 1px solid currentColor;
    text-decoration: none;
    color: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

[data-theme="light"] .portfolio-item:hover a {
    background-color: #fff;
    color: #000;
}

[data-theme="dark"] .portfolio-item:hover a {
    background-color: #000;
    color: #fff;
}

.portfolio-item a:hover {
    opacity: 0.8;
}

/* Footer */
footer {
    background-color: #000;
    color: #fff;
    padding: 3rem 0;
    text-align: center;
}

footer h2 {
    color: #fff;
    margin-bottom: 2rem;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-links a {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border: 1px solid #fff;
    transition: all 0.3s ease;
}

.contact-links a:hover {
    background-color: #fff;
    color: #000;
}

/* Responsive Design */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 20px;
    }

    nav ul {
        gap: 1rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary {
        width: 200px;
    }

    h2 {
        font-size: 2rem;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .portfolio-item {
        padding: 1.5rem;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .contact-links a {
        width: 200px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    section {
        padding: 2rem 0;
    }

    h2 {
        font-size: 1.8rem;
    }

    #bio p {
        font-size: 1rem;
    }

    .portfolio-item {
        padding: 1rem;
    }

    nav h1 {
        font-size: 1.3rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced Grid Pattern Alternative - more visible like in the screenshot */
.grid-enhanced {
    background-image: 
        radial-gradient(circle, #00000040 1px, transparent 1px),
        linear-gradient(90deg, #00000008 1px, transparent 1px),
        linear-gradient(#00000008 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px, 24px 24px;
    background-position: 0 0, 0 0, 0 0;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    background: var(--portfolio-item-bg);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    width: 60px;
    height: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    padding: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.theme-toggle-slider {
    width: 22px;
    height: 22px;
    background: var(--border-color);
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--bg-color);
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(28px);
}

/* Retro toggle styling */
.theme-toggle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--border-color), transparent, var(--border-color));
    border-radius: 50px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-toggle:hover::before {
    opacity: 0.3;
}

/* Dark mode bold text overrides */
[data-theme="dark"] body,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] p,
[data-theme="dark"] a,
[data-theme="dark"] nav h1,
[data-theme="dark"] nav a,
[data-theme="dark"] .about-header,
[data-theme="dark"] .about-description,
[data-theme="dark"] .portfolio-item,
[data-theme="dark"] .portfolio-item h3,
[data-theme="dark"] .portfolio-item p,
[data-theme="dark"] .portfolio-item a,
[data-theme="dark"] .interest-pill,
[data-theme="dark"] .contact-links a {
    color: #fff !important;
    font-weight: bold !important;
}

/* Flip Card Styles */
.portfolio-item {
    perspective: 1000px; /* Add perspective for the 3D effect */
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Stack children vertically */
    min-height: 400px; /* Ensure a minimum height for the card */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    flex-grow: 1; /* Allow it to grow */
    display: flex;
    flex-direction: column;
}

.portfolio-item.is-flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Add scrollbar if content overflows vertically */
    padding-bottom: 1rem; /* Add some space at the bottom for scroll */
}

.card-back {
    transform: rotateY(180deg);
    background-color: var(--portfolio-item-bg);
    /* justify-content: center; */ /* Removed to allow content to flow */
}

.card-back .portfolio-content {
    padding: 1.5rem; /* Adjusted padding */
    flex-grow: 1; /* Allow content to grow */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute content */
}

/* Ensure text elements within content are readable */
.card-back .portfolio-content h3,
.card-back .portfolio-content h4,
.card-back .portfolio-content p,
.card-back .portfolio-content ul,
.card-back .portfolio-content li {
    text-align: left; /* Ensure text aligns left for readability */
    color: var(--text-color); /* Explicitly set color */
}

.flip-btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border: 1px solid currentColor;
    text-decoration: none;
    color: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    background: none;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

[data-theme="light"] .portfolio-item:hover .flip-btn {
    background-color: #fff;
    color: #000;
}

[data-theme="dark"] .portfolio-item:hover .flip-btn {
    background-color: #000;
    color: #fff;
}


/* Tech Stack Pills in Portfolio Card */
.tech-stack-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem; /* Add some space before the "View Project" button */
}

.tech-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px; /* Slightly smaller padding */
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 16px;
    font-size: 13px; /* Slightly smaller font */
    font-weight: 500;
    color: var(--text-color);
    transition: all 0.3s ease;
}


