@font-face {
    font-family: 'Switzer Variable';
    src: url('Switzer-Variable.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg-color: #F0F0F0;
    --text-color: #111111;
    --padding-global: 40px;
    --font-family: 'Switzer Variable', sans-serif;
    --overlay-bg: rgba(240, 240, 240, 0.4);
    --panel-bg: #DBDBDB;
}

/* Manual Dark Theme Toggle */
body.dark-theme {
    --bg-color: #111111;
    --text-color: #F0F0F0;
    --overlay-bg: rgba(17, 17, 17, 0.5);
    --panel-bg: #262626;
}


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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.32;
    -webkit-font-smoothing: antialiased;
    /* Hide overarching scrollbar so only grid scrolls if needed laterally, or page scrolls vertically */
    overflow-x: hidden;
    transition: background-color 0.8s ease, color 0.8s ease;
}

.container {
    padding: var(--padding-global);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* TOP BAR */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    gap: 20px;
}

@media screen and (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 20px;
    }

    .contact-info {
        width: 100% !important;
        flex-direction: column !important;
    }

    .contact-item {
        width: 100% !important;
    }
}

/* Logo is fixed globally — keep a placeholder in the top-bar flex row */
.logo {
    min-width: 50px;
    flex-shrink: 0;
}

/* Invisible placeholder keeping layout space while real logo is fixed */
.logo-placeholder {
    width: 50px;
    height: 50px;
    visibility: hidden;
}

.logo img {
    height: 50px;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* ── Always-visible fixed logo overlay ─────────────────── */
#fixedLogo {
    position: fixed;
    top: var(--padding-global);
    left: var(--padding-global);
    z-index: 1100;
    cursor: pointer;
}

#fixedLogo img {
    height: 50px;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {

    /* Only apply system dark if manual dark is NOT active and body hasn't explicitly been forced light */
    body:not(.light-theme) #fixedLogo img {
        filter: invert(100%) sepia(3%) saturate(163%) hue-rotate(42deg) brightness(115%) contrast(85%);
    }

    body:not(.light-theme) {
        --bg-color: #111111;
        --text-color: #F0F0F0;
        --panel-bg: #262626;
    }
}

/* Manual dark mode for the logo (regardless of system preference) */
body.dark-theme #fixedLogo img {
    filter: invert(100%) sepia(3%) saturate(163%) hue-rotate(42deg) brightness(115%) contrast(85%);
}

.contact-info {
    display: flex;
    flex-direction: column;
    /* 2 columns equal width: 40% */
    width: 40%;
}

.contact-item {
    text-decoration: none;
    color: var(--text-color);
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 450;
    padding: 5px 10px;
    height: 28px;
    display: flex;
    align-items: center;
    border: none;
    background: transparent;
    font-family: inherit;
    border-top: 1.3px solid var(--text-color);
    transition: background-color 0.2s, color 0.2s;
    width: 100%;
    /* For inputs to take full space */
    cursor: pointer;
}

/* Remove default focus outline on inputs and style placeholder */
.contact-item:last-child {
    border-bottom: 1.3px solid var(--text-color);
}

.contact-item:focus {
    outline: none;
    background-color: var(--text-color);
    color: var(--bg-color);
}

.contact-item::placeholder {
    color: var(--text-color);
    opacity: 1;
}

.contact-item:focus::placeholder,
.contact-item:hover::placeholder {
    color: var(--bg-color);
}

.contact-item:first-child {
    margin-top: 0;
}

.contact-item:hover:not(.send-btn) {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.send-btn {
    background-color: var(--text-color);
    color: var(--bg-color);
    justify-content: flex-start;
    /* Ensure left alignment matches padding */
}

.send-btn:hover {
    opacity: 0.9;
}

.middle-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
}

.bio {
    width: 40%;
    margin-bottom: 40px;
    font-size: 14px;
    text-transform: uppercase;
    text-align: justify;
    font-weight: 500;
}

@media screen and (max-width: 768px) {
    .bio {
        width: 100%;
    }
}

.bio p {
    margin-bottom: 1rem;
}

.bio a {
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    padding: 0 2px;
}

.bio a:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    text-decoration: none;
}

.bio p:last-child {
    margin-bottom: 0;
}

.actions-row {
    width: 100%;
    display: flex;
    position: relative;
    margin-top: 40px;
    margin-bottom: 60px;
}

.resume-col {
    width: 20%;
}

.play-col {
    width: 40%;
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
}

@media screen and (max-width: 768px) {}

