/* ==========================================================================
   SFS Academy — site header and footer
   ========================================================================== */

/* Header ----------------------------------------------------------------- */

.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
    transition: transform 0.35s var(--ease), background-color 0.3s var(--ease), box-shadow 0.3s var(--ease), color 0.3s var(--ease);
}

/* Inner pages start below the fixed header; the homepage hero sits under it. */
body:not(.page-home) main {
    padding-top: calc(var(--header-height) + var(--topbar-height));
}

.topbar {
    height: var(--topbar-height);
    background: var(--navy-900);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8125rem;
    transition: background-color 0.3s var(--ease);
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    height: 100%;
}

.topbar__note {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    white-space: nowrap;
}

.topbar__divider {
    flex: none;
    width: 1px;
    height: 0.9rem;
    background: rgba(255, 255, 255, 0.4);
}

.topbar__note a {
    overflow: hidden;
    color: inherit;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.topbar__note a:hover {
    color: var(--saffron-400);
}

.topbar__contact {
    display: flex;
    flex: none;
    align-items: center;
    gap: 0.75rem;
}

.topbar__social {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.topbar__social li {
    display: flex;
}

.topbar__contact a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.topbar__contact a:hover {
    color: var(--saffron-400);
}

.site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    height: var(--header-height);
}

/* The header starts transparent. After scrolling (or with the mobile menu open) it becomes ivory
   with a deeper wash on the right. */
.site-header.is-scrolled,
.site-header.is-nav-open {
    background-color: #fffff0; /* ivory */
    background-image: linear-gradient(100deg, rgba(255, 255, 240, 0) 55%, rgba(250, 238, 200, 0.75) 100%);
    background-size: 100% 100%;
}

/* Once the page has scrolled, the contact strip slides away and only the
   main bar stays pinned. */
.site-header.is-scrolled {
    transform: translateY(calc(var(--topbar-height) * -1));
    box-shadow: 0 10px 30px -18px rgba(11, 31, 77, 0.35);
}

.site-header.is-nav-open:not(.is-scrolled) { box-shadow: 0 1px 0 rgba(11, 31, 77, 0.08); }

/* Brand */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.875rem;
    flex: none;
    color: inherit;
    text-decoration: none;
}

