html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7f7f7;
    color: #111;
}

h1 {
    margin: 0;
    font-size: 4rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 1000;
    opacity: 0.98;
}

.brand {
    color: #111;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
}

.nav-tabs {
    display: flex;
    gap: 12px;
}

.nav-tab {
    color: #333;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-tab:hover,
.nav-tab.active {
    background-color: #111;
    color: white;
}

body.nav-open {
    overflow: hidden;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #111;
    border-radius: 999px;
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.35);
    z-index: 1090;
}

.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 82vw);
    padding: 24px 20px;
    background: white;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}

.nav-drawer.open {
    transform: translateX(0);
}

.nav-drawer .nav-tab {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
}

main {
    padding: 0 40px 120px;
}

.home-section {
    justify-content: center;
    padding-top: 96px;
}

.about-me-layout {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 36px;
    align-items: center;
}

.about-me-photo {
    display: flex;
    justify-content: center;
}

.photo-placeholder {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    background-color: #f0f0f0;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
}

.photo-placeholder i {
    font-size: 5rem;
    color: #6b7280;
}

.about-me-copy h1 {
    margin-bottom: 12px;
}

.about-me-intro {
    margin: 0 0 16px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #555;
    max-width: 680px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-links a {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    gap: 10px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.contact-links a:hover {
    color: #111;
}

.contact-links i {
    width: 18px;
    text-align: center;
}

.page-section {
    min-height: calc(100dvh - 72px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 72px 0;
    box-sizing: border-box;
    scroll-margin-top: 88px;
}

.page-section h2 {
    margin-bottom: 10px;
}

.section-heading {
    margin-bottom: 24px;
}

#projects.page-section {
    padding-top: 88px;
}

.section-heading p {
    margin: 6px 0 0;
    color: #555;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

@media (max-width: 600px) {
    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

.project-card {
    display: block;
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.12);
}

.project-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.project-content {
    padding: 16px 18px 20px;
}

.home-project-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.featured-label {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background-color: #111;
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
}

.project-content h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.project-content p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.project-page-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 36px 40px 56px;
    gap: 28px;
}

.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: #111;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

.project-hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 32px;
    align-items: center;
    margin-bottom: 32px;
}

.project-label {
    display: inline-block;
    margin: 0 0 10px;
    padding: 6px 10px;
    background: #111;
    color: white;
    border-radius: 999px;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.project-copy h1 {
    margin-bottom: 14px;
}

.project-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #555;
    max-width: 640px;
}

.detail-card a {
    color: #111;
    text-decoration: underline;
}

.detail-card a:hover {
    color: #000;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn.primary {
    background-color: #111;
    color: white;
}

.action-btn.primary.disabled {
    background-color: #9ca3af;
    color: #f3f4f6;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

.action-btn.secondary {
    background-color: white;
    color: #111;
    border: 1px solid #d1d5db;
}

.project-gallery {
    background: white;
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    border-radius: 16px;
}

.gallery-frame img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    border-radius: 16px;
    display: block;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.85);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.gallery-arrow:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.04);
}

.gallery-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.gallery-arrow.left {
    left: 12px;
}

.gallery-arrow.right {
    right: 12px;
}

.project-gallery .game-frame {
    width: 600px;
    max-width: 100%;
    height: 450px;
    max-height: 100%;
    overflow: hidden;
    background: transparent;
    border: none;
}

.project-gallery .desktop-only-notice {
    display: none;
    width: min(100%, 520px);
    padding: 24px;
    border-radius: 20px;
    background: #111;
    color: white;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.project-gallery .desktop-only-notice i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: inline-block;
}

.project-gallery .desktop-only-notice h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.project-gallery .desktop-only-notice p {
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    line-height: 1.6;
}

.project-gallery .game-embed {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: transparent;
}

.project-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 8px;
}

.detail-card {
    background: white;
    border-radius: 18px;
    padding: 20px 20px 22px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.detail-card h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.detail-card p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

.cv-section {
    justify-content: flex-start;
    padding-top: 88px;
}

.cv-download {
    margin: 8px 0 24px;
}

.cv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.cv-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.cv-card ul {
    margin: 0;
    padding-left: 18px;
    color: #555;
    line-height: 1.7;
}

.cv-card li + li {
    margin-top: 6px;
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px 40px 24px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    box-sizing: border-box;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.04);
    margin-top: auto;
    gap: 20px;
}

.email-container {
    flex: 1;
    text-align: left;
}

.footer-email {
    color: #111;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: inline;
}

.footer-email:hover {
    text-decoration: underline;
}

footer p {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 0.95rem;
    color: #555;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.social-icons {
    flex: 1;
    text-align: right;
}

.social-icons a {
    color: #111;
    font-size: 1.2rem;
    margin-left: 16px;
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-icons a:hover {
    color: #4e4e4e;
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    .project-gallery .game-frame {
        display: none;
    }

    .project-gallery .desktop-only-notice {
        display: block;
    }

    .topbar {
        padding: 16px 20px;
    }

    .nav-tabs {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    main {
        padding: 0 20px 80px;
    }

    .home-section {
        padding-top: 48px;
    }

    .about-me-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }

    .about-me-photo {
        order: -1;
    }

    .contact-links a {
        align-self: center;
    }


    .project-page-main {
        padding: 24px 20px 48px;
    }

    .project-hero {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .project-copy {
        order: 1;
    }

    .project-gallery {
        order: 2;
    }

    .action-buttons {
        flex-direction: column;
    }

    .project-details,
    .cv-grid {
        grid-template-columns: 1fr;
    }

    footer {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .email-container,
    .footer-email,
    .social-icons {
        text-align: center;
    }

    .social-icons {
        margin-left: 0;
    }
}