/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-y: scroll;
}

:root {
    --color-nav: #6b1c2a;
    --color-nav-text: #fff;
    --color-bg: #fff;
    --color-text: #000;
    --color-footer-bg: #f5f5f5;
    --color-footer-text: #333;
    --color-link: #6b1c2a;
    --color-focus: #6b1c2a;
}

body.high-contrast {
    --color-nav: #222;
    --color-nav-text: #fff;
    --color-bg: #000;
    --color-text: #fff;
    --color-footer-bg: #111;
    --color-footer-text: #ccc;
    --color-link: #ccc;
    --color-focus: #fff;
}

/* === Skip Link === */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--color-nav);
    color: var(--color-nav-text);
    padding: 0.5rem 1rem;
    z-index: 100;
    font-size: 1rem;
}

.skip-link:focus {
    left: 0;
}

/* === Typography === */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === Header & Navigation === */
header {
    background-color: var(--color-nav);
    color: var(--color-nav-text);
    padding: 1rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

header h1 small {
    display: block;
    font-size: 0.85rem;
    font-weight: normal;
    margin-top: 0.15rem;
}

nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

nav a {
    color: var(--color-nav-text);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

nav a:hover,
nav a:focus {
    text-decoration: underline;
    outline: 2px solid var(--color-nav-text);
    outline-offset: 2px;
}

nav a[aria-current="page"] {
    font-weight: bold;
    border-bottom: 2px solid var(--color-nav-text);
}

#contrast-toggle {
    background-color: transparent;
    color: var(--color-nav-text);
    border: 2px solid var(--color-nav-text);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#contrast-toggle:hover,
#contrast-toggle:focus {
    background-color: var(--color-nav-text);
    color: var(--color-nav);
    outline: 2px solid var(--color-nav-text);
    outline-offset: 2px;
}

/* === Main Content === */
main {
    max-width: 50rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

section {
    margin-bottom: 2.5rem;
}

section h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

section p {
    margin-bottom: 0.75rem;
}

main h3 {
    font-size: 1.15rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

main p {
    margin-bottom: 1rem;
}

/* === Footer === */
footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid #ddd;
}

body.high-contrast footer {
    border-top-color: #444;
}

.footer-links {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--color-link);
    text-decoration: underline;
    margin: 0 0.5rem;
}

.footer-links a:focus {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.footer-info p {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

/* === Focus visible for keyboard users === */
*:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* === Responsive === */
@media (max-width: 600px) {
    header {
        padding: 0.75rem 1rem;
    }

    header h1 {
        font-size: 1.2rem;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
    }

    nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    #contrast-toggle {
        margin-left: 0;
    }

    main {
        padding: 1.5rem 1rem;
    }
}

/* === Reduced motion preference === */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
