:root {
    /* Color Palette - Classic Beige Hardware */
    --desk-bg: #E8E5DF;
    /* Light desk background */
    --plastic-dark: #A49F93;
    --plastic-black: #9B9588;
    --plastic-highlight: #D8D2C4;
    --plastic-shadow: #837E72;
    --hardware-border: #7A7569;

    /* C64 Rainbow Colors */
    --c64-red: #883932;
    --c64-yellow: #C9D487;
    --c64-green: #588D43;
    --c64-blue: #3E31A2;

    /* Screen Colors */
    --screen-bg: #1B1E2B;
    /* Modern dark terminal blue */
    --screen-border: #0A0C12;
    --terminal-green: #37E57C;
    /* Cleaner modern neon green */
    --terminal-cyan: #3DBFD9;
    /* Modern cyan */
    --terminal-dim: #7C829E;

    /* Typography */
    --font-terminal: 'Share Tech Mono', monospace;
    --font-sans: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at center, var(--desk-bg) 0%, #D3CDC5 100%);
    color: var(--terminal-cyan);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* --- Hardware Case Aesthetic --- */

.hardware-case {
    background: linear-gradient(135deg, var(--plastic-highlight) 0%, var(--plastic-dark) 40%, var(--plastic-black) 100%);
    width: 100%;
    max-width: 1200px;
    border-radius: 12px;
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.5),
        inset -5px -5px 15px rgba(0, 0, 0, 0.4),
        15px 15px 40px rgba(0, 0, 0, 0.8);
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border: 1px solid var(--hardware-border);
}

/* Vents */
.vents {
    display: flex;
    gap: 8px;
    width: 100%;
}

.vents-top {
    justify-content: flex-end;
}

.vents-bottom {
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.vent-group {
    display: flex;
    gap: 8px;
}

.vent {
    width: 40px;
    height: 12px;
    background: #4a453e;
    border-radius: 4px;
    box-shadow:
        inset 0 4px 6px rgba(0, 0, 0, 0.8),
        0 1px 1px rgba(255, 255, 255, 0.4);
}

/* Navigation & Branding */
.hardware-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 2rem;
    background: linear-gradient(to bottom, var(--plastic-highlight), var(--plastic-dark));
    border-radius: 8px;
    box-shadow:
        inset 1px 1px 3px rgba(255, 255, 255, 0.8),
        2px 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 10;
    /* Keep above screen */
    position: relative;
}

.nes-logo-link {
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, filter 0.2s ease;
    cursor: pointer;
    position: relative;
    z-index: 11;
}

.nes-logo-link:hover {
    transform: translateY(-2px);
    filter: brightness(1.1) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6));
}

.nes-logo-link:active {
    transform: translateY(1px);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

/* NES Interactive Controller Styles */
.nes-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nes-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#nes-container {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

#nes-container.nes-expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(4);
    z-index: 1001;
    cursor: default;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
}

#nes-container.nes-expanded:hover,
#nes-container.nes-expanded:active {
    /* Override standard nav link hover/active in expanded state */
    transform: translate(-50%, -50%) scale(4);
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
}

.nes-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 24px;
    height: 24px;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    border: none;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    z-index: 1002;
    padding: 0;
    font-family: Arial, sans-serif;
    outline: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nes-close-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    transform: scale(1.1);
}

.nes-close-btn.hidden {
    display: none;
}

#nes-container.nes-expanded .nes-btn {
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

#nes-container.nes-expanded .nes-btn:hover {
    fill: rgba(255, 255, 255, 0.2);
}

#nes-container.nes-expanded circle.nes-btn:hover {
    fill: #ff4c4c;
    /* Bright red for B/A hover */
}

#nes-container.nes-expanded rect[id^="nes-btn-select"]:hover,
#nes-container.nes-expanded rect[id^="nes-btn-start"]:hover {
    fill: #5c5348;
    /* Lighter dark for start/select */
}

.brand {
    display: flex;
    align-items: center;
}

.brand-logo-container {
    height: 50px;
    width: 150px;
    display: flex;
    align-items: center;
}

