/**
 * Base Styles - Reset & Fundamental Styles
 * Path: assets/css/base.css
 */

/* ==========================================
   RESET & NORMALIZATION
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: inherit;
}

/* Focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==========================================
   HTML & BODY
   ========================================== */

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 
                 Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }      /* 32px */
h2 { font-size: 1.75rem; }   /* 28px */
h3 { font-size: 1.5rem; }    /* 24px */
h4 { font-size: 1.25rem; }   /* 20px */
h5 { font-size: 1.125rem; }  /* 18px */
h6 { font-size: 1rem; }      /* 16px */

p {
    margin-bottom: 1em;
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity var(--transition);
}

a:hover {
    opacity: 0.8;
}

a:active {
    opacity: 0.6;
}

strong, b {
    font-weight: 600;
}

em, i {
    font-style: italic;
}

small {
    font-size: 0.875em;
}

code {
    font-family: 'Monaco', 'Courier New', monospace;
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

pre {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    background: none;
    padding: 0;
}

/* ==========================================
   LISTS
   ========================================== */

ul, ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

ul {
    list-style-type: disc;
}

ol {
    list-style-type: decimal;
}

li {
    margin-bottom: 0.5em;
}

/* Remove list styles for navigation */
nav ul,
nav ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li {
    margin: 0;
}

/* ==========================================
   FORMS & INPUTS
   ========================================== */

input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--muted-border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* ==========================================
   BUTTONS
   ========================================== */

button {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ==========================================
   IMAGES & MEDIA
   ========================================== */

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

svg {
    fill: currentColor;
}

/* ==========================================
   TABLES
   ========================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--muted-border);
}

th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
}

tr:hover {
    background: var(--surface);
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--muted-border);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--muted-border) var(--surface);
}

/* ==========================================
   SELECTION
   ========================================== */

::selection {
    background: var(--accent);
    color: white;
}

::-moz-selection {
    background: var(--accent);
    color: white;
}

/* ==========================================
   HR (Horizontal Rule)
   ========================================== */

hr {
    border: none;
    border-top: 1px solid var(--muted-border);
    margin: 2rem 0;
}

/* ==========================================
   BLOCKQUOTE
   ========================================== */

blockquote {
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--accent);
    background: var(--surface);
    font-style: italic;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

/* 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-width: 0;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 8px 0;
}

.skip-to-content:focus {
    top: 0;
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    .no-print {
        display: none !important;
    }
}

/* ==========================================
   DARK MODE ADJUSTMENTS
   ========================================== */

@media (prefers-color-scheme: dark) {
    img:not([src*=".svg"]) {
        filter: brightness(0.9) contrast(1.05);
    }
    
    /* Invert images that look better inverted */
    img.invert-dark {
        filter: invert(1);
    }
}   