/* ============================================
   Base Styles
   Reset, typography, layout primitives
   ============================================ */


/* ===========================
   RESET
   =========================== */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

ul,
ol {
    list-style: none;
}


/* ===========================
   TYPOGRAPHY
   =========================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.2;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

h1 {
    font-size: var(--text-4xl);
    letter-spacing: -0.03em;
}

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

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

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

p {
    margin-bottom: var(--space-md);
    color: var(--color-text-muted);
}

strong {
    color: var(--color-text);
    font-weight: 600;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-bg-alt);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

pre {
    font-family: var(--font-mono);
    background: #1e293b;
    color: #e2e8f0;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-lg);
    font-size: var(--text-sm);
    line-height: 1.6;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

::selection {
    background: rgba(67, 56, 202, 0.15);
    color: var(--color-primary-dark);
}

/* Focus-visible ring for accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}


/* ===========================
   LAYOUT PRIMITIVES
   =========================== */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container--narrow {
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}


/* ===========================
   SECTIONS
   =========================== */

.section {
    padding: var(--space-5xl) 0;
    position: relative;
}

.section--alt {
    background: var(--color-bg-alt);
}

.section--dark {
    background: var(--color-bg-dark);
    color: var(--color-text-inverse);
}

.section__header {
    text-align: center;
    margin-bottom: var(--space-3xl);
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.section__label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.section__title {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: 800;
}

.section__subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 650px;
    margin: var(--space-md) auto 0;
}


/* ===========================
   UTILITY CLASSES
   =========================== */

.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;
}

.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