.brand__emblem {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 0 0 3px var(--white);
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand__name {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.brand__place {
    margin-top: 0.3rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--orange-600);
}

.brand--light {
    color: var(--white);
}

.brand--light .brand__place {
    color: var(--saffron-400);
}

/* Navigation */

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.site-nav__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-nav__item {
    position: relative;
}

.site-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.625rem 0.875rem;
    border: 0;
    border-radius: var(--radius);
    background: none;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.site-nav__link .icon {
    opacity: 0.6;
    transition: transform 0.25s var(--ease);
}

.site-nav__link:hover,
.site-nav__link.is-active {
    color: var(--indigo-700);
}

.site-nav__link[aria-expanded="true"] .icon {
    transform: rotate(180deg);
}

.submenu a {
    display: block;
    padding: 0.625rem 0.875rem;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--ink);
    text-decoration: none;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.submenu a:hover,
.submenu a[aria-current="page"] {
    background: var(--cream);
    color: var(--indigo-700);
}

.nav-toggle {
    display: none;
}

/* Desktop navigation */

@media (min-width: 1200px) {
    .submenu {
        position: absolute;
        top: calc(100% + 0.75rem);
        left: -0.5rem;
        z-index: 10;
        min-width: 15.5rem;
        padding: 0.5rem;
        border-top: 3px solid var(--cyan-400);
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        background: var(--white);
        box-shadow: var(--shadow);
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
    }

    /* Bridges the gap between the trigger and the panel so the pointer can
       travel between them without the menu closing. */
    .submenu::before {
        content: "";
        position: absolute;
        inset: -1rem 0 100%;
    }

    .site-nav__item--parent:hover > .submenu,
    .site-nav__item--parent:focus-within > .submenu,
    .site-nav__link[aria-expanded="true"] + .submenu {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    /* Transparent over the homepage hero until the page scrolls. */
    .site-header--overlay:not(.is-scrolled) {
        background: transparent;
        color: var(--white);
        box-shadow: none;
    }

    .site-header--overlay:not(.is-scrolled) .topbar {
        background: transparent;
        border-bottom: 1px solid var(--line-dark);
    }

    .site-header--overlay:not(.is-scrolled) .brand__place {
        color: var(--saffron-400);
    }

    .site-header--overlay:not(.is-scrolled) .site-nav__link:hover,
    .site-header--overlay:not(.is-scrolled) .site-nav__link.is-active {
        color: var(--saffron-400);
    }
}

/* Mobile navigation */

@media (max-width: 1199.98px) {
    :root {
        --header-height: 72px;
        --topbar-height: 0px;
    }

    .topbar {
        display: none;
    }

    .site-header.is-scrolled {
        transform: none;
    }

    .brand__emblem {
        width: 46px;
        height: 46px;
    }

    .brand__name {
        font-size: 1rem;
    }

    .nav-toggle {
        display: inline-grid;
        place-items: center;
        width: 3rem;
        height: 3rem;
        margin-right: -0.5rem;
        border: 0;
        border-radius: var(--radius);
        background: none;
        cursor: pointer;
    }

    .nav-toggle__close,
    .nav-toggle[aria-expanded="true"] .nav-toggle__open {
        display: none;
    }

    .nav-toggle[aria-expanded="true"] .nav-toggle__close {
        display: block;
    }

    .site-nav {
        position: fixed;
        inset: var(--header-height) 0 0;
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        height: calc(100dvh - var(--header-height));
        padding: 1rem var(--gutter) 2rem;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--white);
        color: var(--ink);
        border-top: 1px solid var(--line);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
    }

    .site-nav.is-open {
        visibility: visible;
        opacity: 1;
        transform: none;
    }

    .site-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-nav__item {
        border-bottom: 1px solid var(--line);
    }

    .site-nav__link {
        justify-content: space-between;
        width: 100%;
        min-height: 3.5rem;
        padding: 0.875rem 0;
        font-size: 1.125rem;
        font-weight: 700;
        text-align: left;
    }

    .submenu {
        display: none;
        padding-bottom: 0.75rem;
    }

    .site-nav__link[aria-expanded="true"] + .submenu {
        display: block;
    }

    .submenu a {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
    }

    .site-nav__cta {
        min-height: 3.5rem;
        font-size: 1rem;
    }

    /* The overlay header uses a soft scrim on small screens so the logo and
       menu button stay legible over the photograph. */
    .site-header--overlay:not(.is-scrolled):not(.is-nav-open) {
        background: linear-gradient(rgba(7, 20, 47, 0.72), rgba(7, 20, 47, 0));
        color: var(--white);
        box-shadow: none;
    }

    .site-header--overlay:not(.is-scrolled):not(.is-nav-open) .brand__place {
        color: var(--saffron-400);
    }

    body.has-open-nav {
        overflow: hidden;
    }
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
    background: var(--navy-950);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9375rem;
    line-height: 1.65;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.site-footer a:hover {
    color: var(--saffron-400);
}

.site-footer__top {
    display: grid;
    grid-template-columns: 1.5fr repeat(2, 0.8fr) 1.45fr;
    gap: 3rem 2.5rem;
    padding-block: clamp(3.5rem, 7vw, 5.5rem) clamp(2.5rem, 5vw, 4rem);
}

.site-footer__about p {
    max-width: 22rem;
    margin-top: 1.5rem;
}

.site-footer__social {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.site-footer__social a,
.site-footer__social li > span {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--white);
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.site-footer__social a:hover {
    border-color: var(--cyan-400);
    background: var(--cyan-400);
    color: var(--navy-950);
    transform: translateY(-2px);
}

.site-footer .brand__emblem {
    width: 60px;
    height: 60px;
}

.site-footer__heading {
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--white);
}

.site-footer__nav li + li {
    margin-top: 0.125rem;
}

.site-footer__nav a {
    display: inline-block;
    padding-block: 0.3125rem;
}

.site-footer__line {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.site-footer__line + .site-footer__line,
.site-footer__contact address + .site-footer__line {
    margin-top: 1rem;
}

.site-footer__line .icon {
    margin-top: 0.2rem;
    color: var(--orange-500);
}

.site-footer__line a {
    display: inline-block;
    padding-block: 0.125rem;
    overflow-wrap: anywhere;
}

.site-footer__bottom a {
    display: inline-block;
    padding-block: 0.375rem;
}

.site-footer .site-footer__credit {
    font-weight: 700;
    color: var(--white);
}

.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    padding-block: 1.5rem;
    border-top: 1px solid var(--line-dark);
    font-size: 0.875rem;
}

@media (max-width: 1099.98px) {
    .site-footer__top {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-footer__about {
        grid-column: 1 / -1;
    }

    .site-footer__about p {
        max-width: 34rem;
    }

    .site-footer__contact {
        grid-column: 1 / -1;
    }
}

@media (max-width: 639.98px) {
    .site-footer__top {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.5rem 1.5rem;
    }
}

/* Footer polish: accent strip, heading marks, icon chips, admission button. */
.site-footer { border-top: 4px solid var(--orange-500); }

.site-footer__heading {
    position: relative;
    padding-bottom: 0.875rem;
}

.site-footer__heading::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 2rem;
    height: 3px;
    border-radius: 2px;
    background: var(--orange-500);
}

.site-footer__nav a { position: relative; transition: color 0.2s var(--ease), padding-left 0.2s var(--ease); }
.site-footer__nav a:hover { padding-left: 0.375rem; }

.site-footer__social { margin-top: 1.25rem; }

.site-footer__line .icon {
    flex: none;
    box-sizing: content-box;
    margin-top: 0;
    padding: 0.4375rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.site-footer__line > span,
.site-footer__line > a { padding-top: 0.4375rem; }

.site-footer__bottom { color: rgba(255, 255, 255, 0.6); }

/* Nine main menus plus the Admissions button: keep the bar on one line. */
@media (min-width: 1200px) {
    .site-nav__link {
        padding-inline: 0.5rem;
        white-space: nowrap;
    }

    .site-nav__list {
        gap: 0;
    }

    .site-nav__link .icon {
        width: 14px;
        height: 14px;
    }

    .site-nav__cta {
        margin-left: 0.5rem;
        white-space: nowrap;
    }
}

@media (min-width: 1200px) and (max-width: 1599.98px) {
    .site-nav__link {
        padding-inline: 0.375rem;
        font-size: 0.8438rem;
    }

    .site-nav__cta {
        padding-inline: 1rem;
    }
}

/* Sub-menu inside a sub-menu (for example Photo Gallery > Gallery 2026-27) */

.submenu__item--parent { position: relative; }

.submenu-nested {
    margin: 0;
    padding: 0 0 0 1rem;
    list-style: none;
}

.submenu__item--parent > a::after {
    content: "›";
    float: right;
    margin-left: 0.75rem;
    opacity: 0.6;
}

@media (min-width: 1200px) {
    .submenu-nested {
        position: absolute;
        top: -0.5rem;
        left: 100%;
        z-index: 11;
        min-width: 14rem;
        padding: 0.5rem;
        border-top: 3px solid var(--cyan-400);
        border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
        background: var(--white);
        box-shadow: var(--shadow);
        opacity: 0;
        visibility: hidden;
        transform: translateX(-6px);
        transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
    }

    .submenu__item--parent:hover > .submenu-nested,
    .submenu__item--parent:focus-within > .submenu-nested {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    /* The menus at the right end of the bar open their inner list to the left, so it never runs off the screen. */
    .site-nav__item--parent:nth-last-child(-n+3) .submenu-nested {
        left: auto;
        right: 100%;
        border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
        transform: translateX(6px);
    }

    .site-nav__item--parent:nth-last-child(-n+3) .submenu__item--parent:hover > .submenu-nested,
    .site-nav__item--parent:nth-last-child(-n+3) .submenu__item--parent:focus-within > .submenu-nested {
        transform: none;
    }

    .site-nav__item--parent:nth-last-child(-n+3) .submenu__item--parent > a::after,
    .site-nav__item--parent:nth-last-child(-n+3) .submenu__item--parent > span::after {
        content: "‹";
        float: left;
        margin: 0 0.75rem 0 0;
    }
}

@media (max-width: 1199px) {
    .submenu__item--parent > a::after { content: none; }
    .submenu-nested a { font-size: 0.9375rem; opacity: 0.9; }
}

/* A sub-menu title without its own page (Photo Gallery) looks and behaves like the links around it. */
.submenu > li > span {
    display: block;
    padding: 0.625rem 0.875rem;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--ink);
    cursor: default;
}

.submenu__item--parent > span::after {
    content: "›";
    float: right;
    margin-left: 0.75rem;
    opacity: 0.6;
}

.submenu__item--parent:hover > span,
.submenu__item--parent:focus-within > span {
    background: var(--cream);
    color: var(--indigo-700);
}

@media (max-width: 1199px) {
    .submenu > li > span { padding: 0.75rem 0.875rem; font-size: 1rem; }
    .submenu__item--parent > span::after { content: none; }
}

/* The full school name is longer: keep it on screen beside the menu button on small phones. */
@media (max-width: 520px) {
    .brand { min-width: 0; gap: 0.5rem; }
    .brand__text { min-width: 0; }
    .brand__name { font-size: 0.8125rem; letter-spacing: -0.01em; }
    .brand__place { letter-spacing: 0.16em; }
}

/* Between 1200px and 1399px (a 125% zoom on a laptop) the full menu is kept on one line by trimming it a little. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .site-header__bar { gap: 1rem; }

    .brand { gap: 0.625rem; }
    .brand__name { font-size: 1rem; }
    .brand__place { letter-spacing: 0.16em; }

    .site-nav__link {
        padding-inline: 0.3125rem;
        font-size: 0.8125rem;
        gap: 0.2rem;
    }

    .site-nav__cta {
        margin-left: 0.25rem;
        padding-inline: 0.75rem;
    }
}

/* Inner pages show the ivory header from the start. Only the homepage header (the overlay one)
   waits for the page to scroll. */
.site-header:not(.site-header--overlay) {
    background-color: #fffff0; /* ivory */
    background-image: linear-gradient(100deg, rgba(255, 255, 240, 0) 55%, rgba(250, 238, 200, 0.75) 100%);
    background-size: 100% 100%;
}

/* The school email address stays on one line on narrow phones. */
.site-footer__line a[href^="mailto:"] { white-space: nowrap; }

@media (max-width: 380px) {
    .site-footer__line a[href^="mailto:"] { font-size: clamp(0.8125rem, 4.1vw, 0.9375rem); }
}

/* The top strip (syllabus, management, Pay Fees, social icons) shows on every screen size.
   On tablets and phones it is a slimmer strip; the mobile menu opens below it. */
@media (max-width: 1199.98px) {
    :root { --topbar-height: 34px; }

    .topbar {
        display: block;
        font-size: 0.75rem;
    }

    .topbar__inner { gap: 0.75rem; }

    .topbar__note {
        flex: 1 1 auto;
        min-width: 0;
        gap: 0.5rem;
    }

    .topbar__note > span:first-child { flex: none; }

    .topbar__note > :last-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar__contact { gap: 0.625rem; }

    .topbar__social { gap: 0.625rem; }

    .site-nav {
        inset: calc(var(--header-height) + var(--topbar-height)) 0 0;
        height: calc(100dvh - var(--header-height) - var(--topbar-height));
    }
}

/* Phones: two short rows, so nothing is cut off. Row 1: syllabus and management. Row 2: Pay Fees and the social icons. */
@media (max-width: 599.98px) {
    :root { --topbar-height: 52px; }

    .topbar__inner {
        flex-direction: column;
        justify-content: center;
        gap: 0.25rem;
    }

    .topbar__note {
        flex: none;
        justify-content: center;
        max-width: 100%;
        font-size: clamp(0.5625rem, 3vw, 0.75rem);
        gap: 0.375rem;
    }

    .topbar__contact { justify-content: center; }

    .topbar__portal { font-weight: 700; color: var(--saffron-400); }
}
