/*
 * The look of the whole site: colours, type, header and menu, page sections and the public home page.
 * A school's two colours come from its School Profile: _Layout.cshtml sets --school-color and --school-accent.
 * Everything else is worked out from those two, so text stays readable whatever colours a school picks.
 */

:root {
    --school-color: #1f2a5c;
    --school-accent: #c08a2d;

    /* Browsers that cannot adjust a colour's lightness use the school's colours as they are. */
    --school-dark: var(--school-color);
    --school-text: var(--school-color);
    --school-link: var(--school-color);

    --school-tint: color-mix(in srgb, var(--school-color) 5%, #fff);
    --school-line: color-mix(in srgb, var(--school-color) 16%, #fff);
    --school-muted: #5d6072;

    --heading-font: "Lexend", system-ui, sans-serif;
    --default-font: "Nunito Sans", system-ui, sans-serif;

    /* Names used by custom.css and by page styles */
    --background-color: #fff;
    --default-color: #35384a;
    --heading-color: var(--school-text);
    --accent-color: var(--school-accent);

    --page-width: 100%;
}

@supports (color: oklch(from red l c h)) {
    :root {
        --school-dark: oklch(from var(--school-color) min(l, .3) c h);
        --school-text: oklch(from var(--school-color) min(l, .4) c h);
        --school-link: oklch(from var(--school-accent) min(l, .5) c h);
    }
}

@media (min-width: 1200px) {
    :root {
        --page-width: 1140px;
    }
}

@media (min-width: 1400px) {
    :root {
        --page-width: 1320px;
    }
}

/* Page basics */
html {
    font-size: 14px;
    scroll-padding-top: 4.75rem;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    background: var(--background-color);
    color: var(--default-color);
    font: 400 1rem/1.55 var(--default-font);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    font-family: var(--heading-font);
    font-weight: 600;
}

a {
    color: var(--school-link);
    text-decoration: none;
}

/* :where() keeps this weaker than any class, so tiles and buttons can style their own hover */
:where(a):hover {
    color: var(--school-text);
    text-decoration: underline;
    text-underline-offset: .2em;
}

.btn:hover {
    text-decoration: none;
}

:focus-visible {
    outline: 3px solid var(--school-accent);
    outline-offset: 2px;
}

.section {
    padding: 3.5rem 0;
    background: var(--background-color);
    color: var(--default-color);
    overflow-x: clip;
}

/* A page title outside a form or list, e.g. the public Gallery */
.page-heading {
    max-width: 46rem;
    margin-bottom: 2rem;
}

.page-heading h1 {
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    letter-spacing: -.02em;
}

/* Header and menu */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 1px 0 var(--school-line);
}

.site-header-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 4.75rem;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    margin-right: auto;
    color: var(--school-text);
    font: 600 1.35rem/1.15 var(--heading-font);
    letter-spacing: -.015em;
}

.site-brand:hover {
    text-decoration: none;
}

.site-brand img {
    width: 3.25rem;
    height: 3.25rem;
    object-fit: contain;
}

.site-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-menu a,
.site-menu button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    width: 100%;
    border: 0;
    background: none;
    color: #2b2e40;
    font: 500 1.02rem/1.3 var(--default-font);
    text-align: left;
}

.site-menu a:hover,
.site-menu button:hover {
    color: var(--school-text);
    text-decoration: none;
}

.site-menu .bi-chevron-down {
    font-size: .7em;
    transition: rotate .15s;
}

.site-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .9rem;
    border: 1px solid var(--school-line);
    border-radius: .5rem;
    background: #fff;
    color: var(--school-text);
    font-weight: 700;
}

