/**
 * Legal Documents Stylesheet
 * Mobile-first, responsive design with dark mode support
 */

/* ========================================================================
   Reset & Base Styles
   ======================================================================== */

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

:root {
    /* Light Mode Colors */
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --heading-color: #000000;
    --link-color: #007AFF;
    --link-hover-color: #0051D5;
    --border-color: #e0e0e0;
    --code-bg: #f5f5f5;
    --highlight-bg: #f0f7ff;
    --footer-bg: #f8f9fa;
    --contact-bg: #f9fafb;

    /* Typography */
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Container */
    --max-width: 800px;
}

/* Dark Mode Colors */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --heading-color: #ffffff;
        --link-color: #0A84FF;
        --link-hover-color: #409CFF;
        --border-color: #333333;
        --code-bg: #2a2a2a;
        --highlight-bg: #1e3a5f;
        --footer-bg: #0f0f0f;
        --contact-bg: #242424;
    }
}

/* ========================================================================
   Base Typography
   ======================================================================== */

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

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 0;
    margin: 0;
}

/* ========================================================================
   Container & Layout
   ======================================================================== */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-md);
}

@media (min-width: 768px) {
    .container {
        padding: var(--spacing-xl);
    }
}

/* ========================================================================
   Header
   ======================================================================== */

header {
    text-align: center;
    margin-bottom: var(--spacing-xxl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
}

@media (min-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }
}

.last-updated {
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
}

/* ========================================================================
   Main Content
   ======================================================================== */

main {
    margin-bottom: var(--spacing-xxl);
}

section {
    margin-bottom: var(--spacing-xxl);
}

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

/* ========================================================================
   Typography Elements
   ======================================================================== */

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-lg);
    line-height: 1.4;
}

p {
    margin-bottom: var(--spacing-md);
    line-height: 1.7;
}

strong {
    font-weight: 600;
    color: var(--heading-color);
}

/* ========================================================================
   Lists
   ======================================================================== */

ul, ol {
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-xl);
}

li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
}

ul ul, ol ul, ul ol, ol ol {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

/* ========================================================================
   Links
   ======================================================================== */

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

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ========================================================================
   Contact Info Box
   ======================================================================== */

.contact-info {
    background-color: var(--contact-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.contact-info p {
    margin-bottom: var(--spacing-xs);
}

.contact-info p:last-child {
    margin-bottom: 0;
}

/* ========================================================================
   Footer
   ======================================================================== */

footer {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-xl) 0;
    text-align: center;
    margin-top: var(--spacing-xxl);
}

footer p {
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: var(--spacing-md);
}

footer nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

footer nav a {
    font-size: 0.875rem;
    font-weight: 500;
}

footer .separator {
    color: var(--text-color);
    opacity: 0.4;
}

@media (max-width: 480px) {
    footer nav {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    footer .separator {
        display: none;
    }
}

/* ========================================================================
   Responsive Adjustments
   ======================================================================== */

@media (max-width: 768px) {
    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    ul, ol {
        padding-left: var(--spacing-lg);
    }
}

/* ========================================================================
   Print Styles
   ======================================================================== */

@media print {
    body {
        background-color: white;
        color: black;
        font-size: 12pt;
    }

    header, footer {
        background-color: white;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }
}

/* ========================================================================
   Accessibility
   ======================================================================== */

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-to-main:focus {
    position: static;
    width: auto;
    height: auto;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--link-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
