:root {
    color-scheme: light dark;
    --primary-light: #f0f0ff;
    --primary-dark: #040418;
    --secondary-light: #9d9dcc;
    --secondary-dark: #282866;
}

body {
    background-color: light-dark(var(--primary-light), var(--primary-dark));
    color: light-dark(var(--primary-dark), var(--primary-light));
    font-family: "Montserrat Regular", Montserrat, sans-serif;
    line-height: 1.5;
    max-width: 700px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Typography */
h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.2rem;
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 1px dashed light-dark(var(--secondary-light), var(--secondary-dark));
    padding-bottom: 5px;
}

h3 {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 25px;
    margin-bottom: 10px;
    color: light-dark(var(--secondary-dark), var(--secondary-light));
}

p {
    margin-bottom: 15px;
}

/* Links */
a {
    color: light-dark(var(--secondary-dark), var(--secondary-light));
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    background-color: light-dark(var(--secondary-dark), var(--secondary-light));
    color: light-dark(var(--primary-light), var(--primary-dark)); /* Inverts colors on hover */
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

nav a {
    margin-right: 15px;
    font-weight: bold;
}

/* Lists */
ul {
    list-style-type: disc;
    padding-left: 20px;
}

li {
    margin-bottom: 15px;
}

.example-list {
    list-style-type: circle;
}

/* Divider */
hr {
    border: 0;
    border-top: 1px solid light-dark(var(--secondary-light), var(--secondary-dark));
    margin: 30px 0;
}

/* Footer */
footer {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 50px;
}

/* Theme toggle slider */
.theme-toggle {
    appearance: none; 
    -webkit-appearance: none;
    cursor: pointer;
    width: 50px;
    height: 26px;
    border-radius: 20px;
    margin: 0;
    background-color: light-dark(var(--secondary-light), var(--secondary-dark));
    transition: background-color 0.3s;
    position: relative;

    /* Icons */
    background-image: url('moon.svg'), url('sun.svg');
    background-repeat: no-repeat;
    background-position: left 8px center, right 8px center;
    background-size: 14px 14px;
}

/* Slider knob */
.theme-toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: var(--primary-light);
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 5;
}

/* Theme logic */
@media (prefers-color-scheme: light) {
    :root:has(.theme-toggle:checked) { color-scheme: dark; }
    .theme-toggle:checked::after { transform: translateX(24px); }
}

@media (prefers-color-scheme: dark) {
    :root:has(.theme-toggle:checked) { color-scheme: light; }  
    .theme-toggle::after { transform: translateX(24px); }
    .theme-toggle:checked::after { transform: translateX(0); }
}

/* Mobile Tweaks */
@media (max-width: 600px) {
    body {
        margin: 20px auto;
    }
}