.brand-img-logo {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.brand-svg-logo {
    height: 100%;
    width: 100%;
}

/* Mechanical Buttons */
.mech-button {
    font-family: var(--font-terminal);
    font-size: 1.1rem;
    font-weight: 600;
    color: #EFEBE1;
    text-decoration: none;
    background: linear-gradient(to bottom, #544D44, #3B352E);
    padding: 0.8rem 1.8rem;
    border-radius: 6px;
    border: 1px solid #2B2621;
    border-top: 2px solid #736B60;
    border-left: 2px solid #665D52;
    box-shadow:
        4px 4px 6px rgba(0, 0, 0, 0.3),
        inset -1px -1px 2px rgba(0, 0, 0, 0.5);
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.6);
    transition: all 0.1s ease;
    cursor: pointer;
    text-transform: uppercase;
    display: inline-block;
    letter-spacing: 1px;
}

.mech-button:hover {
    background: linear-gradient(to bottom, #6B6358, #453F38);
    color: #FFF;
}

.mech-button:active {
    transform: translate(2px, 2px);
    box-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.4),
        inset 2px 2px 5px rgba(0, 0, 0, 0.5);
    border-top: 1px solid #2B2621;
    border-left: 1px solid #2B2621;
}

.primary-btn {
    color: var(--terminal-green);
    background: linear-gradient(to bottom, #304134, #1E2B21);
    border-top: 2px solid #4D6452;
    border-left: 2px solid #435848;
}

/* --- The Screen --- */
.screen-bezel {
    background: #B6B2A0;
    padding: 2rem;
    border-radius: 12px;
    box-shadow:
        inset 4px 4px 10px rgba(0, 0, 0, 0.5),
        inset -2px -2px 5px rgba(255, 255, 255, 0.4);
    border-top: 2px solid #827E6F;
    border-left: 2px solid #827E6F;
}

.screen {
    background-color: var(--screen-bg);
    border-radius: 8px;
    padding: 0 4rem 4rem 4rem;
    /* Completely removed top padding from 2rem to 0 */
    min-height: 600px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6);
    border: 3px solid var(--screen-border);
}

/* CRT Scanline Overlay */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(transparent 0px,
            rgba(0, 0, 0, 0.1) 1px,
            transparent 2px);
    pointer-events: none;
    z-index: 9999;
}

/* Screen Content Typography */
.screen h1,
.screen h2,
.screen h3,
.screen h4,
.screen p {
    font-family: var(--font-terminal);
    text-transform: uppercase;
}

.section-header {
    margin-bottom: 2rem;
    border-bottom: 2px dashed var(--terminal-dim);
    padding-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.8rem;
    color: var(--terminal-green);
}

.section-header p {
    color: var(--terminal-dim);
    font-size: 1.2rem;
}

/* Hero Section */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Changed from center to push content to top */
    min-height: 45vh;
}

.terminal-boot {
    position: absolute;
    /* Ensures it doesn't push the hero content down */
    top: 2rem;
    left: 4rem;
    height: auto;
    font-size: 1.5rem;
    color: var(--terminal-cyan);
    z-index: 10;
    transition: opacity 0.5s ease;
}

.terminal-boot.hidden {
    opacity: 0;
    pointer-events: none;
}

.fade-in-delayed {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 2;
    /* keep above boot text */
}

.fade-in-delayed.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-load {
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    /* Prevent interaction while hidden */
}

.fade-load.visible {
    opacity: 1;
    pointer-events: auto;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 0;
    /* Keep at top */
}

.main-logo-container {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin-top: -6rem;
    /* Pull much closer to the top */
    margin-bottom: -6rem;
    /* Keep tagline tight */
    display: flex;
    justify-content: center;
    align-self: center;
}

.hero-img-logo {
    width: 100%;
    height: auto;
    max-width: 800px;
    display: block;
}

.hero-interactive-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.8rem;
    color: #a0a6c2;
    letter-spacing: 8px;
    margin-top: 0.5rem;
    margin-left: 1.5rem;
    font-weight: normal;
}

.tagline {
    font-size: 2.2rem;
    color: #C1C6DD;
    letter-spacing: 1px;
}

.accent-color {
    color: var(--terminal-green);
}

/* Services Grid */
.services {
    margin-top: 6rem;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

/* Mechanical Panels inside Screen */
.mech-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--terminal-dim);
    padding: 1.5rem;
    position: relative;
    transition: all 0.2s ease;
}

