/* General Page Styling */
body {
    font-family: system-ui, sans-serif;
    margin: 0 auto;
    padding: 2rem;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    max-width: 1320px; /* Increased by 10% from 1200px (1200 * 1.10 = 1320) */
    box-sizing: border-box;
}

/* Navbar Styling */
.navbar {
    width: 100%;
    background-color: #ffffff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    margin-bottom: 2rem; /* Space below the navbar */
    display: flex;
    justify-content: space-between; /* Space wordmark and nav links */
    align-items: center;
    max-width: 1320px; /* Match body max-width */
    box-sizing: border-box;
}

.navbar .wordmark {
    font-size: 1.8rem;
    font-weight: 700;
    color: #6366f1; /* Primary color */
    letter-spacing: -0.5px;
}

.navbar nav {
    flex-grow: 1; /* Allow nav to take available space */
    display: flex;
    justify-content: center; /* Center nav links */
}

.navbar .nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem; /* Space links evenly */
}

.navbar .nav-link {
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s ease-in-out;
}

.navbar .nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 3px;
    background-color: #6366f1;
    transition: width 0.2s ease-in-out;
}

.navbar .nav-link:hover {
    color: #6366f1;
}

.navbar .nav-link:hover::after {
    width: 100%;
}

.navbar .nav-link.active {
    color: #6366f1;
}

.navbar .nav-link.active::after {
    width: 100%;
}

/* Styling for disabled navigation links */
.nav-links.disabled .nav-link {
    pointer-events: none; /* Disable clicks */
    opacity: 0.5; /* Visually indicate disabled state */
    cursor: not-allowed;
}

.nav-links.disabled .nav-link::after {
    display: none; /* Hide hover effect when disabled */
}


/* Content View Styling */
.content-view {
    width: 100%;
    flex-grow: 1; /* Allows content views to take available space */
    display: none; /* Hidden by default, JS will show the active one */
}

/* Ensure the active view is displayed */
.content-view.active {
    display: block;
}

/* Initial Load Content Styling */
.initial-load-content {
    flex-grow: 1; /* Allows it to take available space and push footer down */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-direction: column; /* For potential future content */
}

.large-centered-button {
    font-size: 1.8rem; /* Much bigger font */
    padding: 0.8rem 3rem; /* Reduced vertical padding, kept horizontal */
    border-radius: 12px; /* Slightly more rounded */
    background-color: #6366f1; /* Primary color */
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); /* More prominent shadow */
    transition: all 0.3s ease-in-out;
    width: 20%; /* Approximately 20% of container width */
    min-width: 250px; /* Ensure it's not too small on tiny screens */
    max-width: 400px; /* Prevent it from becoming too wide on very large screens */
    height: 20vh; /* Approximately 20% of viewport height */
    max-height: 150px; /* Cap the height to prevent it from being excessively tall */
    display: flex; /* Use flex to center text inside button */
    justify-content: center;
    align-items: center;
    text-align: center;
}

.large-centered-button:hover {
    background-color: #4f46e5;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px); /* Slight lift effect */
}


/* Footer Styling */
footer {
    margin-top: auto; /* Pushes footer to the bottom */
    padding: 1rem;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    width: 100%;
    max-width: 1320px; /* Match body max-width */
    box-sizing: border-box;
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it's on top of other content */
    font-size: 1.2rem;
    color: #333;
}

.spinner {
    border: 8px solid #f3f3f3; /* Light grey */
    border-top: 8px solid #6366f1; /* Primary color */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Media Queries for Global Elements */
@media (max-width: 900px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .navbar nav {
        justify-content: space-around; /* Distribute links evenly when stacked */
    }

    .navbar .nav-links {
        width: 100%;
        gap: 0.5rem; /* Reduce gap for smaller screens */
    }

    .navbar .nav-link {
        font-size: 1rem;
    }

    .large-centered-button {
        font-size: 1.5rem;
        padding: 0.8rem 2rem;
        width: 80%; /* Take more width on smaller screens */
        height: 15vh; /* Adjust height for smaller screens */
    }
}

.formula-container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    max-width: 600px;
    margin: 2rem auto; /* Added top margin for spacing */
}
.formula {
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    margin: 20px 0;
}

.fraction {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    margin: 0 8px;
    position: relative;
}

.fraction-top,
.fraction-bottom {
    display: block;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1.2;
}

.fraction-top {
    border-bottom: 2px solid #333;
    margin-bottom: 2px;
}

.fraction-bottom {
    margin-top: 2px;
}

.variable {
    font-style: italic;
    font-weight: 500;
}

.subscript {
    font-size: 0.8em;
    vertical-align: sub;
}

/* Styling for cite */
cite {
    display: block; /* Make it a block-level element for better spacing */
    font-size: 0.9rem;
    color: #777;
    font-style: italic;
    margin-top: 1rem; /* Add some space above the citation */
    padding-left: 1.5rem; /* Indent the citation slightly */
    border-left: 3px solid #ddd; /* Add a subtle left border */
}

cite a {
    color: #6366f1; /* Use primary color for links within the cite */
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

cite a:hover {
    text-decoration: underline;
    color: #4f46e5;
}