html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
    scrollbar-gutter: stable;
    /* Standard properties for cross-browser support */
    scrollbar-width: thin;
    scrollbar-color: #777 #1a1a1a;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

::selection {
    background-color: #1ee;
    color: #000;
}

/* Branded scrollbar for modern browsers */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 5px;
    border: 2px solid #1a1a1a;
}

::-webkit-scrollbar-thumb:hover {
    background: #0af;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #0f0f0f;
    color: #f0f0f0;
    line-height: 1.6;
    overflow-wrap: break-word;
}

header, footer {
    background-color: #1a1a1a;
    padding: 1rem 2rem;
    text-align: center;
}

.site-title {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
    color: #0af;
    text-wrap: balance;
}

.site-title a {
    color: #0af;
    text-decoration: none;
    display: inline-block;
}

.site-title a:hover {
    color: #1ee;
    text-decoration: none;
    transform: translateY(-1px);
}

.site-title a:active {
    transform: translateY(0);
}

/* Skip link - hidden until focused */
.skip-link {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    background: #0af;
    color: #000;
    padding: 0.5rem 1rem;
    z-index: 1000;
    transition: transform 0.3s;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 0 5px 5px;
}

.skip-link:focus {
    transform: translate(-50%, 0);
}

a {
    color: #0af;
    text-decoration: none;
    text-underline-offset: 4px;
    transition: color 0.2s ease-in-out, text-decoration 0.2s ease-in-out, transform 0.2s ease-in-out;
}

a:hover {
    color: #1ee;
    text-decoration: underline;
}

a:active {
    opacity: 0.7;
}

/* Ensure links in content area are underlined for accessibility (WCAG 1.4.1) */
main section a {
    text-decoration: underline;
}

/* Accessibility: Skip link */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: #0af;
    color: #000;
    padding: 8px;
    z-index: 100;
    transform: translateY(-100%);
    transition: transform 0.3s;
    font-weight: bold;
    text-decoration: none;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Updated Nav styles */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    justify-content: center;
}

nav li {
    margin: 0 0.8rem;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

nav li {
    margin: 0.2rem 0.8rem;
}

nav a {
    color: #0af;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

nav a:hover, nav a[aria-current="page"] {
    font-weight: bold;
    display: inline-block;
}

nav a:hover {
    transform: translateY(-1px);
}

nav a:active {
    transform: translateY(0);
}

nav a[aria-current="page"] {
    color: #1ee;
    border-bottom: 2px solid #1ee;
}

/* Focus indicator for keyboard navigation */
:focus-visible {
    outline: 2px solid #1ee;
    outline-offset: 2px;
}

main:focus {
    outline: none;
}

nav a[aria-current="page"] {
    border-bottom: 2px solid #1ee;
}

/* Accessibility: Focus styles */
a:focus-visible {
    outline: 2px solid #1ee;
    outline-offset: 4px;
}

main {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

section {
    /* Bolt: Improves rendering performance for off-screen sections */
    content-visibility: auto;
    contain-intrinsic-size: 0 100px;
    margin-bottom: 2rem;
    background-color: #1e1e1e;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    /* Palette: Subtle entrance animation */
    animation: fadeIn 0.6s ease-out forwards;
    animation: fadeIn 0.6s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover,
section:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    section {
        animation: none;
    }
}

h2, main h1 {
    color: #0af;
    margin-top: 0;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

main h1 {
    font-size: 1.8rem;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
    color: #aaa;
}

/* Custom branded scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #777; /* Palette: Increased contrast for better accessibility */
    border: 3px solid #1a1a1a;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0af;
}

/* Responsive */
@media (max-width: 600px) {
    .site-title {
        font-size: 1.5rem;
    }
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    nav li {
        margin: 0.3rem 0;
    }
    nav li {
        border-bottom: 1px solid #333;
    }
    nav li:last-child {
        border-bottom: none;
    }
    nav a {
        display: block;
        padding: 0.8rem 1rem;
    }
    main {
        margin: 1rem;
        padding: 0 0.5rem;
    }
}
