/* 
 * Minimalist Design System variables
 * Inspired by Vercel/Stripe aesthetics
 */

:root {
    /* Colors - Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f0f0f0;

    /* Animated Gradient Background Colors */
    --gradient-1: #ffffff;
    --gradient-2: #f8fafc;
    --gradient-3: #eff6ff;

    --text-primary: #111111;
    --text-secondary: #666666;
    --text-tertiary: #888888;

    --border-color: #eaeaea;
    --border-hover: #cccccc;

    --accent: #000000;
    --accent-hover: #333333;

    /* Gradients/Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);

    /* Utility colors */
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;

    /* Spacing & Layout */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --container-width: 900px;
}

/* Dark Theme overrides */
body.dark {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;

    /* Animated Gradient Background Colors */
    --gradient-1: #0a0a0a;
    --gradient-2: #0f172a;
    --gradient-3: #020617;

    --text-primary: #ededed;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    --border-color: #333333;
    --border-hover: #444444;

    --accent: #ffffff;
    --accent-hover: #cccccc;

    --shadow-sm: 0 1px 2px rgba(255, 255, 255, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

    --gray-100: #1a1a1a;
    --gray-200: #262626;
    --gray-300: #404040;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(-45deg, var(--gradient-1), var(--gradient-2), var(--gradient-3), var(--gradient-1));
    background-size: 400% 400%;
    animation: gradientMove 15s ease infinite;
    transition: background 0.5s ease;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Tech Stack */
.tech-stack {
    padding-bottom: 8rem;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 3rem 2rem;
}

.tech-category {
    display: flex;
    flex-direction: column;
}

.category-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Tech Grid Devicons */
.tech-icon {
    width: 16px;
    height: 16px;
    margin-right: 0.35rem;
    vertical-align: text-bottom;
}

body.dark .tech-icon.dark-invert {
    filter: invert(1) brightness(1) sepia(0%);
}

/* Layout Containers */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.text-center {
    text-align: center;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    background-color: rgba(var(--bg-primary), 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-color);
    margin: 0 0.5rem;
}

.nav-icon-link {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-icon-link:hover {
    color: var(--text-primary);
}

.nav-icon-link svg {
    width: 18px;
    height: 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

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

.btn-outline:hover {
    background-color: var(--bg-secondary);
    border-color: var(--border-hover);
}

/* Hero Section */
.hero {
    padding: 8rem 0 6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 70vh;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

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

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.5rem;
}

.view-all-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.view-all-link:hover {
    color: var(--text-primary);
}

.view-all-link svg {
    width: 14px;
    height: 14px;
}

/* Project Cards */
.featured-projects {
    padding-bottom: 8rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-hover);
}

.project-image-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.placeholder-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .placeholder-img {
    transform: scale(1.03);
}

.project-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    border: 1px solid var(--border-color);
}

.project-links {
    display: flex;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.project-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.project-link:hover {
    color: var(--text-primary);
}

.project-link svg {
    width: 14px;
    height: 14px;
}

/* Footer */
.footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* Scroll Animations */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Projects Page (Single Column) */
.page-header {
    margin: 4rem 0;
    text-align: center;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.page-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-bottom: 8rem;
}

.project-list-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .project-list-card {
        flex-direction: row;
        align-items: center;
        /* Prevents the image from stretching full-height */
        height: 420px;
        /* Lock height so all cards are 100% uniform */
    }

    .project-list-image {
        width: 45%;
        margin: 2.5rem;
        aspect-ratio: 16 / 10;
        /* Lock image frame to this nice aspect ratio */
        border: 1px solid var(--border-color);
        /* Enclose image nicely */
        border-radius: var(--radius-sm);
        height: auto;
    }

    .project-list-content {
        width: 55%;
        padding: 2.5rem 2.5rem 2.5rem 0;
        height: 100%;
        overflow-y: auto;
    }
}

.project-list-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-hover);
}

.project-list-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    /* Lock aspect ratio on mobile too */
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.project-list-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-list-card .project-description {
    flex-grow: 0;
    /* Prevents text from spacing too far apart inside the fixed height box */
}

/* About Page (Photo Grid) */
.about-header {
    margin: 4rem 0 3rem;
    text-align: center;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px;
    gap: 1.5rem;
    padding-bottom: 8rem;
}

.photo-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    z-index: 2;
}

.photo-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.photo-card:hover .photo-img {
    transform: scale(1.05);
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.photo-card:hover .photo-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Make some photos span rows/cols for visual interest */
.span-row-2 {
    grid-row: span 2;
}

.span-col-2 {
    grid-column: span 2;
}

/* Responsive Overrides */
@media (max-width: 900px) {
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Mobile nav would go here, omitting for simplicity in this specific request */
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 200px;
    }

    .span-col-2 {
        grid-column: span 1;
    }
}

@media (max-width: 480px) {
    .photo-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 250px;
    }
}

/* Carousel */
.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-inner {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.carousel-item {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(var(--bg-primary), 0.7);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background: rgba(var(--bg-primary), 1);
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

/* About Page - Interactive Japan Card */
.japan-card {
    width: 100%;
    height: 500px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.japan-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.japan-cover {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
    z-index: 2;
}

.japan-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}

.japan-cover-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
}

.japan-cover-content h2 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    color: white;
}

.japan-cover-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* --- Instagram Style Modal --- */
.ig-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85); /* Slightly lighter dark overlay */
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.ig-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.ig-modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    height: 90vh; /* Responsive height */
    max-height: 800px;
    background: var(--bg-primary); /* White/Dark depending on theme */
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.ig-modal.active .ig-modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000; /* Above everything else */
    transition: color 0.3s ease;
}

.modal-close-btn:hover {
    color: #ffd700; /* Subtle hover effect */
}

/* Modal Layout Splits */
.ig-modal-image-container {
    flex: 1 1 auto;
    background: #000; /* Letterboxing color */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 50vh; /* Fallback for mobile column stack */
}

.ig-modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Prevent cropping */
}

.ig-modal-sidebar {
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .ig-modal-content {
        flex-direction: row; /* Image left, Sidebar right */
    }
    
    .ig-modal-image-container {
        height: auto; /* Fill flex height */
    }

    .ig-modal-sidebar {
        width: 350px;
        border-top: none;
        border-left: 1px solid var(--border-color);
    }
}

/* Sidebar Internals */
.ig-sidebar-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.ig-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.ig-avatar i { width: 16px; height: 16px; }

.ig-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.ig-username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ig-location-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.ig-sidebar-caption {
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    overflow-y: auto;
    flex: 1; /* Take up remaining space */
}

.ig-avatar-small {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.ig-avatar-small i { width: 14px; height: 14px; }

.ig-caption-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ig-caption-text .ig-username {
    margin-right: 0.3rem;
}