@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap');

 /* CSS Variables with Fallbacks */
 :root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --font-family: 'Open Sans', sans-serif;
    --fallback-font: Arial, sans-serif;
    --max-width: 1200px;
    --spacing-unit: 1rem;
}

body {
    font-family: var(--font-family), var(--fallback-font);
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-unit);
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--primary-color);
    animation: fadeIn 2s ease-in-out;
    font-family: var(--font-family), var(--fallback-font); 
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-unit) 0;
}

th, td {
    border: 1px solid black;
    padding: 0.75rem;
    text-align: left;
}

th {
    background-color: var(--primary-color);
    color: white;
}

address {
    font-style: normal;
    margin: var(--spacing-unit) 0;
}

textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    margin: var(--spacing-unit) 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: color-mix(var(--secondary-color), black 10%);
}

#homepage {
    text-align: center;
    width: 100px; 
    height: 40px; 
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid black; 
    background-color: lightgray; 
    margin: auto; 
    padding: 5px; 
    border-radius: 5px;
}

#homepage a {
    text-decoration: none;
    color: black; 
    font-weight: bold; 
}

#homepage:hover {
    background-color: darkgray; 
}

footer {
    text-align: center;
    padding: var(--spacing-unit);
    background-color: #333;
    color: white;
}


@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    th, td {
        padding: 0.5rem;
    }

    textarea {
        font-size: 0.9rem;
    }

    button {
        width: 100%;
        padding: 1rem;
    }
}

/* Small Screens */
@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    table {
        font-size: 0.9rem;
    }

    textarea {
        font-size: 0.8rem;
    }
}

/* Nested and Scoped CSS (Extra Credit) */
main {
    & h3 {
        color: var(--secondary-color);
        font-size: 1.25rem;
    }

    & address {
        font-size: 1rem;
    }
}

:root {
    --bg-color: white;
    --text-color: black;
    --header-color: #007BFF;
    --link-color: #007BFF;
    --font-family: Arial, sans-serif;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-color: #1E90FF;
    --link-color: #1E90FF;
    --font-family: Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s, font-family 0.3s;
}

main {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

h1, h2 {
    color: var(--header-color);
}

section {
    margin-bottom: 40px;
}

picture img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

#theme-toggle {
    color: #007BFF;
    position: fixed;
    top: 10px;
    right: 10px;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    z-index: 1001;
}

#theme-customizer {
    position: fixed;
    top: 60px; 
    right: 10px;
    background: var(--bg-color);
    padding: 10px;
    border: 1px solid var(--text-color);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 250px; 
}

#theme-customizer label {
    display: block;
    margin-bottom: 5px;
}

#theme-customizer input, #theme-customizer select {
    margin-bottom: 10px;
    width: 100%;
}

#save-theme, #reset-theme {
    background-color: var(--header-color);
    color: white;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%; 
    margin-top: 10px;
}

#reset-theme {
    background-color: #ff4444;
}

#reset-theme:hover {
    background-color: #cc0000;
}

#homepage {
    text-align: center;
    margin-top: 20px;
}

#homepage a {
    color: var(--link-color);
    text-decoration: none;
}

#homepage a:hover {
    text-decoration: underline;
}
