/**
 * BASE.CSS - Typography, Reset, Global Styles
 * Foundation styles that apply site-wide
 * 
 * @package StileSalentino
 * @version 2.1.0
 */

/* =============================================================
   TYPOGRAPHY SYSTEM
   ============================================================= */

.font-display {
    font-family: var(--font-display, system-ui, -apple-system, sans-serif);
}

.font-body {
    font-family: var(--font-body, system-ui, -apple-system, sans-serif);
}

/* Text Size Utilities */
.text-xs { font-size: var(--font-size-xs, 0.75rem); line-height: 1.4; }
.text-sm { font-size: var(--font-size-sm, 0.875rem); line-height: 1.4; }
.text-base { font-size: var(--font-size-base, 1rem); line-height: 1.5; }
.text-lg { font-size: var(--font-size-lg, 1.125rem); line-height: 1.5; }
.text-xl { font-size: var(--font-size-xl, 1.25rem); line-height: 1.4; }
.text-2xl { font-size: var(--font-size-2xl, 1.5rem); line-height: 1.3; }
.text-3xl { font-size: var(--font-size-3xl, 1.875rem); line-height: 1.2; }
.text-4xl { font-size: var(--font-size-4xl, 2.25rem); line-height: 1.1; }
.text-5xl { font-size: var(--font-size-5xl, 3rem); line-height: 1; }

/* Font Weight Utilities */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

/* Text Color Utilities */
.text-primary { color: var(--text-primary, #111827); }
.text-secondary { color: var(--text-secondary, #6b7280); }
.text-muted { color: var(--text-muted, #9ca3af); }
.text-white { color: #ffffff; }
.text-black { color: #000000; }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

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

/* Text Decoration */
.text-underline { text-decoration: underline; }
.text-no-underline { text-decoration: none; }
.text-line-through { text-decoration: line-through; }

/* Line Height */
.text--lh-tight { line-height: 1.2; }
.text--lh-default { line-height: 1.5; }
.text--lh-relaxed { line-height: 1.7; }
.text--lh-loose { line-height: 2; }

/* =============================================================
   GLOBAL RESETS & BASE STYLES
   ============================================================= */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body, system-ui, -apple-system, sans-serif);
    font-size: var(--font-size-base, 1rem);
    line-height: 1.6;
    color: var(--text-primary, #111827);
    background-color: var(--color-background, #ffffff);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

a {
    color: var(--link-color, #2563eb);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover, #1d4ed8);
}

a:focus-visible {
    outline: 2px solid var(--link-color, #2563eb);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Remove default margins */
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, figure {
    margin: 0;
}

/* Lists */
ul, ol {
    padding: 0;
    list-style: none;
}

ul[role="list"], ol[role="list"] {
    list-style: revert;
    padding-left: 1.5rem;
}

/* Tables */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

th, td {
    text-align: left;
    vertical-align: top;
}

/* Forms */
fieldset {
    margin: 0;
    padding: 0;
    border: none;
}

legend {
    padding: 0;
    margin-bottom: var(--space-sm, 0.5rem);
}

/* =============================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================= */

/* Screen reader only content */
.sr-only {
    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;
}

/* Skip links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-primary, #2563eb);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Focus styles for better accessibility */
:focus-visible {
    outline: 2px solid var(--focus-color, #2563eb);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

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

@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a, a:visited {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]:after {
        content: " (" attr(title) ")";
    }
    
    .no-print {
        display: none !important;
    }
    
    h2, h3 {
        page-break-after: avoid;
    }
    
    p, h2, h3 {
        orphans: 3;
        widows: 3;
    }
}

/* =============================================================
   MOTION PREFERENCES
   ============================================================= */

/* Respect user's motion preferences */
@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;
    }
}

/* =============================================================
   RESPONSIVE BASE ADJUSTMENTS
   ============================================================= */

@media (max-width: 768px) {
    body {
        font-size: var(--font-size-sm, 0.875rem);
    }
    
    .text-4xl { font-size: var(--font-size-3xl, 1.875rem); }
    .text-3xl { font-size: var(--font-size-2xl, 1.5rem); }
    .text-2xl { font-size: var(--font-size-xl, 1.25rem); }
}
