:root {
    /* Apple-style Dark Mode Colors */
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --accent-blue: #2997ff;
    --border-color: #333333;
    --header-bg: rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Header & Navigation */
.glass-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 80px;
    display: flex;
    align-items: center;
    backdrop-filter: saturate(180%) blur(20px);
    background-color: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 40px;
}

nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    /* Pixel fonts often look bigger, so adjusting slightly if needed */
    font-weight: 400;
    letter-spacing: -0.05em;
    line-height: 1.5;
}

.filter-tabs {
    display: flex;
    list-style: none;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 999px;
}

.filter-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Hero Section */
.hero-section {
    padding: 60px 0 40px;
    will-change: transform, opacity;
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 120px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.meta-col h3 {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.meta-col p {
    margin-bottom: 4px;
}

.hero-body {
    display: flex;
    flex-direction: column;
    gap: 100px;
    /* Increased from 40px to prevent overlap with background image */
}

.title-container {
    position: relative;
    width: 100%;
    /* Container inherits 16:9 ratio from visual via relative sizing or we enforce it? 
       Visual is relative, so container grows with it. */
}

.hero-content {
    position: relative;
    /* Changed from absolute */
    width: 100%;
    height: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Space between header row and tabs (if tabs at bottom) OR just flex-start */
    padding: 60px 0;
    /* Adjusted padding, removed side padding as container has it */
    box-sizing: border-box;
    gap: 80px;
    /* Add gap between top row and bottom tabs */
}

.hero-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    /* Optimize for scroll animation */
}

.hero-title {
    position: static;
    /* Reset absolute */
    transform: none;
    font-family: 'Inter', sans-serif;
    font-size: clamp(3rem, 8vw, 6rem);
    /* Slightly smaller than huge center text */
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-left: -6px;
    /* Visual adjustment to align with tabs below */
}

.hero-title span {
    display: inline-block;
    /* Allow border to show properly */
    opacity: 0;
    /* Initially hidden, revealed by JS */
}

.hero-title span.vis {
    opacity: 1;
}

/* Decorative line above title */
.hero-title::before {
    content: "";
    display: block;
    width: 100%;
    /* Matches title width or use fixed width like 60px? User said "decorate above". Full width of block usually looks structural. Let's try full width of text block. */
    height: 1px;
    background-color: var(--text-primary);
    opacity: 0.3;
    margin-bottom: 30px;
}

.hero-text-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-desc {
    max-width: 500px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: left;
    margin-top: 34px;
    /* Align visually with title text (below the decorative line) */
}

.hero-icons {
    margin-top: 22px;
    margin-left: -5px;
    /* Optimizing visual alignment */
}

.software-suite-img {
    height: 40px;
    /* Adjust height to look good */
    width: auto;
    display: block;
    opacity: 0.9;
}

/* Tabs inside content */
.side-tabs {
    margin-top: auto;
    /* Push to bottom if content is full height */
    align-self: flex-start;
    gap: 32px;
    margin-left: -10px;
    /* Align with content */
}



/* Filter Tabs (Horizontal, inside Hero) */
.side-tabs {
    display: inline-flex;
    flex-direction: row;
    align-self: flex-start;
    gap: 4px;
    list-style: none;
    padding: 4px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Light border */
    border-radius: 999px;
    /* Pill shape container */
    margin-bottom: 0;
    flex-wrap: wrap;
}

.side-tabs li {
    display: flex;
    /* Ensure li doesn't break flow */
}

.side-tabs .filter-btn {
    text-align: center;
    width: auto;
    padding: 10px 24px;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: transparent;
    border-radius: 999px;
    /* Pill shape buttons */
    transition: all 0.3s ease;
    font-weight: 500;
}

.side-tabs .filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.side-tabs .filter-btn.active {
    background-color: var(--text-primary);
    /* White background */
    color: var(--bg-color);
    /* Black text */
    font-weight: 600;
    text-decoration: none;
}


/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 10px;
    /* Reduced from 24px */
    padding-bottom: 80px;
}

.portfolio-item {
    position: relative;
    border-radius: 0;
    /* Sharp corners */
    overflow: hidden;
    aspect-ratio: 1/1;
    background-color: var(--card-bg);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    animation: fade-up 0.6s ease forwards;
}

.item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.portfolio-item:hover .item-img {
    transform: scale(1.05);
}

.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.portfolio-item:hover .item-overlay {
    opacity: 1;
    transform: translateY(0);
}

.item-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
}

/* Animation Keyframes */
@keyframes fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .filter-tabs {
        display: none;
        /* In a real app, maybe a dropdown or scrollable list */
    }

    /* Simple mobile nav for now */
    .filter-tabs {
        display: flex;
        overflow-x: auto;
        border-radius: 0;
        background: transparent;
        padding: 10px 0;
        width: 100%;
    }

    .glass-header {
        height: auto;
        padding: 10px 0;
    }

    nav {
        flex-direction: column;
        gap: 16px;
    }
}

/* Detail Page Styles */
.detail-header .back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.detail-header .back-link:hover {
    color: var(--accent-blue);
}

.detail-content {
    animation: fade-up 0.6s ease forwards;
}

.detail-hero {
    width: 100%;
    margin-bottom: 40px;
    border-radius: 16px;
    overflow: hidden;
    /* Aspect ratio mainly for skeleton loading feel, actual image height will dictate */
    min-height: 300px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.detail-hero {
    width: 100%;
    margin-bottom: 40px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    background-color: #000;
}

/* Video Responsive Container */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.gallery-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.gallery-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
    font-weight: 600;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 24px;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fade-up 0.6s ease forwards;
    aspect-ratio: 16/9;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.detail-info {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 60px;
}

.info-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 30px;
    margin-bottom: 30px;
}

.highlight-tag {
    color: var(--accent-blue);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
}

#detail-title {
    font-size: 2.5rem;
    line-height: 1.1;
    margin-bottom: 8px;
}

.meta-data {
    display: flex;
    gap: 40px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.meta-value {
    font-weight: 500;
}

.info-body p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

@media (max-width: 768px) {
    #detail-title {
        font-size: 2rem;
    }

    .meta-data {
        flex-direction: column;
        gap: 16px;
    }
}

.gallery-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.project-subtitle {
    font-size: 1.1rem;
    color: #cecece;
    margin-top: 0;
    margin-bottom: 24px;
    font-weight: 400;
}