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

body {
    background-color: #fffaed;
    color: #000000;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 3rem;
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.back-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    color: #000000;
    font-size: 1.4rem;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.back-arrow:hover {
    background-color: rgba(0, 0, 0, 0.06);
    transform: translateX(-2px);
}

.back-arrow svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.cv-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.cv-nav a {
    color: #000000;
    text-decoration: none;
    text-transform: uppercase;
    position: relative;
    padding: 0.2rem 0;
    transition: color 0.3s ease;
    font-weight: 700;
}

.cv-nav a::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 1.5px;
    bottom: 0;
    left: 0;
    background-color: #000000;
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cv-nav a:hover {
    color: #333333;
}

.cv-nav a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.cv-nav a.active-page::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.cv-nav .separator {
    color: #000000;
    font-weight: 700;
    user-select: none;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.25s ease, transform 0.2s ease;
}

.lang-toggle:hover {
    background-color: rgba(0, 0, 0, 0.06);
    transform: scale(1.1);
}

.lang-toggle svg {
    width: 42px;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* Top Bar Right */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Menu Toggle (Hamburger) */
.menu-toggle {
    display: none;
    /* Hidden on desktop */
    position: relative;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
    z-index: 105;
}

.menu-toggle .hamburger-line {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #000000;
    border-radius: 3px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.3s ease;
    transform-origin: center;
}

/* Active hamburger animation */
.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* Backdrop Overlay */
.menu-backdrop {
    display: none;
}

.portfolio-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 3rem 2.5rem;
    animation: fadeIn 0.6s ease forwards;
}

#card-showreel {
    grid-column: 1 / -1;
}

.portfolio-card {
    position: relative;
    display: block;
    width: 100%;
    text-decoration: none;
    color: #000000;
    overflow: hidden;
    background-color: #ffffff;
    border-radius: 12px;
    border: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.card-large {
    height: 270px;
}

.card-thin {
    height: 135px;
}

.portfolio-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    filter: grayscale(100%);
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s ease, filter 0.6s ease;
    z-index: 1;
}

.card-bg.active {
    opacity: 0.45;
}

.portfolio-card:hover .card-bg.active {
    opacity: 0.75;
    filter: grayscale(0%);
    transform: scale(1.03);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 250, 237, 0);
    transition: background-color 0.5s ease;
    z-index: 1;
}

.portfolio-card:hover .card-overlay {
    background-color: rgba(255, 250, 237, 0.15);
}

.card-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: none;
    text-align: center;
    z-index: 2;
    color: #000000;
    width: 90%;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .portfolio-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 2rem 2rem 4rem;
    }

    .card-large {
        height: 260px;
    }

    .card-thin {
        height: 130px;
    }
}

@media (max-width: 600px) {
    .top-bar {
        padding: 1rem 1.2rem;
    }

    .top-bar-left {
        gap: 0.75rem;
    }

    .cv-nav {
        gap: 0.35rem;
        font-size: clamp(0.7rem, 3.5vw, 0.9rem);
    }

    .back-arrow {
        width: 34px;
        height: 34px;
    }

    .back-arrow svg {
        width: 18px;
        height: 18px;
    }

    .portfolio-container {
        padding: 1.5rem 1.2rem 3rem;
        gap: 1.5rem;
    }

    .card-large {
        height: 200px;
    }

    .card-thin {
        height: 100px;
    }

    .card-title {
        font-size: 1.25rem;
    }
}

/* Mobile Navigation Dropdown */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
        /* Show hamburger button */
    }

    .menu-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.08);
        /* Very soft dimming, no blur */
        z-index: 90;
        /* Behind header but in front of body content */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    .menu-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    .top-bar {
        background-color: rgba(255, 255, 255, 1) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Target with higher specificity to override other mobile styles */
    .top-bar-left .cv-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: rgba(255, 255, 255, 0.5) !important;
        /* Semi-transparent white background */
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 110;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 0;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        visibility: hidden;
        transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.35s ease,
            visibility 0.35s ease;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    }

    .top-bar-left .cv-nav.active {
        max-height: 350px;
        opacity: 1;
        visibility: visible;
    }

    .top-bar-left .cv-nav a {
        display: block;
        padding: 1.2rem 2rem;
        width: 100%;
        text-align: center;
        font-size: 1.1rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        border-bottom: 1px solid rgba(0, 0, 0, 0.04);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .top-bar-left .cv-nav a:hover,
    .top-bar-left .cv-nav a:active {
        background-color: rgba(0, 0, 0, 0.03);
    }

    .top-bar-left .cv-nav a:last-child {
        border-bottom: none;
    }

    /* Disable underline hover effect on mobile */
    .top-bar-left .cv-nav a::after {
        display: none !important;
    }

    /* Hide separators on mobile */
    .top-bar-left .cv-nav .separator {
        display: none !important;
    }
}

/* Modal Overlay Sub-portfolio */
body.no-scroll {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fffaed;
    z-index: 95;
    /* below top-bar (100) */
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
}

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

.modal-content {
    min-height: calc(100vh - 88px);
    margin-top: 88px;
    /* offset the top-bar */
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    /* align items to the left */
    padding: 3rem 3rem 5rem;
    /* matching portfolio padding */
    gap: 3rem;
}

.modal-back-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #000000;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.25s ease;
}

.modal-back-arrow:hover {
    transform: translateX(-4px);
}

.modal-back-arrow svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.modal-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 0.1s;
}

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

@media (max-width: 900px) {
    .modal-content {
        margin-top: 88px;
        padding: 2rem 2rem 4rem;
        justify-content: flex-start;
        gap: 2rem;
    }

    .modal-cards-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .modal-back-arrow svg {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 600px) {
    .modal-content {
        margin-top: 60px;
        padding: 3.5rem 1.2rem 3rem;
        gap: 1.5rem;
    }

    .modal-back-arrow svg {
        width: 20px;
        height: 20px;
    }
}