/* Shared by the public site (with site.css) and the admin (with admin.css): fonts, design tokens and the site header. */

/* Source Sans 3 (SIL OFL 1.1), self-hosted, see fonts/SourceSans3-LICENSE.txt */
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-display: swap;
    font-weight: 200 900;
    src: url(../fonts/source-sans-3-latin-ext-wght-normal.woff2) format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-display: swap;
    font-weight: 200 900;
    src: url(../fonts/source-sans-3-latin-wght-normal.woff2) format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Arial scaled to Source Sans 3's metrics, so text does not jump when the webfont arrives. */
@font-face {
    font-family: "Source Sans 3 Fallback";
    src: local("Arial");
    size-adjust: 92.25%;
    ascent-override: 110.6%;
    descent-override: 43.4%;
    line-gap-override: 0%;
}

:root {
    /* Brand: the navy of the SMFF logo plate and the yellow of its wings. */
    --navy: #254264;
    --navy-deep: #1a3150;
    --navy-ink: #14263d;
    --yellow: #f2c230;
    --sky: #e8eef5;

    --text: #1b2533;
    --muted: #556171;
    --line: #d9dfe6;
    --bg: #f4f6f8;
    --surface: #fff;
    --link: #1d5594;
    --link-hover: #12406f;

    --ok-fg: #17603a;
    --ok-bg: #e3f2e8;
    --closed-fg: #5a4300;
    --closed-bg: #fbefc8;
    --me-fg: #1d4a7a;
    --me-bg: #e1ebf7;

    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(20, 38, 61, .06), 0 2px 6px rgba(20, 38, 61, .06);
    --shadow-md: 0 4px 10px rgba(20, 38, 61, .08), 0 12px 28px rgba(20, 38, 61, .10);

    --wrap: 75rem;
    /* Text column width for news, articles and pages (672 px). Uploaded images are scaled to fit it,
       so keep ContentFileRules.ContentWidth in sync (a unit test checks this). */
    --measure: 42rem;

    --font: "Source Sans 3", "Source Sans 3 Fallback", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

/* Always reserve the scrollbar's space so the layout doesn't shift between short and long pages. */
html { scrollbar-gutter: stable; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2rem); }

