/* =========================================
   DIETER RAMS DESIGN SYSTEM
   Theme: "Less, but better."
   Colors: Braun Calculator Palette (Off-white, Charcoal, Accent Orange/Green)
   Typography: Inter (Clean, Geometric Sans)
   Layout: Highly structured, generous whitespace
========================================= */

:root {
    /* Colors */
    --bg-primary: #ebebeb;
    /* Signature Braun off-white/grey */
    --bg-secondary: #f5f5f5;
    --bg-dark: #222222;

    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-light: #ffffff;

    --accent-orange: #ff4a1c;
    /* Braun ET66 Orange */
    --accent-green: #008f4c;
    /* Braun Green */
    --border-color: #d1d1d1;

    /* Box Shadows (Tactile feel) */
    --shadow-flat: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-recessed: inset 0 2px 4px rgba(0, 0, 0, 0.06), inset 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-button: 0 2px 0px rgba(0, 0, 0, 0.1), inset 0 1px 0px rgba(255, 255, 255, 0.5);
    --shadow-button-active: inset 0 2px 4px rgba(0, 0, 0, 0.15);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Animation Speeds */
    --transition-fast: 0.15s ease-out;
    --transition-normal: 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-slow: 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================
   RESET & BASE STYLES
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
    width: 100vw;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
}

img {
    max-width: 100%;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

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

/* =========================================
   TYPOGRAPHY
========================================= */
h1,
h2,
h3,
h4 {
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.text-accent {
    color: var(--accent-orange);
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    display: inline-block;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 0.25rem;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 1.5rem;
}

.section-desc {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
}

/* =========================================
   COMPONENTS
========================================= */

/* Buttons (Tactile ET66 Calculator Style) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 4px;
    /* Slight rounding, not fully pill */
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    text-align: center;
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--text-light);
    box-shadow: var(--shadow-button);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: var(--shadow-button-active);
}

.btn-primary:hover {
    background-color: #000;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: var(--text-primary);
}

.btn-secondary:active {
    background-color: rgba(0, 0, 0, 0.06);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: background-color var(--transition-normal), backdrop-filter var(--transition-normal);
    padding: 1.5rem 0;
}

.navbar.scrolled {
    background-color: rgba(235, 235, 235, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: flex-end;
    /* Align links to right since logo is empty */
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-family: 'House Gothic 23', var(--font-sans);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-orange);
    transition: width var(--transition-normal);
}

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

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle .bar {
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: var(--transition-normal);
}

/* =========================================
   SECTIONS
========================================= */

/* Hero Redesign (Editorial/Broken Grid style) */
.hero {
    min-height: 100vh;
    padding-top: 5rem;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Cursor Glow Effect */
.cursor-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 74, 28, 0.25) 0%, rgba(255, 74, 28, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 0;
    transition: width 0.3s, height 0.3s;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 2rem;
    height: 100%;
    align-items: end;
    position: relative;
    z-index: 1;
}

/* Intro Text (Top Left) */
.hero-intro {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    z-index: 10;
    padding-bottom: 2rem;
    padding-left: 2rem;
}

