/* ==========================================================================
   Variables
   ========================================================================== */
:root {
  --ink: #1B2D5E;
  --pine: #1B2D5E;
  --pine-dark: #152347;
  --brass: #F5A623;
  --brass-light: #F5A623;
  --brass-dark: #d4880f;
  --sky: #5BC4F5;
  --mist: #ffffff;
  --line: #e2e8f0;

  /* Event categories: white text on each has at least 4.5:1 contrast. */
  --cat-academic: #1B2D5E;
  --cat-sports: #b5541b;
  --cat-arts: #6b4a9a;
  --cat-community: #1b7a8c;
  --cat-holiday: #8a6414;
  --cat-other: #51616a;

  --bs-body-font-family: "Public Sans", system-ui, sans-serif;
  --bs-body-color: #4A4A4A;
  --bs-link-color: var(--pine);
  --bs-link-hover-color: var(--pine-dark);
}

/* ==========================================================================
   Base
   ========================================================================== */
html { scroll-behavior: smooth; }
body { background: var(--mist); display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, .navbar-brand {
  font-family: "Literata", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--pine);
}

.skip-link:focus { position: fixed; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; }
:focus-visible { outline: 3px solid var(--brass-dark); outline-offset: 2px; }
.site-footer :focus-visible, .gallery-modal :focus-visible {
  outline-color: var(--brass-light);
}