.resume-col a,
.play-col a {
    color: var(--text-color);
    font-family: "Switzer Variable", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 450;
    line-height: normal;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    height: 28px;
    width: 100%;
    border-top: 1.3px solid var(--text-color);
    border-bottom: 1.3px solid var(--text-color);
    transition: background-color 0.2s, color 0.2s;
    text-decoration: none;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.resume-col a {
    text-decoration-line: underline;
    text-decoration-style: wavy;
    text-decoration-skip-ink: none;
    text-decoration-thickness: 8%;
    text-underline-offset: 16%;
    text-underline-position: from-font;
}

.resume-col a:hover,
.play-col a:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.game-wrapper {
    position: absolute;
    width: 40%;
    height: 0;
    bottom: calc(100% + 40px);
    /* Exactly 40px above the top edge of the buttons */
    right: 0;
}

.game-container {
    position: absolute;
    right: 0;
    bottom: 0;
    /* Anchor to bottom so it extends UPWARDS 300px */
    width: 0;
    /* Starts collapsed */
    height: 300px;
    overflow: hidden;
    /* Hides canvas while collapsed */
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
}

.game-container.active {
    width: 100%;
    /* Expands full width smoothly */
}

@media screen and (max-width: 768px) {
    .game-container {
        position: relative;
        height: 150px;
        /* Reduced height for mobile to fit better */
    }
}

#gameCanvas {
    width: 1000px;
    /* Force inner canvas to be full static width so it doesn't squish during transition */
    height: 300px;
    border-bottom: 1.3px solid var(--text-color);
    float: right;
    /* Keeps the drawn line originating from the right */
}

/* PROJECTS SECTION */
.projects-section {
    margin-top: auto;
    /* Push to bottom naturally */
    width: 100%;
}

/* Hide scrollbar for clean look (optional, but requested for aesthetic) */
.projects-section::-webkit-scrollbar {
    height: 6px;
}

.projects-section::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.projects-grid {
    display: flex;
    gap: 0;
    width: 100%;
    align-items: flex-end;
}

/* Removed mobile grid stacking */

.project-column {
    display: flex;
    flex-direction: column;
    width: 20%;
    position: relative;
}

@media screen and (max-width: 768px) {
    .project-column {
        width: 100%;
    }
}

