/* ===========================
   CSS Reset & Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

a:hover {
    opacity: 0.8;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

ul {
    list-style: none;
}

/* ===========================
   CSS Custom Properties
   =========================== */
:root {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --overlay-bg: rgba(0, 0, 0, 0.7);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ===========================
   Container & Layout
   Mobile-First: Base styles for < 480px
   =========================== */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===========================
   Header
   Mobile-First: Base styles for < 480px
   =========================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    transition: background-color 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: scale(1.05);
}

/* Mobile: Navigation hidden by default, shown when active */
.nav {
    position: fixed;
    top: 62px;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.nav-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.nav-link {
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem 2rem;
    width: 100%;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--text-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 80%;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Mobile: Hamburger visible by default */
.hamburger {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
}

.hamburger-line {
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

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

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

/* ===========================
   Hero Section
   Mobile-First: Base styles for < 480px
   =========================== */
.hero {
    position: relative;
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 62px;
}

.hero-logo {
    max-width: min(90%, 350px);
    width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   Contact Section
   Mobile-First: Base styles for < 480px
   =========================== */
.contact-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    margin: 1.5rem 0;
}

.mail-icon-link {
    display: inline-block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mail-icon {
    height: 40px;
    width: auto;
    display: block;
    transition: inherit;
}

.mail-icon-link:hover {
    opacity: 0.7;
    transform: translateY(-3px);
}

/* ===========================
   Projects Section
   Mobile-First: Base styles for < 480px
   =========================== */
.projects {
    padding: 3rem 0;
    min-height: 100vh;
}

.section-title {
    font-size: clamp(1.75rem, 5vw, 2rem);
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Mobile: Single column layout */
.game-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 3rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-image-wrapper {
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
}

.game-image {
    object-fit: contain;
    transition: transform 0.5s ease;
    border-radius: 48px;
}

.game-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.game-title {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.game-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.store-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.store-button {
    display: inline-block;
    transition: transform 0.3s ease;
}

.store-button:hover {
    transform: scale(1.05);
    opacity: 1;
}

.store-button img {
    height: 44px;
    width: auto;
}

/* ===========================
   Footer
   Mobile-First: Base styles for < 480px
   =========================== */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===========================
   Responsive Design: 480px and up (Larger Mobile)
   =========================== */
@media (min-width: 480px) {
    .container {
        padding: 0 20px;
    }

    .hero-logo {
        max-width: min(85%, 400px);
    }

    .mail-icon {
        height: 45px;
    }

    .projects {
        padding: 3.5rem 0;
    }

    .section-title {
        font-size: clamp(2rem, 5vw, 2.5rem);
        margin-bottom: 2.5rem;
    }

    .game-content {
        padding: 1.75rem;
    }

    .game-title {
        font-size: clamp(1.35rem, 3vw, 1.65rem);
    }

    .game-description {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .store-button img {
        height: 46px;
    }
}

/* ===========================
   Responsive Design: 768px and up (Tablet)
   =========================== */
@media (min-width: 768px) {
    .container {
        padding: 0 24px;
    }

    .header {
        padding: 1rem 0;
    }

    .logo img {
        height: 45px;
    }

    /* Tablet: Show full navigation */
    .nav {
        position: static;
        flex: 1;
        display: flex;
        justify-content: center;
        padding: 0;
        transform: none;
        opacity: 1;
        visibility: visible;
        border-bottom: none;
        background-color: transparent;
    }

    .nav-list {
        flex-direction: row;
        gap: 1.5rem;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        width: auto;
        text-align: left;
    }

    /* Tablet: Hide hamburger */
    .hamburger {
        display: none;
    }

    .hero {
        margin-top: 68px;
        height: 55vh;
    }

    .hero-logo {
        max-width: 450px;
    }

    .contact-section {
        padding: 2.5rem 0;
        margin: 2rem 0;
    }

    .mail-icon {
        height: 48px;
    }

    .projects {
        padding: 4.5rem 0;
    }

    .section-title {
        font-size: clamp(2.25rem, 5vw, 2.75rem);
        margin-bottom: 3rem;
    }

    .game-card {
        margin-bottom: 3.5rem;
    }

    .game-content {
        padding: 2rem;
    }

    .game-title {
        font-size: clamp(1.5rem, 3vw, 1.85rem);
        margin-bottom: 1.25rem;
    }

    .game-description {
        font-size: 1rem;
        line-height: 1.75;
        margin-bottom: 0.9rem;
    }

    .store-buttons {
        flex-direction: row;
        gap: 1rem;
        margin-top: 1.75rem;
    }

    .store-button img {
        height: 48px;
    }

    .footer {
        padding: 2rem 0;
    }

    .footer-text {
        font-size: 0.9rem;
    }
}

/* ===========================
   Responsive Design: 1024px and up (Desktop)
   =========================== */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding: 0 32px;
    }

    .header {
        padding: 1rem 0;
    }

    .logo img {
        height: 50px;
    }

    .nav-list {
        gap: 2rem;
    }

    .hero {
        margin-top: 72px;
        height: 60vh;
    }

    .hero-logo {
        max-width: 600px;
    }

    .contact-section {
        padding: 3rem 0;
        margin: 2rem 0;
    }

    .mail-icon {
        height: 50px;
    }

    .projects {
        padding: 6rem 0;
    }

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

    /* Desktop: Two-column grid for game cards */
    .game-card {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-bottom: 4rem;
    }

    .game-content {
        padding: 2rem;
    }

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

    .game-description {
        font-size: 1rem;
        line-height: 1.8;
        margin-bottom: 1rem;
    }

    .store-buttons {
        margin-top: 2rem;
    }

    .store-button img {
        height: 50px;
    }

    .footer {
        padding: 2rem 0;
    }
}

/* ===========================
   Accessibility
   =========================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* Ensure minimum touch target size */
@media (pointer: coarse) {
    .nav-link,
    .hamburger,
    .store-button {
        min-height: 44px;
        min-width: 44px;
    }
}