@media (min-width: 1200px) {
    .site-menu-toggle {
        display: none;
    }

    .site-menu > ul {
        display: flex;
        align-items: center;
        gap: .25rem;
    }

    .site-menu > ul > li {
        position: relative;
    }

    .site-menu > ul > li > a,
    .site-menu > ul > li > button {
        padding: .55rem .8rem;
        border-radius: .5rem;
        white-space: nowrap;
    }

    .site-menu > ul > li > a:hover,
    .site-menu > ul > li > button:hover,
    .site-menu > ul > li > [aria-expanded="true"] {
        background: var(--school-tint);
    }

    .site-menu > ul > li > [aria-current] {
        color: var(--school-text);
        font-weight: 800;
        box-shadow: inset 0 -3px var(--school-accent);
        border-radius: 0;
    }

    .site-menu li > ul {
        position: absolute;
        top: 100%;
        right: 0;
        visibility: hidden;
        min-width: 15rem;
        padding: .5rem;
        border: 1px solid var(--school-line);
        border-radius: .6rem;
        background: #fff;
        box-shadow: 0 14px 34px rgb(20 22 45 / 14%);
    }

    .site-menu li:hover > ul,
    .site-menu [aria-expanded="true"] + ul {
        visibility: visible;
    }

    .site-menu li > ul a {
        padding: .55rem .75rem;
        border-radius: .4rem;
    }

    .site-menu li > ul a:hover,
    .site-menu li > ul [aria-current] {
        background: var(--school-tint);
    }

    .site-menu > ul > li > .site-menu-cta {
        width: auto;
        margin-left: .5rem;
        padding-inline: 1.2rem;
        border-radius: .5rem;
        background: var(--school-dark);
        box-shadow: none;
        color: #fff;
    }

    .site-menu > ul > li > .site-menu-cta:hover {
        background: var(--school-text);
        color: #fff;
    }
}

@media (max-width: 1199.98px) {
    .site-menu {
        position: absolute;
        inset: 100% 0 auto;
        display: none;
        max-height: calc(100vh - 100%);
        max-height: calc(100dvh - 5.1rem);
        padding: .5rem 1rem 1.5rem;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-top: 1px solid var(--school-line);
        background: #fff;
        box-shadow: 0 18px 30px rgb(20 22 45 / 16%);
    }

    .site-menu.is-open {
        display: block;
    }

    .site-menu > ul > li + li {
        border-top: 1px solid var(--school-line);
    }

    .site-menu a,
    .site-menu button {
        min-height: 3.25rem;
        padding: .5rem .25rem;
        font-size: 1.15rem;
    }

    .site-menu [aria-current] {
        color: var(--school-text);
        font-weight: 800;
    }

    .site-menu li > ul {
        display: none;
        padding: 0 0 .75rem 1rem;
    }

    .site-menu [aria-expanded="true"] + ul {
        display: block;
    }

    .site-menu [aria-expanded="true"] .bi-chevron-down {
        rotate: 180deg;
    }

    .site-menu li > ul a {
        min-height: 2.9rem;
        font-size: 1.05rem;
    }
}

@media (max-width: 575.98px) {
    .site-brand {
        font-size: 1.15rem;
    }

    .site-brand img {
        width: 2.6rem;
        height: 2.6rem;
    }
}

/* Footers (their layout is in custom.css) */
.site-footer,
.staff-footer {
    background: var(--school-dark);
    color: #fff;
}

/* Back to the top of a long page */
.to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 900;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    background: var(--school-dark);
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px rgb(20 22 45 / 28%);
}

.to-top[hidden] {
    display: none;
}

/* Shown over the page while a spreadsheet uploads; the page's script changes it to flex */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    background: rgb(15 16 30 / 60%);
}