.hero-greeting {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.hero-name {
    font-size: clamp(4rem, 8vw, 7rem);
    font-weight: 500;
    line-height: 0.9;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    text-transform: uppercase;
}

/* Background Card */
.hero-card {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    background-color: #f2f2f0;
    /* Slightly warmer off-white for contrast */
    border-radius: 20px;
    height: 450px;
    /* Base height for the card */
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    z-index: 1;
}

.hero-card-content {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    max-width: 400px;
    z-index: 5;
}

.hero-description {
    font-size: 1.25rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    font-weight: 400;
}

/* Pill Button */
.btn-pill {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    background-color: white;
    box-shadow: var(--shadow-flat);
}

.btn-pill:hover {
    box-shadow: var(--shadow-elevated);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.btn-pill .btn-icon {
    font-size: 1.25rem;
    transition: transform var(--transition-normal);
}

.btn-pill:hover .btn-icon {
    transform: translateX(4px);
}

/* Out-of-box Image (Right side) */
.hero-image-container {
    position: absolute;
    right: 2rem;
    bottom: 0;
    width: 45%;
    max-width: 600px;
    height: 115%;
    /* Exceeds the container height to break out of the top */
    z-index: 10;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
    /* Let clicks pass through the transparent parts */
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom right;
    filter: drop-shadow(-10px 10px 20px rgba(0, 0, 0, 0.1));
}

/* Philosophy Section */
.philosophy {
    padding: 8rem 0;
    background-color: var(--bg-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.split-visual {
    position: relative;
    width: 100%;
}

.principles-list {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.principles-list li {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
}

.principles-list li span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =========================================
   INTERACTIVE 3D HEAD
========================================= */
.interactive-head-container {
    width: 100%;
    height: 380px;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    perspective: 800px;
    cursor: crosshair;
}

.head-cube {
    width: 160px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg));
    transition: transform 0.1s linear;
}

.head-face {
    position: absolute;
    width: 100%;
    height: 100%;
    /* Dot matrix wireframe aesthetic */
    background: radial-gradient(circle, rgba(255, 255, 255, var(--dot-opacity, 0.2)) 2px, transparent 2px);
    background-size: 10px 10px;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: background-color 0.2s;
}

.head-front {
    transform: translateZ(80px);
}

.head-back {
    transform: rotateY(180deg) translateZ(80px);
}

.head-right {
    width: 160px;
    transform: rotateY(90deg) translateZ(80px);
}

.head-left {
    width: 160px;
    transform: rotateY(-90deg) translateZ(80px);
}

.head-top {
    height: 160px;
    transform: rotateX(90deg) translateZ(100px);
}

.head-bottom {
    height: 160px;
    transform: rotateX(-90deg) translateZ(100px);
}

/* Minimalist Facial Features (Dieter Rams Style) */
.eye {
    width: 24px;
    height: 24px;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 60px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.left-eye {
    left: 35px;
}

.right-eye {
    right: 35px;
}

.mouth {
    width: 40px;
    height: 6px;
    background-color: var(--accent-orange);
    border-radius: 10px;
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.scroller-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Work Section */
.work {
    padding: 8rem 0;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3.5rem;
    margin-top: 3rem;
}

@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

.project-card {
    display: block;
    width: 100%;
    max-width: 800px;
    cursor: pointer;
    border-radius: 12px;
    transition: transform var(--transition-normal);
}

.project-card:hover {
    transform: translateY(-4px);
}

.project-image {
    aspect-ratio: 16/9;
    background-color: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: var(--shadow-flat);
    transition: box-shadow var(--transition-normal);
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.project-overlay span {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.875rem;
    transform: translateY(10px);
    transition: transform var(--transition-normal);
}

.project-card:hover .project-image {
    box-shadow: var(--shadow-elevated);
}

.project-card:hover .cover-image {
    transform: scale(1.03);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-card:hover .project-overlay span {
    transform: translateY(0);
}

.project-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0 0.5rem;
}

.project-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-name {
    font-size: 1.5rem;
    margin-bottom: 0;
    flex: 1 1 100%;
    font-weight: 500;
}

.project-year {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* =========================================
   MUSIC SECTION (IPOD STYLE)
========================================= */
.music {
    padding: 8rem 0;
    background-color: var(--bg-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

#heroParticles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind content */
    pointer-events: none;
    /* Let clicks pass through to content */
}

.container-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.ipod-container {
    max-width: 320px;
    width: 100%;
    margin: 3rem auto 0;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.15));
}

.hover-float {
    transition: transform var(--transition-slow);
}

.hover-float:hover {
    transform: translateY(-10px);
}

.ipod-body {
    background: #e8e8e8;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 24px;
    padding: 20px;
    box-shadow:
        inset 1px 1px 3px rgba(255, 255, 255, 0.8),
        inset -1px -1px 4px rgba(0, 0, 0, 0.1),
        0 0 0 1px #d1d1d1,
        0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Metallic rim reflection */
.ipod-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 24px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.ipod-screen {
    width: 100%;
    height: 220px;
    background-color: #000;
    border-radius: 8px;
    border: 4px solid #1a1a1a;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8), 0 1px 1px rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.ipod-controls {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.ipod-wheel {
    width: 180px;
    height: 180px;
    background-color: #ffffff;
    border-radius: 50%;
    position: relative;
    box-shadow:
        inset 0 1px 4px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ipod-wheel-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #e0e0e0 0%, #d1d1d1 100%);
    border-radius: 50%;
    box-shadow:
        inset 1px 1px 2px rgba(255, 255, 255, 0.8),
        inset -1px -1px 2px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.2);
    /* Subtle interaction */
    transition: box-shadow 0.1s;
}

.ipod-wheel-button:active {
    box-shadow:
        inset 1px 1px 3px rgba(0, 0, 0, 0.2),
        inset -1px -1px 2px rgba(255, 255, 255, 0.4);
}

.ipod-wheel span {
    position: absolute;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    pointer-events: none;
}

.ipod-wheel .top {
    top: 15px;
}

.ipod-wheel .bottom {
    bottom: 15px;
}

.ipod-wheel .left {
    left: 15px;
}

.ipod-wheel .right {
    right: 15px;
}

/* Contact Section */
.contact {
    padding: 8rem 0;
    background-color: var(--bg-dark);
    color: var(--text-light);
}

.typography-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10rem 0;
}

.hero-contact-title {
    font-family: 'House Gothic 23', var(--font-sans);
    line-height: 1;
    color: var(--text-light);
    margin-bottom: 4rem;
    display: flex;
    flex-direction: column;
    text-transform: uppercase;
}

.hero-contact-title .line1 {
    font-size: 5rem;
}

.hero-contact-title .line2 {
    font-size: 8rem;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.connect-label {
    color: var(--text-light);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.contact-email {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.05em;
    transition: color var(--transition-fast);
}

.contact-email:hover {
    color: var(--accent-orange);
}

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

.social-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #A44A4A;
    color: white;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.social-circle:hover {
    transform: translateY(-4px);
    background-color: var(--accent-orange);
}

/* Footer */
.footer {
    padding: 3rem 0;
    background-color: #111;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand h3 {
    color: white;
    margin-bottom: 0.25rem;
    font-size: 1.125rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a:hover {
    color: white;
}

/* =========================================
   ANIMATIONS & UTILITIES
========================================= */

/* Initial states for intersection observer */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in {
    opacity: 0;
    transition: opacity 1s ease-out;
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Active states applied via JS */
.is-visible {
    opacity: 1;
    transform: translate(0);
}

/* Delays */
.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

.delay-4 {
    transition-delay: 0.5s;
}

/* Responsive */
@media (max-width: 900px) {
    .hero-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .hero-intro {
        padding-left: 0;
        text-align: center;
    }

    .hero-card {
        height: auto;
        min-height: 400px;
        margin-top: -2rem;
    }

    .hero-card-content {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        padding: 2rem;
        margin: 0 auto;
        text-align: center;
        max-width: 100%;
    }

    .hero-image-container {
        position: relative;
        width: 100%;
        height: 400px;
        right: 0;
        margin-top: -8rem;
        justify-content: center;
        align-items: flex-end;
    }

    /* Fix contact scaling */
    .hero-contact-title {
        margin-bottom: 2rem;
    }

    .hero-contact-title .line1 {
        font-size: clamp(1.5rem, 8vw, 5rem);
    }

    .hero-contact-title .line2 {
        font-size: clamp(2rem, 12vw, 8rem);
    }

    .typography-contact {
        padding: 5rem 1rem;
    }

    .hero-image {
        object-position: bottom center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.25rem;
    }

    .nav-links {
        display: none;
        /* simple mobile menu not fully implemented for brevity */
    }

    .menu-toggle {
        display: flex;
    }

    .split-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    /* Music section mobile spacing */
    .music {
        padding: 4rem 0;
    }

    .ipod-container {
        transform: scale(0.9);
        transform-origin: top center;
    }

    .hero-name {
        font-size: clamp(2.5rem, 12vw, 4.5rem);
    }

    .contact-email {
        font-size: clamp(1rem, 5vw, 1.5rem);
        word-break: break-all;
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }
}

/* =========================================
   GLANCE MODE MODAL (Zen Browser Style)
========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.5s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background-color: var(--bg-primary);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    /* Apple style maximize start scale */
    transform: scale(0.65) translateY(40px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.6s cubic-bezier(0.32, 0.72, 0, 1);
    position: relative;
    overflow: hidden;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-dialog.fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    transform: scale(1) translateY(0) !important;
}

.modal-fullscreen {
    position: absolute;
    top: 1.5rem;
    right: 4.5rem; /* Next to close button */
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}

.modal-fullscreen:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.modal-fullscreen svg {
    color: var(--text-primary);
    transition: transform var(--transition-fast);
}

.modal-fullscreen:hover svg {
    transform: scale(1.1);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: background-color var(--transition-fast);
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.modal-close .bar {
    width: 16px;
    height: 2px;
    background-color: var(--text-primary);
    position: absolute;
}

.modal-close .bar:first-child {
    transform: rotate(45deg);
}

.modal-close .bar:last-child {
    transform: rotate(-45deg);
}

.modal-content {
    overflow-y: auto;
    padding: 3rem;
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-category {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-orange);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-title {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
}

.modal-year {
    color: var(--text-secondary);
    font-size: 1rem;
}

.modal-hero-img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-flat);
}

.modal-cta-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background-color: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
}

.modal-cta-banner.hidden {
    display: none;
}

.modal-cta-banner .cta-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-cta-banner .cta-btn {
    flex-shrink: 0;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .modal-cta-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1rem;
        padding: 1.25rem;
    }
}

.modal-details {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.detail-block h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.detail-block p {
    font-size: 1.05rem;
    line-height: 1.6;
}

.detail-block.full-width {
    grid-column: 1 / -1;
}

.tag-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tag-list li {
    font-size: 0.95rem;
    font-weight: 500;
}

.tag-list li::before {
    content: '— ';
    color: var(--accent-orange);
}

.modal-links {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.modal-link:hover {
    opacity: 0.7;
}

.modal-link svg {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.modal-link:hover svg {
    color: var(--accent-orange);
}

.modal-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* If there are exactly 3 images, make the first one span full width */
.modal-gallery img:first-child:nth-last-child(3) {
    grid-column: 1 / -1;
    aspect-ratio: 16/9;
}

.gallery-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    object-position: top center;
    /* Ensures the top of the screenshot is visible */
    border-radius: 8px;
    box-shadow: var(--shadow-flat);
    transition: transform var(--transition-normal);
    cursor: zoom-in;
    /* Indicate it can be clicked */
}

.gallery-img:hover {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .modal-content {
        padding: 2rem 1.5rem;
    }

    .modal-details {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .modal-gallery {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   FULLSCREEN IMAGE LIGHTBOX
========================================= */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 2000;
    /* Above the project modal */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    cursor: zoom-out;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-overlay.active .lightbox-img {
    transform: scale(1);
}