.site-header { background: var(--navy); color: #fff; font-family: var(--font); font-size: 1.125rem; line-height: 1.6; }
.header-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.75rem; }
.brand { position: relative; display: flex; align-items: center; gap: .85rem; margin-right: auto; min-width: 0; }
.brand-logo { display: flex; border-radius: 50%; }
.brand-name, .brand-name:hover { color: #fff; text-decoration: none; }
/* The SMFF badge is itself a navy plate; the shadow lifts it off the navy header. */
.brand img { width: 46px; height: auto; flex: none; filter: drop-shadow(0 2px 3px rgb(5 15 30 / .55)); }
.brand-name { font-size: 1.6rem; font-weight: 700; letter-spacing: .015em; line-height: 1; }
.site-header :focus-visible { outline-color: var(--yellow); }

/* Branch switcher: the branch name opens a menu of all branches, with the association's start page first. */
.branch-switch { min-width: 0; margin-left: -.55rem; }
.branch-switch summary {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .4rem .55rem; border-radius: 8px;
    list-style: none; cursor: pointer; user-select: none;
}
.branch-switch summary::-webkit-details-marker { display: none; }
.branch-switch summary:hover { background: rgba(255, 255, 255, .1); }
.brand-title { white-space: nowrap; }
.branch-chevron {
    width: 1.4rem; height: 1.4rem; flex: none; padding: .2rem; border-radius: 50%;
    background: rgba(255, 255, 255, .14); fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .2s ease, background-color .2s ease;
}
.branch-switch summary:hover .branch-chevron { background: rgba(255, 255, 255, .24); }
.branch-switch[open] .branch-chevron { transform: rotate(180deg); background: rgba(255, 255, 255, .24); }

.branch-menu {
    position: absolute; left: 0; top: calc(100% + .6rem); z-index: 20;
    width: min(28rem, calc(100vw - 2rem)); max-height: calc(100dvh - 6rem); overflow-y: auto; overscroll-behavior: contain;
    padding: .5rem; background: var(--surface); color: var(--text);
    border-radius: 12px; box-shadow: var(--shadow-md); font-size: 1rem; line-height: 1.3;
    animation: branch-menu-in .16s ease-out;
}
@keyframes branch-menu-in { from { opacity: 0; transform: translateY(-4px); } }
.branch-menu :focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.branch-menu a { display: flex; align-items: center; gap: .75rem; padding: .45rem .55rem; border-radius: 8px; color: var(--navy-ink); text-decoration: none; }
.branch-menu a:hover { background: var(--bg); color: var(--navy-ink); text-decoration: none; }
.branch-menu a[aria-current] { background: var(--sky); font-weight: 700; }
.branch-menu-name { font-weight: 600; }
.branch-menu-home { margin-bottom: .35rem; }
.branch-menu .branch-menu-home img { width: 36px; filter: drop-shadow(0 2px 3px rgb(5 15 30 / .35)); }
.branch-menu-home .branch-menu-name { font-size: 1.1rem; font-weight: 700; }
.wordmark { display: inline-flex; align-items: baseline; font-weight: 700; }
.wordmark-dot { width: 5px; height: 5px; margin: 0 1px 0 2px; border-radius: 50%; background: var(--yellow); align-self: baseline; }
.wordmark-tld { font-weight: 400; color: #c8d5e4; }
.branch-menu .wordmark-dot { width: 4px; height: 4px; margin: 0 1px; background: #d9a400; }
.welcome .wordmark { color: var(--navy); }
.welcome .wordmark-dot { background: #d9a400; }
.welcome .wordmark-tld { color: #9a7400; font-weight: 600; }
.welcome p .wordmark-dot { width: 4px; height: 4px; margin: 0 1px; }
.branch-menu .wordmark-tld { color: var(--muted); }
.branch-menu ul { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem; margin: 0; padding: .4rem 0 0; list-style: none; border-top: 1px solid var(--line); }
.branch-menu ul a { min-height: 2.75rem; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    .branch-menu { animation: none; }
    .branch-chevron { transition: none; }
}

.header-actions { display: flex; align-items: center; gap: .5rem; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.login-link, .header-admin, .account summary, .menu-toggle {
    display: inline-flex; align-items: center; gap: .5rem;
    min-height: 2.75rem; padding: .4rem .9rem;
    border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
    background: transparent; color: #fff; font: inherit; font-weight: 600; font-size: 1rem;
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.login-link:hover, .header-admin:hover, .account summary:hover, .menu-toggle:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }

.account { position: relative; }
.account summary { list-style: none; }
.account summary::-webkit-details-marker { display: none; }
.account-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-panel {
    position: absolute; right: 0; top: calc(100% + .5rem); z-index: 5;
    min-width: 16rem; padding: 1rem;
    background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.account-who { margin: 0 0 .5rem; color: var(--muted); font-size: 1rem; }
.account-panel ul { list-style: none; margin: 0 0 .75rem; padding: 0; }
.account-panel li a { display: block; padding: .5rem 0; font-weight: 600; color: var(--link); }
.account-panel :focus-visible { outline-color: var(--link); }
.account-panel form { margin: 0; }
.account-panel .button-quiet {
    display: inline-flex; align-items: center; justify-content: center; width: 100%;
    min-height: 2.75rem; padding: .5rem 1.2rem; font: inherit; font-weight: 600;
    border: 0; border-radius: 6px; background: var(--bg); color: var(--navy-ink); cursor: pointer;
}
.account-panel .button-quiet:hover { background: var(--sky); color: var(--navy-ink); }

.menu-toggle { display: none; }

@media (max-width: 860px) {
    .header-bar { min-height: 4rem; }
    .brand img { width: 38px; }
    .brand-name { font-size: 1.3rem; }
    .menu-toggle { display: inline-flex; }
    /* Make room for Administration: the account button shows only its icon. */
    .header-admin + .account .account-name { display: none; }
}

@media (max-width: 640px) {
    /* On phones the link moves to the top of the menu (.nav-admin in site.css). */
    .header-admin.in-menu { display: none; }
}

@media (max-width: 640px) {
    /* A sheet across the screen, below the header. */
    .branch-menu { position: fixed; left: .75rem; right: .75rem; top: 4.4rem; width: auto; max-height: calc(100dvh - 5.4rem); }
}

@media (max-width: 480px) {
    .header-bar { gap: .5rem; }
    .brand { gap: .6rem; min-width: 0; }
    .brand img { width: 32px; }
    .brand-name { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .branch-switch { margin-left: -.4rem; }
    .branch-switch summary { gap: .35rem; max-width: 100%; padding-inline: .4rem; }
    .brand-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .header-actions { flex: none; }
    .login-link { display: none; }
    .account summary, .menu-toggle { padding: .4rem .75rem; }
    .account-name { display: none; }
    .account-panel { right: -4.5rem; }
}