/* One line of text, cut short with an ellipsis */
.truncate-single {
    max-width: 36rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dashboard: this term's figures, each linking to its list */
.term-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: 1rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.term-figure {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 1rem;
    height: 100%;
    padding: 1.1rem 1.25rem;
    border: 1px solid #e3e3ec;
    border-left: 4px solid var(--school-accent);
    border-radius: .5rem;
    color: var(--school-muted);
}

.term-figure:hover {
    background: var(--school-tint);
    text-decoration: none;
}

.term-figure strong {
    grid-row: 2;
    color: var(--school-text);
    font: 600 1.9rem/1.25 var(--heading-font);
    font-variant-numeric: tabular-nums;
}

.term-figure .bi {
    grid-area: 1 / 2 / span 2;
    align-self: center;
    color: var(--school-text);
    font-size: 1.6rem;
}

/* Public home page: opening screen. The right side shows the school's own pictures, or its tie stripes. */
.welcome {
    display: grid;
    grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
    min-height: min(44rem, 82vh);
    padding: 2rem max(.75rem, calc((100% - var(--page-width)) / 2 + .75rem));
}

.welcome-text {
    align-self: center;
    padding: 2rem 4rem 2rem 0;
}

.welcome h1 {
    margin: 0;
    font-size: clamp(2.6rem, 5vw, 4.6rem);
    line-height: 1.04;
    letter-spacing: -.035em;
    text-wrap: balance;
}

.welcome h1 small {
    display: block;
    margin-bottom: .6rem;
    color: var(--school-muted);
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: 0;
}

.welcome-tagline {
    margin: 1rem 0 0;
    color: var(--school-link);
    font: 500 1.35rem/1.4 var(--heading-font);
}

.welcome-intro {
    max-width: 60ch;
    margin: 1.25rem 0 0;
    font-size: 1.15rem;
}

.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 2rem;
}

.action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .85rem 1.4rem;
    border: 2px solid var(--school-dark);
    border-radius: .6rem;
    background: #fff;
    color: var(--school-dark);
    font-size: 1.1rem;
    font-weight: 700;
}

.action:hover,
.action-main {
    background: var(--school-dark);
    color: #fff;
    text-decoration: none;
}

.action-main:hover {
    border-color: var(--school-text);
    background: var(--school-text);
}

.action:disabled {
    opacity: .6;
}

.welcome-reach {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.75rem;
    margin: 1.5rem 0 0;
    color: var(--school-muted);
}

.welcome-picture {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 20rem;
    overflow: hidden;
    border-radius: 1rem;
    background: var(--school-dark);
}

.welcome-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.welcome-cutout {
    position: relative;
    width: min(84%, 34rem);
    max-height: 40rem;
    object-fit: contain;
}

.welcome-crest {
    display: grid;
    place-items: center;
    width: min(56%, 18rem);
    aspect-ratio: 1;
    padding: 2.5rem;
    border-radius: 50%;
    background: #fff;
}

.welcome-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 991.98px) {
    .welcome {
        grid-template-columns: minmax(0, 1fr);
        padding-block: 0;
    }

    .welcome-text {
        padding: 2.25rem 0;
    }

    .welcome-picture {
        padding: 1.5rem 0;
    }

    .welcome-cutout {
        width: min(70%, 20rem);
    }
}

@media (max-width: 575.98px) {
    .welcome-actions {
        display: grid;
    }
}

/* Public home page: sections below the opening screen */
.home-part {
    padding: clamp(3rem, 7vw, 6rem) 0;
}

.home-part-tint {
    background: var(--school-tint);
}

.home-part h2 {
    max-width: 24ch;
    margin: 0 0 2rem;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -.025em;
    text-wrap: balance;
}

.home-part h3 {
    margin: 0 0 .4rem;
    font-size: 1.25rem;
}

.home-more {
    margin: 1.75rem 0 0;
    font-weight: 700;
}

.home-about {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 2.5rem 5rem;
}

.home-about > :only-child {
    grid-column: 1 / -1;
}

.home-checks {
    display: grid;
    gap: .9rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 1.1rem;
}

.home-checks li {
    display: flex;
    gap: .75rem;
}

.home-checks .bi,
.home-values .bi,
.home-facilities .bi {
    color: var(--school-link);
}

.home-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 2.25rem 2.5rem;
}

.home-values .bi {
    display: block;
    margin-bottom: .75rem;
    font-size: 1.9rem;
    line-height: 1;
}

.home-values p {
    margin: 0;
}

.home-facilities {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0 2.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-facilities li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--school-line);
    color: var(--school-text);
    font-size: 1.1rem;
    font-weight: 700;
}

.home-facilities .bi {
    font-size: 1.5rem;
    line-height: 1;
}

