.section4-container {
    font-family: 'Inter', sans-serif;
    background-color: #5e208e;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    height: auto;
    padding-top: 100px;
    padding-bottom: 100px;
}

.container {
    width: 100%;
    max-width: 1200px;
    text-align: center;
    margin-left: 50px;
}

.title {
    color: white;
    font-size: 4.5rem;
    font-weight: 500;
    opacity: 0;
    font-family: inconsolata;
    transform: translateY(-30px);
    justify-self: start;
    margin-left: 35px;
    margin-bottom: 50px;
    /* Remove auto animation, controlled by scroll */
}

.title.animate {
    animation: fadeInUp 1s ease forwards 0.2s;
}

.curriculum-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.grade-content {
    max-width: 350px;
    opacity: 0;
    transform: translateX(-50px);
}

.grade-content.right {
    transform: translateX(50px);
    justify-self: start;
}

.grade-content.left {
    justify-self: end;
}

.grade-title {
    color: #dad1e6;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.grade-description {
    color: #dad1e6;
    font-size: 1.6rem;
    line-height: 1.6;
    text-align: left;
    max-width: 300px;
}

.grade-content.right .grade-description {
    text-align: left;
}

.grade-content.left .grade-description {
    text-align: right;
}

.grade-content.right .grade-title {
    text-align: left;
}

.grade-content.left .grade-title {
    text-align: right;
}

.circular-diagram {
    grid-column: 2;
    grid-row: 1 / 3;
    width: 380px;
    height: 380px;
    position: relative;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.circular-diagram.animate {
    animation: diagramAppear 0.1s ease forwards 0s, scaleUp 1s ease forwards 0.1s;
}

.circle-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
}

.circle-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 0;
    transform: scale(0);
    visibility: hidden;
}

.circle-segment:hover {
    background: #433550;
    transform: scale(1.05);
    z-index: 5;
}

.segment-1 {
    top: 0;
    left: 0;
    border-radius: 100% 0 0 0;
    border-right: 4px solid #5e208e;
    border-bottom: 4px solid #5e208e;
    transform-origin: bottom right;
}

.segment-1.animate {
    animation: rotateIn 0.8s ease forwards 0.1s;
}

.segment-2 {
    top: 0;
    right: 0;
    border-radius: 0 100% 0 0;
    border-left: 4px solid #5e208e;
    border-bottom: 4px solid #5e208e;
    transform-origin: bottom left;
}

.segment-2.animate {
    animation: rotateIn 0.8s ease forwards 0.3s;
}

.segment-3 {
    bottom: 0;
    left: 0;
    border-radius: 0 0 0 100%;
    border-right: 4px solid #5e208e;
    border-top: 4px solid #5e208e;
    transform-origin: top right;
}

.segment-3.animate {
    animation: rotateIn 0.8s ease forwards 0.5s;
}

.segment-4 {
    bottom: 0;
    right: 0;
    border-radius: 0 0 100% 0;
    border-left: 4px solid #5e208e;
    border-top: 4px solid #5e208e;
    transform-origin: top left;
}

.segment-4.animate {
    animation: rotateIn 0.8s ease forwards 0.7s;
}

.icon {
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0);
    color: white;
}

.segment-1 .icon.animate { animation: popIn 0.5s ease forwards 0.4s; }
.segment-2 .icon.animate { animation: popIn 0.5s ease forwards 0.6s; }
.segment-3 .icon.animate { animation: popIn 0.5s ease forwards 0.8s; }
.segment-4 .icon.animate { animation: popIn 0.5s ease forwards 1.0s; }

.icon svg {
    width: 100%;
    height: 100%;
    fill: white !important;
    color: white !important;
    stroke: white !important;
    transition: transform 0.3s ease;
}

.circle-segment:hover .icon svg {
    transform: scale(1.2);
    fill: white !important;
    color: white !important;
    stroke: white !important;
}

.center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 140px;
    height: 140px;
    background-color: #5e208e;
    border-radius: 50%;
    z-index: 10;
    pointer-events: none;
}

.center-circle.animate {
    animation: centerGrow 0.8s ease forwards 1.2s;
}

.grade-3-4 {
    grid-column: 1;
    grid-row: 1;
}

.grade-3-4.animate {
    animation: slideInLeft 0.8s ease forwards 0.4s;
}

.grade-5-6 {
    grid-column: 3;
    grid-row: 1;
}

.grade-5-6.animate {
    animation: slideInRight 0.8s ease forwards 0.6s;
}

.grade-7-8 {
    grid-column: 3;
    grid-row: 2;
}

.grade-7-8.animate {
    animation: slideInRight 0.8s ease forwards 0.8s;
}

.grade-9-10 {
    grid-column: 1;
    grid-row: 2;
}

.grade-9-10.animate {
    animation: slideInLeft 0.8s ease forwards 1.0s;
}

/* Keyframes */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

@keyframes diagramAppear {
    to {
        opacity: 1;
        visibility: visible;
    }
}

@keyframes rotateIn {
    0% {
        opacity: 0;
        visibility: hidden;
        background: transparent;
        transform: scale(0);
    }
    1% {
        visibility: visible;
        background: #433550;
    }
    100% {
        opacity: 1;
        visibility: visible;
        background: #433550;
        transform: scale(1);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }
    80% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes centerGrow {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1) rotate(180deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(360deg);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .section4-container {
        padding: 40px 15px;
        min-height: auto;
    }

    .curriculum-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        gap: 40px;
        text-align: center;
        max-width: 600px;
    }

    .circular-diagram {
        grid-column: 1;
        grid-row: 1;
        width: clamp(250px, 60vw, 320px);
        height: clamp(250px, 60vw, 320px);
        justify-self: center;
        margin-bottom: 20px;
    }

    .grade-3-4 {
        grid-column: 1;
        grid-row: 2;
    }

    .grade-5-6 {
        grid-column: 1;
        grid-row: 3;
    }

    .grade-7-8 {
        grid-column: 1;
        grid-row: 4;
    }

    .grade-9-10 {
        grid-column: 1;
        grid-row: 5;
    }

    .grade-content {
        max-width: 100%;
        transform: translateY(30px);
        justify-self: center;
        text-align: center;
        padding: 20px 15px;
    }

    .grade-content.right,
    .grade-content.left {
        justify-self: center;
        transform: translateY(30px);
    }

    .grade-description,
    .grade-content.right .grade-description,
    .grade-content.left .grade-description {
        text-align: center !important;
    }

    .grade-title,
    .grade-content.right .grade-title,
    .grade-content.left .grade-title {
        text-align: center !important;
    }

    .title {
        font-size: 2.5rem;
        margin-left: 0;
    }

    .container {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 3.5rem;
    }

    .circular-diagram {
        width: clamp(200px, 70vw, 280px);
        height: clamp(200px, 70vw, 280px);
    }
    .grade-title {
        font-size: 2rem;
    }

    .grade-description {
        font-size: 1.8rem;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .section4-container *,
    .section4-container *::before,
    .section4-container *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}