/* --- CSS Variables: SNES Palette --- */
:root {
    --bg-color: #c4c4cc; /* SNES Console Grey */
    --panel-bg: #e0e0e8;
    --text-color: #2a2a35;
    
    /* SNES Button Colors (PAL/Super Famicom) */
    --snes-blue: #004b8d;
    --snes-red: #d11231;
    --snes-yellow: #ffb500;
    --snes-green: #008744;
    --snes-orange: #f37021; /* Bonus Stage Color */
    
    /* North American SNES Purple variants */
    --snes-purple: #5b3e8e;
    --snes-light-purple: #9a84b5;

    /* Pixel Borders */
    --border-color: #000;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    /* subtle pattern */
    background-image: 
        radial-gradient(#999 1px, transparent 1px);
    background-size: 10px 10px;
}

/* CRT Scanline Overlay */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.1) 50%,
        rgba(0,0,0,0.1)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* 16-bit Panel Style */
.panel {
    background-color: var(--panel-bg);
    border: 4px solid var(--border-color);
    box-shadow: 
        inset -4px -4px 0px rgba(0,0,0,0.2),
        inset 4px 4px 0px rgba(255,255,255,0.7),
        8px 8px 0px rgba(0,0,0,0.5);
    padding: 2rem;
    margin-bottom: 3rem;
}

/* Top Section Layout */
.top-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (min-width: 1024px) {
    .top-section {
        flex-direction: row;
        align-items: stretch;
    }
    
    .top-section .hero, 
    .top-section .about-me {
        flex: 1;
        margin-bottom: 0;
    }
}

/* Hero Section */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: #1a1a24;
    color: #fff;
    border-color: #fff;
    box-shadow: 
        inset -4px -4px 0px rgba(0,0,0,0.5),
        inset 4px 4px 0px rgba(255,255,255,0.2),
        8px 8px 0px rgba(0,0,0,0.5);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 768px) {
    .hero-content {
        flex-direction: row;
        text-align: left;
    }
}

.avatar-container {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    border: 4px solid #fff;
    box-shadow: 4px 4px 0px var(--snes-purple);
    background-color: var(--snes-light-purple);
    overflow: hidden;
    position: relative;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease;
}

.avatar-pixel {
    image-rendering: pixelated;
    opacity: 1;
}

.avatar-original {
    opacity: 0;
}

.avatar-container:hover .avatar-pixel {
    opacity: 0;
}

.avatar-container:hover .avatar-original {
    opacity: 1;
}

.hero-text h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    text-shadow: 4px 4px 0px var(--snes-purple);
}

.highlight {
    color: var(--snes-yellow);
}

.subtitle {
    font-size: 0.8rem;
    max-width: 500px;
    line-height: 1.8;
}

.press-start-blink {
    margin-top: 3rem;
    font-size: 1rem;
    color: var(--snes-yellow);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* About Me / Character Stats Section */
.about-me {
    background-color: var(--snes-purple);
    color: #fff;
    border-color: #fff;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed rgba(255,255,255,0.2);
}

.stat-row:last-child {
    border-bottom: none;
}

@media (min-width: 768px) {
    .stat-row {
        flex-direction: row;
    }
    .stat-label {
        width: 150px;
        flex-shrink: 0;
    }
}

.stat-label {
    color: var(--snes-yellow);
}

.stat-value {
    font-size: 0.8rem;
    line-height: 1.6;
}

/* Projects Section */
.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    text-shadow: 3px 3px 0px #fff, 6px 6px 0px var(--border-color);
}

.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .project-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Project Card */
.project-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: transform 0.1s;
    background-color: #fff;
}

.project-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 
        inset -4px -4px 0px rgba(0,0,0,0.2),
        inset 4px 4px 0px rgba(255,255,255,0.7),
        12px 12px 0px rgba(0,0,0,0.5);
}

.card-header {
    padding: 1rem;
    border-bottom: 4px solid var(--border-color);
    color: #fff;
    text-align: center;
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
}

.card-body h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.card-body p {
    font-size: 0.7rem;
    line-height: 1.6;
}

.card-footer {
    padding: 1rem;
    border-top: 4px dotted rgba(0,0,0,0.2);
    text-align: center;
}

/* Buttons */
.btn {
    font-family: 'Press Start 2P', cursive;
    background-color: var(--panel-bg);
    border: 4px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 
        inset -4px -4px 0px rgba(0,0,0,0.2),
        inset 4px 4px 0px rgba(255,255,255,0.7);
    color: var(--text-color);
    transition: transform 0.1s;
}

.btn:active {
    transform: scale(0.95);
    box-shadow: 
        inset 4px 4px 0px rgba(0,0,0,0.2),
        inset -4px -4px 0px rgba(255,255,255,0.7);
}

/* Card Themes based on SNES Buttons */
.color-blue .card-header { background-color: var(--snes-blue); }
.color-blue .btn:hover { background-color: var(--snes-blue); color: #fff; }

.color-red .card-header { background-color: var(--snes-red); }
.color-red .btn:hover { background-color: var(--snes-red); color: #fff; }

.color-yellow .card-header { background-color: var(--snes-yellow); color: var(--text-color); }
.color-yellow .btn:hover { background-color: var(--snes-yellow); }

.color-green .card-header { background-color: var(--snes-green); }
.color-green .btn:hover { background-color: var(--snes-green); color: #fff; }

.color-purple .card-header { background-color: var(--snes-purple); }
.color-purple .btn:hover { background-color: var(--snes-purple); color: #fff; }

.color-orange .card-header { background-color: var(--snes-orange); }
.color-orange .btn:hover { background-color: var(--snes-orange); color: #fff; }

/* Footer */
.footer {
    text-align: center;
    background-color: #1a1a24;
    color: #fff;
    font-size: 0.8rem;
    padding: 1rem;
}

/* Modal / Retro Dialog Box */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background-color: var(--snes-blue);
    color: #fff;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: popIn 0.2s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--snes-yellow);
    text-shadow: 2px 2px 0px #000;
}

.modal-content p {
    margin-bottom: 2rem;
    font-size: 0.8rem;
    line-height: 1.8;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-secondary {
    background-color: var(--bg-color);
}
.btn-secondary:hover {
    background-color: var(--snes-red);
    color: #fff;
}