.mech-panel:hover {
    background: rgba(74, 246, 38, 0.05);
    /* Green tint hover */
    border-color: var(--terminal-green);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.card-icon {
    font-size: 1.5rem;
    color: var(--terminal-dim);
    margin-bottom: 1rem;
}

.mech-panel h4 {
    font-size: 1.5rem;
    color: var(--terminal-cyan);
    margin-bottom: 0.5rem;
}

.profile-link {
    color: var(--terminal-cyan);
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.profile-link:hover {
    color: var(--terminal-green);
    text-shadow: 0 0 5px rgba(74, 246, 38, 0.5);
    text-decoration: underline;
}

.mech-panel p {
    font-size: 1.1rem;
    line-height: 1.4;
    color: #a0a6c2;
    text-transform: none;
    /* Keep body text softer */
}

/* Engine Split */
.engines {
    margin-top: 5rem;
}

.engine-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.engine-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--terminal-dim);
    border-left: 4px solid var(--terminal-green);
    padding: 2rem;
    border-radius: 4px;
}

.engine-panel h4 {
    font-family: var(--font-sans);
    font-size: 2rem;
    color: var(--terminal-green);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #C1C6DD !important;
    font-size: 1.2rem !important;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    font-family: var(--font-terminal);
}

.terminal-list {
    list-style: none;
}

.terminal-list li {
    font-family: var(--font-terminal);
    font-size: 1.2rem;
    color: #a0a6c2;
    margin-bottom: 0.5rem;
}

/* Team Grid */
.team {
    margin-top: 6rem;
    margin-bottom: 3rem;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.team-card p.role {
    color: var(--terminal-green);
    margin-bottom: 0.5rem;
}

.team-card p.exp {
    color: var(--terminal-cyan);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.team-card p.credit {
    font-size: 1rem;
    color: #888;
}

.core-team-note {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 4px;
    border-left: 2px solid var(--terminal-dim);
}

.core-team-note p {
    color: var(--terminal-dim);
    text-transform: none;
}

/* Contact Plate */
.contact-plate {
    background: #4A463B;
    padding: 1rem 2rem;
    border-radius: 4px;
    border: 1px solid #2A261D;
    box-shadow:
        inset 2px 2px 5px rgba(0, 0, 0, 0.8),
        1px 1px 1px rgba(255, 255, 255, 0.3);
}

.contact-plate p {
    font-family: var(--font-terminal);
    color: #F8F6E9;
    font-size: 1.2rem;
}

.email-link {
    color: var(--terminal-green);
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.email-link:hover {
    text-decoration: underline;
    text-shadow: 0 0 5px rgba(74, 246, 38, 0.5);
}

@keyframes pulseContact {

    0%,
    100% {
        color: var(--terminal-green);
        text-shadow: none;
    }

    50% {
        color: #df5b33;
        /* Deep Orange */
        text-shadow: 0 0 10px #df5b33;
    }
}

.pulse-alert {
    animation: pulseContact 0.616s 3;
    /* 616ms matches the LED sweep duration */
}

/* Responsive */
@media (max-width: 800px) {
    body {
        padding: 0.5rem;
    }

    .hardware-case {
        padding: 1rem;
        border-radius: 8px;
        margin: 0;
    }

    .screen-bezel {
        padding: 0.5rem;
        border-radius: 8px;
    }

    .screen {
        padding: 0.5rem 1rem 2rem 1rem;
    }

    .hardware-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem 1rem;
    }

    .main-logo-container {
        margin-top: -3rem;
        margin-bottom: -3rem;
    }

    .tagline {
        font-size: 1.5rem;
    }

    .terminal-boot {
        top: 1rem;
        left: 1rem;
        font-size: 1rem;
    }

    .engine-split {
        grid-template-columns: 1fr;
    }

    .vents-bottom {
        flex-direction: column;
        gap: 1rem;
    }

    .contact-plate p {
        font-size: 1rem;
        word-break: break-all;
    }
}

/* LED Indicators */
.led-red {
    background-color: #ff3333 !important;
    box-shadow: 0 0 10px #ff3333, inset 0 2px 4px rgba(255, 255, 255, 0.6) !important;
    transition: background-color 0.1s ease, box-shadow 0.1s ease !important;
}

.led-green {
    background-color: #33ff33 !important;
    box-shadow: 0 0 10px #33ff33, inset 0 2px 4px rgba(255, 255, 255, 0.6) !important;
    transition: background-color 0.05s ease, box-shadow 0.05s ease !important;
}