/* The classes a child moves up through, drawn as a flight of steps. --step is the class's place, from 0. */
.home-steps {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-steps li {
    flex: 1 1 0;
    min-width: 0;
    height: calc(4.5rem + var(--step) * 1.75rem);
    padding: 1rem;
    border-top: 5px solid var(--school-accent);
    background: var(--school-dark);
    color: #fff;
    font: 600 1.1rem/1.2 var(--heading-font);
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    .home-steps {
        display: grid;
    }

    .home-steps li {
        width: min(100%, calc(46% + var(--step) * 9%));
        height: auto;
        border-top: 0;
        border-right: 5px solid var(--school-accent);
    }
}

.home-events {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.25rem;
}

.home-event {
    padding: 1.5rem;
    border-radius: .6rem;
    background: #fff;
}

.home-event-date {
    margin: 0 0 .5rem;
    color: var(--school-link);
    font-weight: 700;
}

.home-photos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.home-photos img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: .5rem;
    background: var(--school-tint);
    object-fit: cover;
}

@media (max-width: 575.98px) {
    .home-photos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Coloured tiles that alternate like a chessboard. The last row stretches to fill the width. */
.home-offers {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
}

.home-offers > div {
    display: flex;
    flex: 1 1 30%;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 14rem;
    padding: 2rem;
    border-radius: 1rem;
    background: color-mix(in srgb, var(--school-accent) 18%, #fff);
}

.home-offers > div:nth-child(odd) {
    background: var(--school-dark);
    color: #fff;
}

.home-offers dt {
    color: var(--school-text);
    font: 600 1.75rem/1.15 var(--heading-font);
    letter-spacing: -.02em;
    text-wrap: balance;
}

.home-offers > div:nth-child(odd) dt {
    color: inherit;
}

.home-offers dd {
    margin: 0;
    font-size: 1.05rem;
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .home-offers > div {
        flex-basis: 45%;
    }

    /* Two tiles a row: swap the colours on every second row to keep the chessboard. */
    .home-offers > div:nth-child(4n + 3) {
        background: color-mix(in srgb, var(--school-accent) 18%, #fff);
        color: inherit;
    }

    .home-offers > div:nth-child(4n + 3) dt {
        color: var(--school-text);
    }

    .home-offers > div:nth-child(4n) {
        background: var(--school-dark);
        color: #fff;
    }

    .home-offers > div:nth-child(4n) dt {
        color: inherit;
    }
}

@media (max-width: 575.98px) {
    .home-offers > div {
        flex-basis: 100%;
        gap: .75rem;
        min-height: 0;
        padding: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .home-about {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Contact details and form. contact-form.js shows the three messages. */
.home-contact {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 2.5rem 5rem;
}

.contact-details {
    display: grid;
    align-content: start;
    gap: 1.5rem;
    margin: 0;
    font-size: 1.1rem;
    overflow-wrap: anywhere;
}

.contact-details dt {
    color: var(--school-muted);
    font-size: .95rem;
    font-weight: 600;
}

.contact-details dd {
    margin: 0;
}

.contact-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.contact-form label {
    margin: 0 0 .35rem;
    font-weight: 700;
}

.contact-form .form-control {
    padding: .75rem .9rem;
    border: 1px solid #8f93a8;
    border-radius: .5rem;
    font-size: 1.05rem;
}

.contact-wide {
    grid-column: 1 / -1;
}

.contact-form .loading,
.contact-form .error-message,
.contact-form .sent-message {
    display: none;
    margin-bottom: 1rem;
    padding: .9rem 1.1rem;
    border-radius: .5rem;
    font-weight: 600;
}

.contact-form .loading {
    background: #fff;
}

.contact-form .error-message {
    background: #fbe4e4;
    color: #8c1717;
}

.contact-form .sent-message {
    background: #dff3e7;
    color: #17572f;
}

@media (max-width: 767.98px) {
    .home-contact,
    .contact-form {
        grid-template-columns: minmax(0, 1fr);
    }
}
