:root {
    /* Dark Theme (Default) */
    --bg-color: #000;
    --text-color: #fff;
    --text-dim: #888;
    --text-dark: #333;
    --box-bg: rgba(0, 0, 0, 0.8);
    --font-main: 'Tiny5', monospace;
    --avatar-filter: grayscale(100%) contrast(1.1) invert(1);
}

[data-theme="light"] {
    --bg-color: #f4f4f0; /* Paper-like off-white */
    --text-color: #1a1a1a;
    --text-dim: #666666;
    --text-dark: #aaaaaa;
    --box-bg: rgba(255, 255, 255, 0.85);
    --avatar-filter: grayscale(100%) contrast(1.1);
}

::-moz-selection,
::selection {
  color: var(--bg-color);
  background: var(--text-color);
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Matrix Background */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: var(--bg-color);
    opacity: 0.3;
    pointer-events: none;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    transition: opacity 0.5s ease-in-out;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.screen.active {
    opacity: 1;
    z-index: 10;
}

/* Intro Screen */
#intro-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#intro-title {
    font-size: 4rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

/* Responsive intro-title */
@media (max-width: 768px) {
    #intro-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    #intro-title {
        font-size: 1.8rem;
    }
}

#intro-prompt {
    font-size: 1.5rem;
    color: var(--text-dim);
    animation: blink 1s infinite;
}

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

/* Main Screen */
header {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed var(--text-dim);
    background: var(--bg-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

#theme-toggle {
    background: transparent;
    border: 1px solid var(--text-dim);
    color: var(--text-dim);
    padding: 0.3rem 0.8rem;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
}

nav {
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 1.2rem;
    text-transform: uppercase;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--text-color);
}

.wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Pixel Box styling for sections */
.pixel-box {
    border: 2px solid var(--text-color);
    padding: 2rem;
    position: relative;
    background: var(--box-bg);
}

.pixel-box::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border: 2px dashed var(--text-dim);
    z-index: -1;
}

.pixel-box h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

#about {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.description {
    flex: 1;
}

.avatar-container {
    width: 100px;
    height: 100px;
    border: 2px solid var(--text-color);
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-color);
    user-select: none; /* Prevent selection */
    -webkit-user-drag: none;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    filter: var(--avatar-filter);
    pointer-events: none; /* Further prevent interaction */
}

.skills-list {
    list-style-type: square;
    padding-left: 1.5rem;
    color: var(--text-dim);
    font-size: 1.2rem;
}

.skills-list li {
    margin-bottom: 0.5rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (max-width: 600px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
    header {
        flex-direction: column;
        gap: 1rem;
    }
}

.project-card {
    border: 1px solid var(--text-dim);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--box-bg);
}

.project-link {
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

.project-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dark);
    border-top: 2px dashed var(--text-dim);
    background: var(--box-bg);
}

/* Glitch/Flicker Utilities */
.glitch-text {
    position: relative;
    display: inline-block;
}

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