/* ═══════════════════════════════════════════════════════════════
   BASE STYLES - Reset & Foundation
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS RESET ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--gb-white);
    background-color: var(--gb-darkest);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scanline effect overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-tooltip);
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(157, 78, 221, 0.02) 2px,
            rgba(157, 78, 221, 0.02) 4px);
    opacity: 0.3;
}

/* ─── TYPOGRAPHY ─── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-pixel);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--gb-white);
}

h1 {
    font-size: var(--text-2xl);
}

h2 {
    font-size: var(--text-xl);
}

h3 {
    font-size: var(--text-lg);
}

h4 {
    font-size: var(--text-md);
}

p {
    margin-bottom: var(--space-4);
}

a {
    color: var(--gb-lightest);
    text-decoration: none;
    transition: color var(--transition-fast);
    position: relative;
}

a:hover {
    color: var(--gb-purple-glow);
}

/* Pixel underline effect */
a.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gb-light);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-base);
}

a.link-underline:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

strong,
b {
    font-weight: 600;
    color: var(--gb-lightest);
}

code {
    font-family: var(--font-mono);
    background: var(--gb-dark);
    padding: var(--space-1) var(--space-2);
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid var(--gb-purple-dim);
    color: var(--gb-lightest);
}

/* ─── IMAGES ─── */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ─── LISTS ─── */
ul,
ol {
    padding-left: var(--space-5);
}

li {
    margin-bottom: var(--space-2);
}

/* ─── SELECTION ─── */
::selection {
    background: var(--gb-light);
    color: var(--gb-white);
}

/* ─── FOCUS STATES ─── */
:focus {
    outline: 3px solid var(--gb-light);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 3px solid var(--gb-light);
    outline-offset: 2px;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--gb-darkest);
    border-left: 2px solid var(--gb-purple-dim);
}

::-webkit-scrollbar-thumb {
    background: var(--gb-purple-dim);
    border: 2px solid var(--gb-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gb-light);
}

/* ─── LAYOUT CONTAINERS ─── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-5);
}

.container-narrow {
    max-width: var(--content-width);
}

/* ─── SECTIONS ─── */
.section {
    padding: var(--space-10) 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.section-title {
    display: inline-block;
    background: var(--gb-darkest);
    color: var(--gb-lightest);
    padding: var(--space-3) var(--space-5);
    margin-bottom: var(--space-4);
    position: relative;
}

/* Pixel corners effect */
.section-title::before,
.section-title::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gb-screen);
}

.section-title::before {
    top: 0;
    left: 0;
}

.section-title::after {
    bottom: 0;
    right: 0;
}

.section-subtitle {
    font-family: var(--font-mono);
    color: var(--gb-dark);
    font-size: var(--text-sm);
}

/* ─── SCREEN/CARD EFFECT ─── */
.screen {
    background: var(--gb-screen);
    border: var(--border-thick);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md), var(--shadow-screen);
    padding: var(--space-5);
    position: relative;
}

.screen::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid var(--gb-dark);
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.3;
}

/* ─── PIXEL BUTTON ─── */
.pixel-btn {
    font-family: var(--font-pixel);
    font-size: var(--text-xs);
    background: var(--gb-lightest);
    color: var(--gb-darkest);
    border: var(--border-pixel);
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.pixel-btn:hover {
    background: var(--gb-light);
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-md);
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.pixel-btn--primary {
    background: var(--gb-darkest);
    color: var(--gb-lightest);
}

.pixel-btn--primary:hover {
    background: var(--gb-dark);
}

/* ─── BADGE/TAG ─── */
.pixel-badge {
    font-family: var(--font-pixel);
    font-size: var(--text-xs);
    background: var(--gb-dark);
    color: var(--gb-lightest);
    padding: var(--space-1) var(--space-3);
    display: inline-block;
    border: 2px solid var(--gb-darkest);
}

.pixel-badge--light {
    background: var(--gb-lightest);
    color: var(--gb-darkest);
}

.pixel-badge--amber {
    background: var(--gb-amber);
    color: var(--gb-black);
}

/* ─── UTILITY CLASSES ─── */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: var(--space-1);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-5 {
    margin-top: var(--space-5);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mb-1 {
    margin-bottom: var(--space-1);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-5 {
    margin-bottom: var(--space-5);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    h1 {
        font-size: var(--text-xl);
    }

    h2 {
        font-size: var(--text-lg);
    }

    .container {
        padding: 0 var(--space-4);
    }

    .section {
        padding: var(--space-8) 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: var(--text-lg);
    }

    .pixel-btn {
        padding: var(--space-2) var(--space-4);
    }
}