/**
 * Base Styles - Shared across all course templates
 *
 * This file contains:
 * - CSS Reset
 * - Accessibility foundations
 * - Global utilities
 * - Responsive helpers
 *
 * Each template should define its own theme.css with color variables.
 */

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

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html {
        scroll-behavior: auto;
    }
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

a {
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

/* ============================================================================
   ACCESSIBILITY: Skip Link
   ============================================================================ */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1rem;
    background: var(--color-primary, #38b2ac);
    color: var(--color-white, #ffffff);
    font-weight: 600;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 1rem;
    outline: 3px solid var(--color-focus, #ffd700);
    outline-offset: 2px;
}

/* ============================================================================
   ACCESSIBILITY: Focus States
   ============================================================================ */

:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid var(--color-primary, #38b2ac);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--color-primary, #38b2ac);
    outline-offset: 2px;
}

/* ============================================================================
   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: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================================================
   GLOBAL UTILITIES
   ============================================================================ */

/* Prevent text selection */
.no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* Prevent horizontal overflow */
.overflow-wrap {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Clearfix */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Hide elements visually but keep for screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Hide completely */
.hidden {
    display: none !important;
}

/* ============================================================================
   RESPONSIVE HELPERS
   ============================================================================ */

/* Mobile only */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Desktop only */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Tablet and up */
@media (min-width: 768px) {
    .show-tablet-up {
        display: block !important;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}
