/* ============================================
   BASE STYLES - Reset & Global Defaults (v2)
   Depends on: variables.css
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-body);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-body);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
}

/* ========== THEME CLASSES ========== */
body.theme-dark {
    background: var(--color-bg-dark);
    color: var(--color-text-primary);
}

body.theme-light {
    background: var(--color-bg-light);
    color: var(--color-text-dark);
}

body.theme-ivory {
    background: var(--color-bg-ivory);
    color: var(--color-text-dark);
}

body.theme-beige {
    background: var(--color-bg-beige);
    color: var(--color-text-dark);
}

/* ========== SKIP LINK - Accessibility ========== */
.skip-link {
    position: fixed;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-skip-link);
    padding: 12px 24px;
    background: var(--color-bg-dark);
    color: var(--color-text-primary);
    border-radius: var(--radius-small);
    font-size: var(--font-size-small);
    text-decoration: none;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 16px;
    outline: 2px solid var(--color-focus-dark);
    outline-offset: 2px;
}

:is(.theme-light, .theme-beige, .theme-ivory) .skip-link {
    background: var(--current-text);
    color: var(--color-bg-white);
}

/* ========== FOCUS STYLES - Accessibility ========== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.theme-dark :focus-visible {
    outline-color: var(--color-focus-dark);
}

/* Custom focus for interactive elements */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: var(--radius-small);
}

.theme-dark a:focus-visible,
.theme-dark button:focus-visible {
    outline-color: var(--color-focus-dark);
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-light);
    letter-spacing: var(--letter-spacing-title);
    line-height: 1.2;
}

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

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

h3 {
    font-size: var(--font-size-large);
}

p {
    margin-bottom: 1rem;
}

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

/* ========== LINKS ========== */
a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

.theme-dark a {
    color: var(--color-text-muted);
}

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

:is(.theme-light, .theme-beige, .theme-ivory) a {
    color: var(--current-text-muted);
}

:is(.theme-light, .theme-beige, .theme-ivory) a:hover {
    color: var(--current-text);
}

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

/* Lazy loading placeholder */
img[loading="lazy"] {
    background: linear-gradient(135deg, #e5e5e5 0%, #f0f0f0 100%);
}

.theme-dark img[loading="lazy"] {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

/* ========== LISTS ========== */
ul, ol {
    list-style: none;
}

/* ========== BUTTONS ========== */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    touch-action: manipulation; /* Prevent double-tap zoom on mobile */
}

/* ========== SELECTION ========== */
::selection {
    background: rgba(255, 255, 255, 0.2);
}

:is(.theme-light, .theme-beige, .theme-ivory) ::selection {
    background: rgba(0, 0, 0, 0.1);
}

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

/* Visually hidden but accessible */
.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 alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Text transform */
.uppercase { text-transform: uppercase; }

/* Letter spacing */
.letter-spaced { letter-spacing: 2px; }
.letter-spaced-wide { letter-spacing: 4px; }

/* Margin utilities */
.mt-lg { margin-top: var(--spacing-lg); }
.mt-md { margin-top: var(--spacing-md); }
.mt-sm { margin-top: var(--spacing-sm); }

/* ========== RESPONSIVE ========== */
/* Typography scaling handled via CSS variables in variables.css */