.btn-brand { background: var(--pine); border-color: var(--pine); color: #fff; border-radius: 9999px; }
.btn-brand:hover, .btn-brand:focus { background: var(--pine-dark); border-color: var(--pine-dark); color: #fff; }
.btn-hero { background: var(--brass); border-color: var(--brass); color: var(--ink); font-weight: 600; border-radius: 9999px; }
.btn-hero:hover, .btn-hero:focus { background: var(--brass-dark); border-color: var(--brass-dark); color: #fff; }
.btn-outline-hero { border-color: rgba(255,255,255,.7); color: #fff; border-radius: 9999px; }
.btn-outline-hero:hover, .btn-outline-hero:focus { background: #fff; color: var(--pine-dark); }
.btn-outline-brand { border-color: var(--pine); color: var(--pine); border-radius: 9999px; }
.btn-outline-brand:hover, .btn-outline-brand:focus { background: var(--pine); color: #fff; }

/* ==========================================================================
   Navigation
   ========================================================================== */
.site-nav { background: #fff; border-bottom: 3px solid var(--brass); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.site-nav .navbar-brand { color: var(--pine); font-size: 1.25rem; display: flex; align-items: center; gap: .6rem; }
.site-nav .brand-logo { height: 2.25rem; width: auto; }
.site-nav .nav-link { color: var(--pine); padding: .75rem .75rem; }
.site-nav .nav-link:hover, .site-nav .nav-link.active, .site-nav .nav-link.show { color: var(--pine); font-weight: 600; }
.site-nav .nav-link.active { box-shadow: inset 0 -3px 0 var(--brass); }
.site-nav .navbar-toggler { border-color: var(--pine); }
.site-nav .navbar-toggler-icon { filter: none; }
.site-nav .dropdown-menu { min-width: 12rem; }
.site-nav .dropdown-item { padding: .6rem 1rem; }
.site-nav .dropdown-item:focus-visible { outline-offset: -3px; outline-color: var(--brass-dark); }
.nav-search .form-control { min-width: 0; }
.nav-search .btn { border-color: var(--pine); color: var(--pine); }
.nav-search .btn:hover { background: var(--pine); color: #fff; }

@media (max-width: 991.98px) {
  .site-nav .nav-link { padding: .85rem .5rem; }
  .nav-search { margin: .5rem 0; }
}

/* ==========================================================================
   Hero, breadcrumbs, page furniture
   ========================================================================== */

/* Home hero: white two-column layout */
.hero-home { background: #fff; color: var(--ink); padding: 5rem 0; }
.hero-home h1 { font-size: clamp(2.25rem, 7vw, 3.5rem); color: var(--pine); }
.hero-tagline { font-size: 1.2rem; font-weight: 500; color: var(--pine); margin-bottom: 1rem; }
.hero-home .lead { color: #4A4A4A; max-width: 36rem; }

/* Decorative visual column for home hero */
.hero-visual { position: relative; height: 380px; display: flex; align-items: center; justify-content: flex-end; }
.hero-student-photo { width: 300px; height: 300px; border-radius: 50%; object-fit: cover; position: relative; z-index: 2; }
.hero-photo-placeholder { width: 300px; height: 300px; border-radius: 50%; background: var(--line); position: relative; z-index: 2; }
.shape-navy-circle { position: absolute; width: 330px; height: 330px; border-radius: 50%; background: var(--pine); right: -15px; z-index: 1; }
.shape-yellow-square { position: absolute; width: 48px; height: 48px; background: var(--brass); border-radius: 6px; transform: rotate(15deg); top: 30px; right: 20px; z-index: 3; }
.shape-sky-circle { position: absolute; width: 32px; height: 32px; border-radius: 50%; background: var(--sky); bottom: 50px; right: 5px; z-index: 3; }

.draft-banner { background: #fff3cd; color: #664d03; text-align: center; padding: .5rem 1rem; font-weight: 500; }
.page-updated { color: #4a5a61; font-size: .85rem; }
.auth-panel { max-width: 28rem; }

/* ==========================================================================
   Cards
   ========================================================================== */
.content-card { border: 1px solid var(--line); border-radius: .5rem; background: #fff; border-top: 3px solid var(--brass); transition: box-shadow .2s ease, transform .2s ease; }
.content-card .card-title { font-family: "Literata", Georgia, serif; }
.content-card .card-img-top { aspect-ratio: 16 / 9; object-fit: cover; }
.content-card.is-draft { border-style: dashed; border-color: var(--brass-dark); }
.event-card:hover, .event-card:focus-within { box-shadow: 0 .5rem 1.25rem rgba(20,38,46,.12); transform: translateY(-2px); }
.card-content > :last-child { margin-bottom: 0; }

/* Editing controls: only rendered for people with edit permission. */
.card-tools { background: #f1f5f9; border-top: 1px dashed #b9c6c3; }
.htmx-request.btn, .htmx-request .btn { opacity: .6; }
.card-flash { animation: card-flash 1.6s ease-out; }
@keyframes card-flash { from { box-shadow: 0 0 0 4px var(--brass-light); } to { box-shadow: 0 0 0 0 transparent; } }
.image-preview { max-width: 100%; max-height: 12rem; border-radius: .5rem; border: 1px solid var(--line); }

/* On large screens with a mouse, tuck the tools away until the card is hovered or focused. */
@media (hover: hover) and (min-width: 992px) {
  .card-tools { opacity: 0; transition: opacity .15s ease; }
  .content-card:hover .card-tools, .content-card:focus-within .card-tools { opacity: 1; }
}

/* ==========================================================================
   Events and calendar
   ========================================================================== */
.cat-academic { --c: var(--cat-academic); } .cat-sports { --c: var(--cat-sports); }
.cat-arts { --c: var(--cat-arts); } .cat-community { --c: var(--cat-community); }
.cat-holiday { --c: var(--cat-holiday); } .cat-other { --c: var(--cat-other); }

.badge-cat { color: #fff; font-weight: 500; background: var(--c, var(--cat-other)); }
/* A shape per category, so colour is never the only clue. */
.cat-academic .cat-mark::before, .badge-cat.cat-academic::before { content: "\25CF\00a0"; }   /* circle */
.cat-sports .cat-mark::before, .badge-cat.cat-sports::before { content: "\25B2\00a0"; }       /* triangle */
.cat-arts .cat-mark::before, .badge-cat.cat-arts::before { content: "\2605\00a0"; }          /* star */
.cat-community .cat-mark::before, .badge-cat.cat-community::before { content: "\25C6\00a0"; } /* diamond */
.cat-holiday .cat-mark::before, .badge-cat.cat-holiday::before { content: "\25A0\00a0"; }     /* square */
.cat-other .cat-mark::before, .badge-cat.cat-other::before { content: "\25CB\00a0"; }         /* open circle */

.fc .fc-event { --fc-event-bg-color: var(--c, var(--cat-other)); --fc-event-border-color: var(--c, var(--cat-other)); cursor: pointer; }
.fc .fc-toolbar { flex-wrap: wrap; gap: .5rem; }
.fc .fc-toolbar-title { font-size: 1.25rem; }
.calendar-wrap { background: #fff; border: 1px solid var(--line); border-radius: .5rem; padding: .75rem; min-height: 24rem; position: relative; }
.calendar-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #4a5a61; }
.calendar-wrap.is-ready .calendar-loading { display: none; }

.event-when { font-weight: 600; }
.event-where { color: #4a5a61; }
.event-media { position: relative; }
.event-card .card-img-top { aspect-ratio: 16 / 10; border-radius: calc(.5rem - 1px) calc(.5rem - 1px) 0 0; }
.event-placeholder { aspect-ratio: 16 / 10; background: var(--c, var(--cat-other)); display: block; border-radius: calc(.5rem - 1px) calc(.5rem - 1px) 0 0; }
.date-badge { position: absolute; top: .75rem; left: .75rem; background: #fff; color: var(--ink); border-radius: .4rem; padding: .25rem .6rem;
  text-align: center; line-height: 1.1; box-shadow: 0 .15rem .5rem rgba(0,0,0,.25); }
.date-badge .month { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c, var(--pine)); }
.date-badge .day { display: block; font-family: "Literata", Georgia, serif; font-size: 1.4rem; font-weight: 700; }

.filter-chips { display: flex; gap: .5rem; }
@media (max-width: 767.98px) {
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .5rem; margin: 0 -.75rem; padding-inline: .75rem; scrollbar-width: thin; }
  .filter-chips .btn { white-space: nowrap; flex: 0 0 auto; }
}

/* Event photo gallery */
.gallery-heading .gallery-count { font-family: "Public Sans", sans-serif; font-size: .8rem; font-weight: 600;
  background: var(--pine); color: #fff; border-radius: 999px; padding: .1rem .55rem; vertical-align: middle; margin-left: .35rem; }
.gallery { display: grid; gap: .75rem; padding: 0; margin: 0; }
.gallery-single { grid-template-columns: 1fr; }
.gallery-pair { grid-template-columns: repeat(2, 1fr); }
.gallery-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.gallery-link { position: relative; display: block; overflow: hidden; border-radius: .5rem; background: #dfe6e4; line-height: 0; }
.gallery-link:focus-visible { outline-offset: -4px; box-shadow: inset 0 0 0 7px #fff; }
.gallery-link img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease; }
.gallery-single .gallery-link img { aspect-ratio: 16 / 10; }
.gallery-hero .gallery-link img { aspect-ratio: 16 / 9; }
.gallery-link:hover img, .gallery-link:focus-visible img { transform: scale(1.04); }
.gallery-label { position: absolute; inset: auto 0 0 0; padding: 1.5rem .75rem .5rem; line-height: 1.3; font-size: .85rem;
  color: #fff; background: linear-gradient(to top, rgba(10,20,25,.75), transparent); }
.gallery-modal { background: #10191d; color: #fff; }
.gallery-full { max-width: 100%; max-height: 78vh; width: auto; height: auto; object-fit: contain; }
.gallery-caption { text-align: center; margin: .75rem 1rem 1rem; color: rgba(255,255,255,.85); }

/* ==========================================================================
   Footer, toasts, back to top
   ========================================================================== */
.site-footer { background: var(--ink); color: rgba(255,255,255,.85); font-size: .9rem; }
.site-footer a { color: #fff; }
.site-footer h2 { font-size: 1rem; color: var(--brass-light); }
.site-footer .btn-link { color: #fff; padding: 0; vertical-align: baseline; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); }

.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 2100; }
.back-to-top { position: fixed; right: 1rem; bottom: 1rem; z-index: 1030; }
.back-to-top[hidden] { display: none; }

.error-code { font-size: 5rem; line-height: 1; color: var(--pine); }

/* ==========================================================================
   Motion and print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .gallery-link:hover img { transform: none; }
  .event-card:hover { transform: none; }
}

@media print {
  .site-nav, .site-footer, .card-tools, .back-to-top, .toast-stack, .filter-chips, .hero-actions, .skip-link, .btn { display: none !important; }
  body { background: #fff; }
  .hero-home { padding: 1.5rem 0; }
  .content-card { break-inside: avoid; box-shadow: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
}
