/*
 * Theme of the public site: design tokens, typography and the shared layout (top bar, header, navigation, news ticker,
 * content panel, footer). The colours come from the school crest (public/images/brand/): the deep blue of its ring, the
 * navy of its lettering and the steel blue of its stripes. Page-specific rules live in app.css and team.css.
 */

:root {
    /* palette */
    --navy-900: #0a1230;
    --navy-800: #14264a;
    --navy-700: #234460;
    --blue-600: #2f6694;
    --blue-500: #3f7fb0;
    --blue-300: #9bbbd6;
    --blue-100: #dbe8f3;
    --blue-50: #f2f7fb;
    --gold-500: #b39a66;
    --ink: #1c2740;
    --muted: #55617a;
    --line: #dbe3ee;
    --surface: #fff;

    /* type */
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-display: 'Lora', Georgia, 'Times New Roman', serif;

    /* shape */
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(10, 18, 48, .06), 0 4px 14px rgba(10, 18, 48, .06);
    --shadow-md: 0 2px 4px rgba(10, 18, 48, .06), 0 14px 34px rgba(10, 18, 48, .12);

    /* Bootstrap 5 hooks */
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.65;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--blue-50);
    --bs-primary: var(--blue-600);
    --bs-primary-rgb: 47, 102, 148;
    --bs-link-color: var(--blue-600);
    --bs-link-color-rgb: 47, 102, 148;
    --bs-link-hover-color: var(--navy-700);
    --bs-link-hover-color-rgb: 35, 68, 96;
    --bs-border-color: var(--line);
    --bs-border-radius: 10px;
    --bs-gutter-x: 1.5rem;
}

html { scroll-padding-top: 5.5rem; }

body {
    background: var(--blue-50);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover, a:focus { color: var(--navy-700); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--navy-900);
    letter-spacing: -.01em;
}
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.9rem); margin: 2rem 0 .8rem; }
h3 { font-size: clamp(1.2rem, 1.05rem + .6vw, 1.45rem); margin: 1.6rem 0 .6rem; }
h4 { font-size: 1.15rem; margin: 1.3rem 0 .5rem; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; margin-bottom: 1rem; }
hr { border-color: var(--line); opacity: 1; margin: 1.6rem 0; }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; border-radius: 4px; }

.skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 2000;
    padding: .6rem 1rem; border-radius: 0 0 var(--radius) var(--radius);
    background: var(--navy-900); color: #fff; font-weight: 600;
    transition: top .15s ease;
}
.skip-link:focus { top: 0; color: #fff; }

.container { max-width: 1160px; }

/* ===== top bar: contact details, always one line ===== */
.topbar {
    background: var(--navy-900);
    color: #c9d6e6;
    font-size: .875rem;
}
.topbar .container { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; align-items: center; justify-content: space-between; padding-top: .45rem; padding-bottom: .45rem; }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover, .topbar a:focus { text-decoration: underline; color: #fff; }
.topbar-contact { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.topbar-contact span { white-space: nowrap; }
@media (max-width: 575.98px) { .topbar-social { display: none; } }

/* ===== brand row ===== */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.brand-row { padding-top: .9rem; padding-bottom: .9rem; }
.brand { display: flex; align-items: center; gap: 1rem; color: var(--navy-900); text-decoration: none; }
.brand:hover, .brand:focus { color: var(--navy-900); text-decoration: none; }
.brand img { width: 72px; height: 72px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, .9rem + 1.3vw, 1.75rem); letter-spacing: -.01em; }
.brand-motto { margin-top: .3rem; color: var(--muted); font-size: .95rem; font-style: italic; }
@media (max-width: 575.98px) {
    .brand img { width: 52px; height: 52px; }
    .brand { gap: .7rem; }
    .brand-motto { font-size: .8rem; }
}

/* ===== navigation bar ===== */
.site-navbar {
    padding: 0;
    background: var(--navy-700);
    box-shadow: 0 2px 10px rgba(10, 18, 48, .18);
    z-index: 1030;
}
.site-navbar .container { padding-top: 0; padding-bottom: 0; }
.site-navbar .navbar-nav { gap: .1rem; }
.site-navbar .nav-link {
    padding: .95rem .85rem;
    color: #e6eef7;
    font-size: .95rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: background-color .15s ease, border-color .15s ease;
}
.site-navbar .nav-link:hover, .site-navbar .nav-link:focus { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.site-navbar .nav-link.active, .site-navbar .nav-link.show { color: #fff; border-bottom-color: var(--gold-500); }
.site-navbar .dropdown-toggle::after { margin-left: .35rem; vertical-align: .15em; }

.site-navbar .dropdown-menu {
    min-width: 13rem;
    padding: .5rem;
    margin-top: 0;
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
}
.site-navbar .dropdown-item { padding: .5rem .9rem; border-radius: 8px; color: var(--ink); font-size: .95rem; }
.site-navbar .dropdown-item:hover, .site-navbar .dropdown-item:focus { background: var(--blue-50); color: var(--navy-700); }
.site-navbar .dropdown-item.active { background: var(--blue-100); color: var(--navy-900); font-weight: 600; }

.site-navbar .navbar-toggler {
    margin: .5rem 0;
    padding: .45rem .8rem;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 10px;
    color: #fff;
    font-size: .95rem;
    font-weight: 500;
}
.site-navbar .navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(155, 187, 214, .5); }
.site-navbar .navbar-toggler-icon {
    width: 1.3em; height: 1.3em; vertical-align: -.25em; margin-right: .5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.4' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
@media (max-width: 991.98px) {
    .site-navbar .navbar-collapse { padding-bottom: .6rem; }
    .site-navbar .nav-link { padding: .7rem .5rem; border-bottom: 0; border-left: 3px solid transparent; }
    .site-navbar .nav-link.active, .site-navbar .nav-link.show { border-left-color: var(--gold-500); background: rgba(255, 255, 255, .08); }
    .site-navbar .dropdown-menu { margin: 0 0 .4rem .5rem; box-shadow: none; border: 0; background: rgba(255, 255, 255, .96); border-radius: var(--radius); }
}

/* ===== main area ===== */
.site-container { padding-top: 1.6rem; padding-bottom: 3rem; }
@media (max-width: 575.98px) { .site-container { padding-top: 1rem; padding-bottom: 2rem; } }

/* ===== news ticker (the text is admin-authored HTML, scrolls like the legacy marquee) ===== */
.news-ticker {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    margin: 0 0 1.4rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}
.news-ticker-label {
    flex: none;
    display: flex; align-items: center;
    padding: .5rem 1.1rem;
    background: var(--navy-700);
    color: #fff;
    font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.news-ticker-viewport { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; display: flex; align-items: center; }
.news-ticker-text { display: inline-block; padding-left: 100%; animation: ticker 40s linear infinite; }
.news-ticker-text:hover { animation-play-state: paused; }
.news-ticker-text, .news-ticker-text * { font-family: var(--font-body); font-size: 1rem; font-weight: 500; color: var(--ink); margin: 0; display: inline; }
.news-ticker-text a { color: var(--blue-600); }
@keyframes ticker { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
    .news-ticker { border-radius: var(--radius); }
    .news-ticker-viewport { white-space: normal; padding: .5rem 1rem; }
    .news-ticker-text { animation: none; padding-left: 0; }
}

/* ===== content panel (every page that shows stored or admin-managed content) ===== */
.site-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.site-panel-heading {
    padding: 2rem 2rem 1.6rem;
    background: linear-gradient(120deg, var(--navy-700) 0%, var(--blue-600) 100%);
    border-bottom: 4px solid var(--gold-500);
}
.site-panel-title { margin: 0; color: #fff; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.3rem); }
.site-panel-title a { color: var(--blue-100); text-decoration-color: rgba(255, 255, 255, .45); }
.site-panel-title a:hover, .site-panel-title a:focus-visible { color: #fff; text-decoration-color: #fff; }
.site-panel-body { padding: 2rem; }
.site-panel-body > :first-child { margin-top: 0; }
.site-panel-body > :last-child { margin-bottom: 0; }
.site-panel-body table { max-width: 100%; }
@media (max-width: 575.98px) {
    .site-panel { border-radius: var(--radius); }
    .site-panel-heading { padding: 1.4rem 1.2rem 1.1rem; }
    .site-panel-body { padding: 1.2rem; }
}

/* ===== footer ===== */
.site-footer { background: var(--navy-900); color: #c9d6e6; font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer a:hover, .site-footer a:focus { color: var(--blue-100); }
.footer-main { padding-top: 3rem; padding-bottom: 2rem; }
.footer-brand { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.footer-brand img { width: 84px; height: 84px; flex: none; }
.footer-brand strong { display: block; font-family: var(--font-display); font-size: 1.25rem; line-height: 1.2; color: #fff; }
.footer-brand span { color: var(--blue-300); font-style: italic; }
.footer-title { margin: 0 0 .8rem; font-family: var(--font-body); font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue-300); }
.footer-list { list-style: none; padding: 0; margin: 0; }
.footer-list li { margin-bottom: .45rem; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding: 1rem 0 1.3rem; font-size: .85rem; color: #9fb2c9; }

/* ===== shared small components ===== */
.btn { border-radius: 999px; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--blue-600); --bs-btn-border-color: var(--blue-600); --bs-btn-hover-bg: var(--navy-700); --bs-btn-hover-border-color: var(--navy-700); --bs-btn-active-bg: var(--navy-800); --bs-btn-active-border-color: var(--navy-800); }
.card-soft { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

@media print {
    .topbar, .site-navbar, .news-ticker, .site-footer, .skip-link { display: none !important; }
    .site-panel { box-shadow: none; border: 0; }
    .site-panel-heading { background: none; border-bottom: 2px solid #000; padding-left: 0; }
    .site-panel-title { color: #000; }
}

/* outline buttons in the site colours */
.btn-outline-primary { --bs-btn-color: var(--blue-600); --bs-btn-border-color: var(--blue-600); --bs-btn-hover-bg: var(--blue-600); --bs-btn-hover-border-color: var(--blue-600); --bs-btn-active-bg: var(--navy-700); --bs-btn-active-border-color: var(--navy-700); }
.btn-outline-secondary { --bs-btn-color: var(--navy-700); --bs-btn-border-color: #9fb2c9; --bs-btn-hover-bg: var(--navy-700); --bs-btn-hover-border-color: var(--navy-700); --bs-btn-active-bg: var(--navy-800); --bs-btn-active-border-color: var(--navy-800); }
