/*
 * Maths page refresh
 * Loaded after style4.css so the changes are limited to this page.
 */
body.maths-page {
    --ink: #17324d;
    --blue: #174e78;
    --blue-dark: #123b5b;
    --blue-soft: #eaf3f9;
    --green: #e2f0d8;
    --green-soft: #f3f8ef;
    --border: #d5e1e8;
    --muted: #526777;
    --card: #ffffff;
    margin: 0;
    padding: 0;
    background: #f5f8f6;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    border-radius: 0;
}

.maths-page *,
.maths-page *::before,
.maths-page *::after {
    box-sizing: border-box;
    border-radius: 0;
}

.maths-page img {
    max-width: 100%;
    height: auto;
}

.maths-page .site-header {
    padding: 18px 20px 14px;
    background: var(--green);
    text-align: center;
}

.maths-page .site-brand {
    margin: 0 auto;
    padding: 0;
    text-align: center;
}

.maths-page .responsive {
    display: inline-block;
    width: min(100%, 450px);
    height: auto;
}

.maths-page .navbar,
.maths-page .navbar2,
.maths-page .navbar3 {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 12px clamp(16px, 3vw, 32px);
    background: var(--blue);
    color: #fff;
    border-radius: 0;
    line-height: 1.4;
}

.maths-page .site-nav {
    z-index: 20;
}

.maths-page .logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: auto;
    padding: 0;
    font-size: 1rem;
}

.maths-page .logo img {
    display: block;
    max-height: 48px;
    width: auto;
    max-width: 190px;
    object-fit: contain;
}

.maths-page .nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.maths-page .nav-list li {
    margin: 0;
    padding: 0;
}

.maths-page .nav-list a {
    display: block;
    padding: 9px 11px;
    color: #fff;
    font-size: 0.93rem;
    line-height: 1.35;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 160ms ease, color 160ms ease;
}

.maths-page .site-nav .nav-list a[aria-current="page"] {
    background: #fff;
    color: var(--blue-dark);
    font-weight: 700;
}

.maths-page .nav-list a:hover {
    background: #d9ebf6;
    color: var(--blue-dark);
}

.maths-page .nav-list a:focus-visible,
.maths-page .button:focus-visible,
.maths-page .menu-toggle:focus-visible,
.maths-page .resource-card:focus-visible {
    outline: 3px solid #f4c95d;
    outline-offset: 3px;
}

.maths-page .menu-toggle {
    display: none;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.maths-page .menu-toggle .bar {
    display: block;
    width: 24px;
    height: 2px;
    margin: 0;
    background: #fff;
}

.maths-page .page-content {
    width: min(100% - 36px, 1050px);
    margin: 0 auto;
    padding: 34px 0 42px;
}

.maths-page .intro-section {
    max-width: 850px;
    margin: 0 auto 36px;
    padding: clamp(22px, 4vw, 38px);
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 5px solid #8fbf7b;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(23, 50, 77, .05);
}

.maths-page .eyebrow {
    margin: 0 0 5px;
    padding: 0;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-align: left;
    text-transform: uppercase;
}

.maths-page .page-title {
    margin: 0 0 18px;
    color: var(--blue-dark);
    font-size: clamp(2.1rem, 5vw, 3.2rem);
    line-height: 1.12;
    text-align: left;
}

.maths-page h2 {
    margin: 0 0 12px;
    color: var(--blue-dark);
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    line-height: 1.3;
    text-align: left;
}

.maths-page .intro-section h2 {
    margin-top: 0;
}

.maths-page p {
    margin: 0 0 14px;
    padding: 0;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.75;
    text-align: left;
}

.maths-page .intro-section p:last-child {
    margin-bottom: 0;
}

.maths-page .topic-section,
.maths-page .resources-section {
    margin: 0 0 34px;
}

.maths-page .section-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 0 16px;
}

.maths-page .section-heading h2 {
    margin: 0 0 4px;
}

.maths-page .section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .96rem;
}

.maths-page .section-number {
    display: inline-flex;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: #dcebd4;
    color: #315b2c;
    font-size: .9rem;
    font-weight: 700;
}

.maths-page .topic-panel {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
    padding: 22px;
    background: var(--blue-soft);
    border: 1px solid #cbdde9;
    border-radius: 14px;
}

.maths-page .topic-logo {
    justify-content: center;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.maths-page .topic-logo img {
    max-width: 110px;
    max-height: 90px;
}

.maths-page .topic-panel .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
}

.maths-page .topic-panel .nav-list li {
    min-width: 0;
}

.maths-page .topic-panel .nav-list a {
    height: 100%;
    padding: 11px 13px;
    background: #fff;
    border: 1px solid #d7e4ec;
    border-radius: 8px;
    color: #174e78;
    font-size: .96rem;
    line-height: 1.4;
}

.maths-page .topic-panel .nav-list a:hover {
    background: #d8eaf5;
    border-color: #9bbfd4;
}

.maths-page .tip-box {
    margin: 0 0 16px;
    padding: 14px 18px;
    background: #fff7e4;
    border-left: 4px solid #d6a02d;
    border-radius: 7px;
    color: #604715;
    line-height: 1.6;
}

.maths-page .tip-box strong {
    color: #533b0d;
}

.maths-page .resource-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.maths-page .resource-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 20px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(23, 50, 77, .04);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.maths-page .resource-card:hover {
    transform: translateY(-2px);
    border-color: #9bbfd4;
    box-shadow: 0 8px 18px rgba(23, 50, 77, .09);
}

