/* Base font settings */
#maths-landing-animation-container,
#maths-main-content-container {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
}

#maths-landing-animation-container {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: #164863;
    color: #EAF6FF;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-align: center;
    opacity: 1;
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.maths-animation-chapter {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.maths-animation-chapter.active {
    opacity: 1;
}

.master-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    line-height: 1.2;
    font-size: 3.5em;
    color: #FADA34;
    position: absolute;
    top: 5vh;
    left: 50%;
    z-index: 10;
    opacity: 0;
    transform: translate(-50%, 20px);
    animation: smooth-fade-in 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
}

@keyframes smooth-fade-in {
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.maths-animation-visual {
    width: 90%;
    height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: scale(0.9);
    animation: visualFadeInScaleUp 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 1.5s forwards;
}

.maths-animation-visual canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

@keyframes visualFadeInScaleUp {
    to { opacity: 1; transform: scale(1); }
}

/* --- Main Content & Buttons after animation --- */
#maths-main-content-container {
    background-image: linear-gradient(45deg, #EAF6FF, #ffffff);
    color: #164863;
    min-height: 100vh;
    padding: 15vh 20px 25vh 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- Welcome Message Hierarchy Styles --- */

/* 1. The Container Strategy: Aligns text block relative to content */
.welcome-wrapper.dashboard-align {
    /* KEY CHANGE: Shrink container to fit text width */
    width: fit-content; 
    max-width: 1000px;
    
    /* Center the container itself on the screen */
    margin: 0 auto 10px auto; 
    
    /* Keep text inside aligned to the left */
    text-align: left; 
}

/* 2. "Hello, Emma." */
.user-greeting {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 2em;
    color: #427D9D; /* Brand Mid Blue */
    margin: 0 0 5px 0;
    padding: 0;
    line-height: 1.2;
}

/* 3. "Welcome to The Story of Maths" */
.brand-welcome {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: 3.5em;
    color: #164863;   /* Brand Dark Blue */
    margin: 0 0 10px 0;
    padding: 0;
    line-height: 1.1;
    text-shadow: 0px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Button Container */
.main-actions {
    /* Increased margin to separate from title */
    margin-top: 30px; 
    display: flex;
    justify-content: center; /* Centers buttons relative to the page */
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1000px;
}

.main-action-button {
    display: inline-block;
    padding: 16px 35px;
    font-size: 1.25em;
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    color: #ffffff;
    background-color: #427D9D;
    border: 2px solid #427D9D;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    min-width: 140px;
    text-align: center;
}

.main-action-button:hover,
.main-action-button:focus {
    color: #427D9D;
    background-color: #ffffff;
    border-color: #427D9D;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    /* Revert to center alignment on mobile for better balance */
    .welcome-wrapper.dashboard-align {
        text-align: center;
        width: 100%; /* Full width on mobile */
    }
    
    .user-greeting { font-size: 1.5em; }
    .brand-welcome { font-size: 2.2em; }
    
    .main-actions {
        justify-content: center;
        margin-top: 25px;
    }
}