/*
 * StudentFocus Design System
 * Base Styles & Resets
 *
 * Foundation styles and modern CSS reset
 */

/* ============================================
   MODERN CSS RESET
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--sf-font-sans);
    font-size: var(--sf-text-base);
    font-weight: var(--sf-font-normal);
    line-height: var(--sf-leading-normal);
    color: var(--sf-neutral-900);
    background-color: var(--sf-neutral-50);
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY BASE
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--sf-font-semibold);
    line-height: var(--sf-leading-tight);
    color: var(--sf-neutral-900);
    margin-bottom: var(--sf-space-4);
}

h1 {
    font-size: var(--sf-text-4xl);
    letter-spacing: var(--sf-tracking-tight);
}

h2 {
    font-size: var(--sf-text-3xl);
}

h3 {
    font-size: var(--sf-text-2xl);
}

h4 {
    font-size: var(--sf-text-xl);
}

h5 {
    font-size: var(--sf-text-lg);
}

h6 {
    font-size: var(--sf-text-base);
    font-weight: var(--sf-font-bold);
}

p {
    margin-bottom: var(--sf-space-4);
    line-height: var(--sf-leading-relaxed);
}

a {
    color: var(--sf-primary-600);
    text-decoration: none;
    transition: color var(--sf-transition-fast);
}

a:hover {
    color: var(--sf-primary-700);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--sf-primary-500);
    outline-offset: 2px;
    border-radius: var(--sf-radius-sm);
}

strong, b {
    font-weight: var(--sf-font-semibold);
}

em, i {
    font-style: italic;
}

small {
    font-size: var(--sf-text-sm);
}

code {
    font-family: var(--sf-font-mono);
    font-size: 0.9em;
    color: var(--sf-primary-700);
    background-color: var(--sf-primary-50);
    padding: 0.125rem 0.25rem;
    border-radius: var(--sf-radius-sm);
}

pre {
    font-family: var(--sf-font-mono);
    font-size: var(--sf-text-sm);
    background-color: var(--sf-neutral-100);
    padding: var(--sf-space-4);
    border-radius: var(--sf-radius-lg);
    overflow-x: auto;
    margin-bottom: var(--sf-space-4);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ============================================
   LISTS
   ============================================ */

ul, ol {
    padding-left: var(--sf-space-6);
    margin-bottom: var(--sf-space-4);
}

li {
    margin-bottom: var(--sf-space-2);
}

/* ============================================
   IMAGES & MEDIA
   ============================================ */

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-radius: var(--sf-radius-md);
}

/* ============================================
   FORMS BASE
   ============================================ */

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

input, textarea, select {
    accent-color: var(--sf-primary-600);
}

/* Remove default button styles */
button {
    background: none;
    border: none;
    cursor: pointer;
}

/* ============================================
   TABLES
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--sf-space-4);
}

th {
    font-weight: var(--sf-font-semibold);
    text-align: left;
    padding: var(--sf-space-3) var(--sf-space-4);
    background-color: var(--sf-neutral-100);
    border-bottom: 2px solid var(--sf-neutral-300);
}

td {
    padding: var(--sf-space-3) var(--sf-space-4);
    border-bottom: 1px solid var(--sf-neutral-200);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: var(--sf-z-modal);
    padding: var(--sf-space-4);
    background-color: var(--sf-primary-600);
    color: white;
    text-decoration: none;
    border-radius: var(--sf-radius-md);
}

.skip-to-main:focus {
    left: var(--sf-space-4);
    top: var(--sf-space-4);
}

/* Screen reader only content */
.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;
}

/* Focus visible styles */
:focus-visible {
    outline: 2px solid var(--sf-primary-500);
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@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;
    }
}

/* ============================================
   SELECTION
   ============================================ */

::selection {
    background-color: var(--sf-primary-200);
    color: var(--sf-primary-900);
}

::-moz-selection {
    background-color: var(--sf-primary-200);
    color: var(--sf-primary-900);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background-color: var(--sf-neutral-100);
}

::-webkit-scrollbar-thumb {
    background-color: var(--sf-neutral-400);
    border-radius: var(--sf-radius-full);
    border: 3px solid var(--sf-neutral-100);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--sf-neutral-500);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--sf-neutral-400) var(--sf-neutral-100);
}

/* ============================================
   UTILITY: CONTAINER
   ============================================ */

.container {
    width: 100%;
    max-width: var(--sf-width-7xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--sf-space-4);
    padding-right: var(--sf-space-4);
}

@media (min-width: 640px) {
    .container {
        padding-left: var(--sf-space-6);
        padding-right: var(--sf-space-6);
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: var(--sf-space-8);
        padding-right: var(--sf-space-8);
    }
}
