/* ============================================
   PanForge Design System - Base Styles
   Reset, Typography, Base Elements
   ============================================ */

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

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

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-smoke);
    background: var(--color-bg-dark);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.02;
    z-index: var(--z-overlay);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ----------------------------------------
   Typography
   ---------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: var(--leading-tight);
    color: var(--color-paper);
    letter-spacing: var(--tracking-wide);
}

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

h2 {
    font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl));
}

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

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

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

p:last-child {
    margin-bottom: 0;
}

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

em {
    font-style: italic;
    color: var(--color-teal);
}

a {
    color: var(--color-teal);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-teal-light);
}

/* ----------------------------------------
   Lists
   ---------------------------------------- */
ul, ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-4);
}

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

/* ----------------------------------------
   Code
   ---------------------------------------- */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-slate);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--color-teal);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--color-charcoal);
    color: var(--color-smoke);
    padding: var(--space-6);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
}

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

/* ----------------------------------------
   Images & Media
   ---------------------------------------- */
img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ----------------------------------------
   Blockquotes
   ---------------------------------------- */
blockquote {
    border-left: var(--border-accent);
    padding-left: var(--space-6);
    margin: var(--space-6) 0;
    font-style: italic;
    color: var(--color-ash);
}

/* ----------------------------------------
   Horizontal Rule
   ---------------------------------------- */
hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-teal), transparent);
    margin: var(--space-8) 0;
}

/* ----------------------------------------
   Selection
   ---------------------------------------- */
::selection {
    background: var(--color-teal-dim);
    color: var(--color-paper);
}

/* ----------------------------------------
   Scrollbar (webkit)
   ---------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-charcoal);
}

::-webkit-scrollbar-thumb {
    background: var(--color-stone);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-ash);
}

/* ----------------------------------------
   Focus States
   ---------------------------------------- */
:focus-visible {
    outline: 2px solid var(--color-teal);
    outline-offset: 2px;
}

/* ----------------------------------------
   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-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.text-bronze { color: var(--color-bronze); }
.text-teal { color: var(--color-teal); }
.text-muted { color: var(--color-ash); }

.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

.uppercase { 
    text-transform: uppercase; 
    letter-spacing: var(--tracking-wider);
}
