:root {
    --bg-color: #F2F2F2;
    --text-color: #333;
    --accent-color: #000;
    --paper-color: #fff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

    /* A4 Dimensions */
    --a4-w: 210mm;
    --a4-h: 297mm;

    /* Landscape A4 */
    --a4-l-w: 297mm;
    --a4-l-h: 210mm;
}

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

html {
    background-color: var(--bg-color);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    height: 100dvh;
    overflow: hidden;
    /* No scrolling */
    display: flex;
    flex-direction: column;
}

/* --- Top Bar --- */
.top-bar {
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 40px;
    z-index: 100;
}



.nav-links button {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    margin: 0 10px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
}

.nav-links button:hover {
    color: #000;
}

.nav-links button.active {
    color: #000;
    font-weight: 600;
}

/* --- Main Content --- */
.content-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1500px;
    /* Needed for 3D flip effect */
    overflow: hidden;
}

.view {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    transform: translateY(20px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.view.active-view {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* --- Resume View (PDF) --- */
.pdf-container {
    width: 100%;
    max-width: var(--a4-w);
    height: auto;
    margin: 40px auto;
    box-shadow: var(--shadow);
    border-radius: 4px;
    background: var(--paper-color);
}

.pdf-container canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}


/* --- Portfolio View (Flipbook) --- */
.flipbook-scene {
    width: var(--a4-l-w);
    height: var(--a4-l-h);
    position: relative;
    max-width: 90vw;
    aspect-ratio: 297/210;
    margin: auto;
}

.flipbook {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    /* Smooth shift when opening/closing */
}

/* When book is open, shift it right so the spine is centered */
.flipbook.book-open {
    transform: translateX(50%);
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-origin: left center;
    /* Flip from left spine */
    transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

.page-front,
.page-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    /* Hide back when facing front */
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 2px;
    box-shadow: var(--shadow);
}

.page-back {
    transform: rotateY(180deg);
}



/* Flipped State */
.page.flipped {
    transform: rotateY(-180deg);
}


/* Cover Page Content */
.project-card {
    text-align: center;
}

.project-card h1 {
    font-size: 3rem;
}

.instruction-hint {
    margin-top: 40px;
    font-size: 0.9rem;
    color: #888;
    border: 1px solid #ddd;
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
}

/* Project Layout */
.project-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    height: 100%;
}

.project-image {
    width: 100%;
    height: 100%;
    background: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
}

.project-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-info h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.tags {
    margin-top: 20px;
    font-weight: 600;
    color: #666;
}

/* Mobile Devices */
@media (max-width: 768px) {
    .top-bar {
        position: absolute;
        top: env(safe-area-inset-top, 0);
        left: 0;
        width: 100%;
        height: auto;
        padding: 15px;
        background: transparent;
        pointer-events: none;
        /* Let clicks pass through empty space */
    }

    .nav-links {
        pointer-events: auto;
        /* Re-enable clicks on the buttons */
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .nav-links button {
        margin: 0 5px;
        font-size: 0.9rem;
    }

    .cv-header h1 {
        font-size: 2rem;
    }

    .cv-header h2 {
        font-size: 1.1rem;
    }

    .flipbook-scene {
        width: 100%;
        max-width: 100vw;
        height: auto;
        aspect-ratio: auto;
        padding: 20px;
        margin: 60px 0 0 0;
        /* Clear the floating top bar */
    }

    .flipbook {
        transform: none !important;
        transform-style: flat;
        display: flex;
        flex-direction: column;
        gap: 15px;
        /* Decreased image spacing */
        height: auto;
    }

    .flipbook.book-open {
        transform: none !important;
    }

    .page {
        position: relative !important;
        width: 100%;
        height: auto;
        transform: none !important;
        transition: none;
        top: auto;
        left: auto;
        display: flex;
        flex-direction: column;
        gap: 15px;
        /* Decreased image spacing between front and back */
    }

    .page.flipped {
        transform: none !important;
    }

    .page-front,
    .page-back {
        display: block !important;
        position: relative !important;
        width: 100%;
        aspect-ratio: 297/210;
        /* Lock to Landscape A4 proportion */
        padding: 0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        overflow: hidden;
        transform: none !important;
        /* Cancel CSS 3D back-rotation on phones */
    }

    .page-front:empty,
    .page-back:empty {
        display: none !important;
        /* Delete the gap space if no image was provided for the page */
    }

    .instruction-hint {
        display: none !important;
    }

    .pdf-container {
        max-width: 92vw;
        height: auto;
        margin: 50px auto 20px auto;
        /* Leave room for the floating top buttons */
        border-radius: 4px;
    }
}