/* ============================================
   METACOGNATE — Base Styles
   ============================================ */

/* --- Reset --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle scanline overlay on the whole page */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 229, 199, var(--scanline-opacity)) 2px,
            rgba(0, 229, 199, var(--scanline-opacity)) 4px);
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

h1 {
    font-size: var(--text-5xl);
}

h2 {
    font-size: var(--text-3xl);
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

strong {
    color: var(--text-primary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-dim);
    text-decoration: underline;
}

small {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

code,
.mono {
    font-family: var(--font-mono);
}

blockquote {
    border-left: 3px solid var(--accent);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Lists --- */
ul,
ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-4);
}

li {
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

/* --- Selection --- */
::selection {
    background: var(--accent);
    color: var(--text-inverse);
}

/* --- Focus visible --- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Images --- */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Layout Utilities --- */
.container {
    width: 100%;
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container--narrow {
    max-width: var(--max-width-narrow);
}

.container--wide {
    max-width: var(--max-width-wide);
}

/* --- Screen reader only --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Section spacing --- */
.section {
    padding: var(--space-24) 0;
    position: relative;
}

.section--compact {
    padding: var(--space-16) 0;
}

/* --- Section headers --- */
.section-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-label::before {
    content: '//';
    opacity: 0.5;
}

.section-title {
    margin-bottom: var(--space-4);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    max-width: 640px;
    margin-bottom: var(--space-8);
}

/* --- Dividers --- */
.divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--border) 20%,
            var(--accent-glow) 50%,
            var(--border) 80%,
            transparent 100%);
    margin: var(--space-2) 0;
}

/* --- Fade-in animation (triggered via JS) --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    h1 {
        font-size: var(--text-4xl);
    }

    h2 {
        font-size: var(--text-2xl);
    }

    h3 {
        font-size: var(--text-xl);
    }

    .section {
        padding: var(--space-16) 0;
    }

    .container {
        padding: 0 var(--space-4);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    h1 {
        font-size: var(--text-3xl);
    }
}