.project-item {
    position: relative;
    z-index: 2;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 450;
    padding: 5px 10px;
    margin-bottom: 0px;
    border-top: 1.3px solid var(--text-color);
    display: flex;
    align-items: center;
    height: 28px;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
    background-color: transparent;
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.project-item:last-child {
    /* Final border to complete the bottom of the grid */
    border-bottom: 1.3px solid var(--text-color);
}

.project-item:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.column-preview {
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    aspect-ratio: 3/2;
    background-color: #DDDDDD;
    opacity: 0;
    z-index: 10;
    pointer-events: none;
    backface-visibility: hidden;
    transform: translateZ(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    will-change: transform, opacity;
}

.column-preview.active {
    opacity: 1;
}

/* -- MOBILE ACCORDION STYLES -- */
.mobile-details {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    background-color: transparent;
    border-bottom: 1.3px solid var(--text-color);
    display: none;
    /* Only visible on mobile via JS toggle */
    flex-direction: column;
    gap: 20px;
    padding: 0 10px;
}

/* Removed desktop preview hiding on mobile */

.mobile-details.active {
    max-height: 2000px;
    /* Large enough for content */
    opacity: 1;
    padding: 20px 10px;
}

.mobile-blog-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

.mobile-blog-text {
    font-size: 13px;
    line-height: 1.5;
    text-transform: uppercase;
    text-align: justify;
    opacity: 0.9;
    padding-bottom: 20px;
}


/* -- RESPONSIVE BEHAVIOR -- */
@media screen and (max-width: 1024px) {
    .projects-grid {
        gap: 20px;
    }
}

@media screen and (max-width: 768px) {
    .projects-section {
        overflow-x: auto;
    }

    .projects-grid {
        /* Let columns compress or stack */
        flex-wrap: nowrap;
    }

    .main-content {
        max-width: 100%;
    }
}

@media screen and (max-width: 480px) {
    :root {
        --padding-global: 20px;
        /* Reduce padding on tiny screens */
    }

    .top-bar {
        flex-direction: column;
        gap: 20px;
    }

    .projects-grid {
        flex-direction: column;
        width: 100%;
    }

    .project-column {
        width: 100%;
        min-width: 100%;
    }

    .blog-title,
    .blog-image,
    .blog-text {
        width: 90%;
    }

    .panel-content {
        gap: 32px;
    }
}

/* -- CUSTOM SELECTION -- */
::selection {
    background-color: var(--text-color);
    /* #111111 */
    color: var(--bg-color);
    /* #F0F0F0 */
}



/* ─── FULL-PAGE PROJECT PANEL ─────────────────────────────── */

/* Panel sits fixed, full-screen, behind everything initially   */
.project-panel {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
    transform: translateY(100%);
    /* hidden below viewport */
    pointer-events: none;
    will-change: transform;
}

.project-panel.active {
    pointer-events: all;
}


/* ── Top right nav bar: ‹ › × ------------------------------------ */
/* ── Top right close button ------------------------------------ */
/* ── Panel Navigation Grids (5 columns) -------------------------- */
.panel-nav-grid {
    position: absolute;
    left: var(--padding-global);
    right: var(--padding-global);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    z-index: 100;
    pointer-events: none;
}

.panel-top-grid {
    top: var(--padding-global);
}

.panel-bottom-grid {
    bottom: var(--padding-global);
}

.nav-col {
    display: flex;
    width: 100%;
}

.panel-close,
.panel-nav-btn {
    pointer-events: all;
    width: 100%;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 450;
    text-transform: uppercase;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px 10px;
    height: 28px;
    display: flex;
    align-items: center;
    border-top: 1.3px solid var(--text-color);
    border-bottom: 1.3px solid var(--text-color);
    transition: background-color 0.2s, color 0.2s;
    justify-content: flex-start;
    /* Align text to left inside the 1/5 column */
}

.panel-close:hover,
.panel-nav-btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* ── Bottom navigation: PREVIOUS | NEXT -------------------------- */
/* Old bottom nav removed in favor of grid */

/* ── Panel Body Layout (Sidebar + Content) ─────────────────── */
.panel-body {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ── Panel Sidebar (Thumbnails) ─────────────────── */
.panel-sidebar {
    position: absolute;
    left: var(--padding-global);
    /* align precisely under the logo */
    top: 0;
    bottom: 0;
    width: 50px;
    /* Exact width of the logo image */
    z-index: 5;
    overflow-y: auto;
    padding: 130px 0 100px;
    /* Removed side padding so thumbs touch edges */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    /* No space between items as requested */

    /* Hide scrollbar */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.panel-sidebar::-webkit-scrollbar {
    display: none;
}

.panel-thumb {
    width: 100%;
    aspect-ratio: 3/2;
    background-color: transparent;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    opacity: 0.35;
    filter: grayscale(100%);
    /* Default to Black and White */
    transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

.panel-thumb.thumb-light {
    background-color: transparent;
    /* Matches the main background, typically lighter */
}

.panel-thumb.thumb-dark {
    background-color: transparent;
    /* Matches the inverted color, typically darker */
}

.panel-thumb:hover {
    opacity: 0.7;
    filter: grayscale(0);
    /* Reveal color on hover */
}

.panel-thumb.active {
    opacity: 1;
    filter: grayscale(0);
    /* Active is in full color */
    /* Removed scale to keep strict 50px width aligned with logo */
}

/* ── Scrollable Blog Content ─────────────────── */
.panel-content {
    position: absolute;
    inset: 0;
    width: 100%;
    /* take full width so text/images are dead center of screen */
    overflow-y: auto;
    padding-top: 130px;
    /* clear the 90px nav bar + some extra space */
    padding-bottom: 100px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* center children horizontally */
    gap: 24px;
    /* space between blog items reduced from 48px */
}

/* Hide scrollbar for cleaner look (optional but recommended for a premium feel) */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-thumb {
    background-color: var(--text-color);
    border-radius: 3px;
    opacity: 0.2;
    /* Scrollbar opacity doesn't fully work this way directly, but CSS keeps it minimal */
}

.blog-title {
    font-size: 24px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: var(--text-color);
    margin-bottom: 0px;
    /* removed bottom margin to bring image closer */
    width: 40%;
    text-align: center;
}

.blog-image {
    width: 40%;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 6px;
    /* optional slight rounding for a premium feel */
}

.blog-text {
    width: 30%;
    font-size: 14px;
    font-weight: 450;
    /* Match site's slightly heavy text weight */
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.8;
    text-transform: uppercase;
    text-align: justify;
    text-justify: inter-word;
    /* improves justification */
}

/* ── Prevent body scroll when panel is open ──────────────── */
body.modal-open {
    overflow: hidden;
}