.maths-page .resource-icon {
    display: inline-flex;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    background: #e3f0dc;
    border-radius: 9px;
    color: #315b2c;
    font-size: 1.3rem;
    font-weight: 700;
}

.maths-page .resource-copy {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.maths-page .resource-copy strong {
    color: var(--blue-dark);
    font-size: 1rem;
    line-height: 1.4;
}

.maths-page .resource-copy span {
    font-size: .92rem;
    line-height: 1.5;
}

.maths-page .resource-copy small {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.5;
}

.maths-page .resource-arrow {
    flex: 0 0 auto;
    color: var(--blue);
    font-size: 1.25rem;
    font-weight: 700;
}

.maths-page .page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 34px 0 0;
}

.maths-page .button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 11px 20px;
    background: #367d36;
    border: 1px solid #367d36;
    border-radius: 8px;
    color: #fff;
    font-size: .96rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background-color 160ms ease;
}

.maths-page .button:hover {
    background: #285f28;
}

.maths-page .button-secondary {
    background: var(--blue);
    border-color: var(--blue);
}

.maths-page .button-secondary:hover {
    background: var(--blue-dark);
}

.maths-page .site-footer {
    display: flex;
    justify-content: center;
    padding: 18px 20px;
    background: var(--blue-dark);
    color: #fff;
    text-align: center;
}

.maths-page .site-footer p {
    margin: 0;
    color: #fff;
    font-size: .85rem;
    text-align: center;
}

/* Tablet and mobile layout */
@media (max-width: 900px) {
    .maths-page .navbar,
    .maths-page .navbar2,
    .maths-page .navbar3 {
        flex-wrap: wrap;
    }

    .maths-page .site-nav {
        z-index: 30;
    }

    .maths-page .menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .maths-page .navbar .nav-list,
    .maths-page .navbar2 .nav-list,
    .maths-page .navbar3 .nav-list {
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        z-index: 50;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
        width: 100%;
        max-height: 0;
        margin: 0;
        padding: 0 14px;
        overflow: hidden;
        visibility: hidden;
        background: var(--blue-dark);
        border: 0;
        box-shadow: 0 8px 14px rgba(0, 0, 0, .15);
        transition: max-height 220ms ease, padding 220ms ease, visibility 220ms;
    }

    .maths-page .navbar .nav-list.active,
    .maths-page .navbar2 .nav-list.active,
    .maths-page .navbar3 .nav-list.active {
        max-height: min(72vh, 560px);
        padding: 12px 14px;
        overflow-y: auto;
        visibility: visible;
        border: 1px solid rgba(255,255,255,.15);
        border-radius: 0 0 10px 10px;
    }

    .maths-page .navbar .nav-list li,
    .maths-page .navbar2 .nav-list li,
    .maths-page .navbar3 .nav-list li {
        width: 100%;
        margin: 0;
    }

    .maths-page .navbar .nav-list a,
    .maths-page .navbar2 .nav-list a,
    .maths-page .navbar3 .nav-list a {
        width: 100%;
        padding: 11px 12px;
        border-radius: 6px;
    }

    .maths-page .navbar2,
    .maths-page .navbar3 {
        display: flex;
        align-items: center;
    }

    .maths-page .topic-panel {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .maths-page .topic-logo {
        display: none;
    }

    .maths-page .topic-panel .nav-list {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: none;
        padding: 0;
        overflow: visible;
        visibility: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .maths-page .topic-panel .nav-list.active {
        max-height: none;
        padding: 0;
        overflow: visible;
        border: 0;
    }

    .maths-page .topic-panel .menu-toggle {
        display: none;
    }

    .maths-page .resource-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .maths-page .site-header {
        padding: 12px 14px;
    }

    .maths-page .page-content {
        width: calc(100% - 28px);
        padding: 22px 0 30px;
    }

    .maths-page .intro-section {
        margin-bottom: 28px;
        padding: 21px 18px;
        border-radius: 11px;
    }

    .maths-page .page-title {
        margin-bottom: 14px;
        font-size: 2.35rem;
    }

    .maths-page .section-heading {
        gap: 10px;
    }

    .maths-page .section-number {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
        font-size: .8rem;
    }

    .maths-page .topic-panel {
        padding: 13px;
        border-radius: 10px;
    }

    .maths-page .topic-panel .nav-list {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .maths-page .topic-panel .nav-list a {
        padding: 12px 13px;
        font-size: .97rem;
    }

    .maths-page .tip-box {
        padding: 13px 14px;
    }

    .maths-page .resource-card {
        padding: 16px 13px;
    }

    .maths-page .page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .maths-page .button {
        width: 100%;
    }

    .maths-page .site-footer {
        padding: 16px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .maths-page *,
    .maths-page *::before,
    .maths-page *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* Firefox narrow-screen layout fix */
@media (max-width: 900px) {
    .maths-page .navbar2,
    .maths-page .navbar3 {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .maths-page .navbar2.topic-panel,
    .maths-page .navbar3.topic-panel {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        align-content: start;
    }

    .maths-page .navbar2 .nav-list,
    .maths-page .navbar3 .nav-list {
        position: static;
        width: 100%;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
        visibility: visible;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .maths-page .navbar2 .nav-list li,
    .maths-page .navbar3 .nav-list li {
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .maths-page .navbar2 .nav-list,
    .maths-page .navbar3 .nav-list {
        grid-template-columns: minmax(0, 1fr);
    }
}
