/* ==========================================================================
   Surefoot International School - site enhancements
   Written mobile first: base rules target small screens, and min-width
   media queries layer on larger-screen behaviour.
   ========================================================================== */

:root {
  --sf-navy: #1e3a5f;
  --sf-navy-dark: #152a45;
  --sf-gold: #d4af37;
  --sf-gold-dark: #b8941f;
  --sf-ink: #1f2937;
  --sf-muted: #6b7280;
  --sf-inset: 10px;
  --sf-header-top: 4px;
  --sf-bar-h: 60px;
  --sf-radius: 18px;
}

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
/* Off-screen start positions of slide-in animations must never cause sideways scrolling */
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}
img { max-width: 100%; }

/* --------------------------------------------------------------------------
   Floating header
   -------------------------------------------------------------------------- */
.sf-header {
  position: fixed;
  top: var(--sf-header-top);
  left: var(--sf-inset);
  right: var(--sf-inset);
  z-index: 60;
  transition: top .3s ease;
}

.sf-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1320px;
  height: var(--sf-bar-h);
  margin: 0 auto;
  padding: 0 8px 0 12px;
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(30, 58, 95, .08);
  border-radius: var(--sf-radius);
  box-shadow: 0 8px 30px -12px rgba(15, 23, 42, .25);
  transition: box-shadow .3s ease, background-color .3s ease;
}

.sf-header.is-scrolled .sf-bar {
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 12px 36px -12px rgba(15, 23, 42, .35);
}

/* Brand */
.sf-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
  color: var(--sf-navy);
  text-decoration: none;
}
.sf-brand img { width: 40px; height: 40px; object-fit: contain; }
.sf-brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.sf-brand-text strong { font-size: 1rem; font-weight: 700; }
.sf-brand-text small { font-size: .7rem; color: rgba(30, 58, 95, .7); }

/* Desktop navigation (hidden on small screens) */
.sf-nav { display: none; }
.sf-nav-list, .sf-dd-menu, .sf-mlist, .sf-mgroup-list { list-style: none; margin: 0; padding: 0; }

.sf-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #374151;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.sf-link:hover, .sf-dd:focus-within > .sf-link { color: var(--sf-navy); background: #f3f4f6; }
.sf-link[aria-current="page"], .sf-link.is-active { color: var(--sf-navy); font-weight: 600; }
.sf-link[aria-current="page"]::after, .sf-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--sf-gold);
}

.sf-chev { width: 16px; height: 16px; flex-shrink: 0; transition: transform .2s ease; }

/* Dropdowns */
.sf-dd { position: relative; }
.sf-dd-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  margin-top: 10px;
  padding: 6px;
  background: #fff;
  border: 1px solid #f1f1f4;
  border-radius: 14px;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
/* Bridge the gap so the pointer can travel from the button into the menu */
.sf-dd-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.sf-dd.is-open .sf-dd-menu { opacity: 1; visibility: visible; transform: none; }
.sf-dd.is-open .sf-chev { transform: rotate(180deg); }
.sf-dd-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: #374151;
  font-size: .875rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.sf-dd-menu a:hover, .sf-dd-menu a:focus-visible { background: var(--sf-navy); color: #fff; }
.sf-dd-menu a[aria-current="page"] { color: var(--sf-navy); font-weight: 600; background: #f3f4f6; }
.sf-dd-menu a[aria-current="page"]:hover { color: #fff; background: var(--sf-navy); }

/* Actions */
.sf-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

.sf-phone { display: none; }

.sf-apply {
  display: none;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--sf-gold), var(--sf-gold-dark));
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 8px 20px -8px rgba(212, 175, 55, .7);
  transition: filter .2s ease, box-shadow .2s ease;
}
.sf-apply:hover { filter: brightness(1.05); box-shadow: 0 10px 24px -8px rgba(212, 175, 55, .85); }

.sf-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #f3f4f6;
  color: var(--sf-navy);
  cursor: pointer;
  transition: background-color .2s ease;
}
.sf-menu-btn:hover { background: #e5e7eb; }
.sf-menu-btn svg { width: 22px; height: 22px; }
.sf-menu-btn .sf-icon-close { display: none; }
.sf-header.is-menu-open .sf-menu-btn .sf-icon-open { display: none; }
.sf-header.is-menu-open .sf-menu-btn .sf-icon-close { display: block; }

.sf-link:focus-visible, .sf-menu-btn:focus-visible, .sf-apply:focus-visible,
.sf-brand:focus-visible, .sf-mlink:focus-visible, .sf-phone:focus-visible {
  outline: 2px solid var(--sf-gold);
  outline-offset: 2px;
}

/* Mobile menu panel */
.sf-mobile {
  max-width: 1320px;
  margin: 8px auto 0;
  max-height: calc(100vh - var(--sf-bar-h) - var(--sf-inset) * 3);
  max-height: calc(100dvh - var(--sf-bar-h) - var(--sf-inset) * 3);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(30, 58, 95, .08);
  border-radius: var(--sf-radius);
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, .4);
  animation: sf-drop .2s ease;
}
.sf-mobile[hidden] { display: none; }

@keyframes sf-drop {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.sf-mlink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #374151;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.sf-mlink:hover { background: #f9fafb; color: var(--sf-navy); }
.sf-mlink[aria-current="page"] { background: var(--sf-navy); color: #fff; }
.sf-mtoggle.is-active { color: var(--sf-navy); font-weight: 600; }
.sf-msub { min-height: 44px; padding-left: 28px; font-size: .95rem; }

.sf-mgroup-list { display: none; padding-bottom: 4px; }
.sf-mgroup.is-open .sf-mgroup-list { display: block; }
.sf-mgroup.is-open .sf-chev { transform: rotate(180deg); }

.sf-mfoot {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 6px 6px;
  border-top: 1px solid #f1f1f4;
}
.sf-mphone {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: var(--sf-navy);
  font-weight: 500;
  text-decoration: none;
}
.sf-mphone svg { width: 18px; height: 18px; }
.sf-apply-block { display: flex; height: 48px; }

.sf-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, .35);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sf-backdrop[hidden] { display: none; }

body.sf-lock { overflow: hidden; }

@media (min-width: 480px) {
  .sf-actions .sf-apply { display: inline-flex; }
}

@media (min-width: 768px) {
  :root { --sf-inset: 14px; --sf-header-top: 6px; --sf-bar-h: 68px; }
  .sf-bar { padding: 0 10px 0 16px; }
  .sf-brand img { width: 46px; height: 46px; }
  .sf-brand-text strong { font-size: 1.1rem; }
  .sf-brand-text small { font-size: .75rem; }
}

/* Full navigation once there is room for every item on one line */
@media (min-width: 1280px) {
  :root { --sf-inset: 16px; --sf-header-top: 6px; --sf-bar-h: 72px; }
  .sf-bar { gap: 16px; padding: 0 12px 0 18px; }
  .sf-nav { display: block; flex: 1 1 auto; min-width: 0; }
  .sf-nav-list { display: flex; align-items: center; justify-content: center; gap: 2px; }
  .sf-menu-btn, .sf-mobile, .sf-backdrop { display: none !important; }
  .sf-header.is-scrolled { top: 4px; }
}

@media (min-width: 1440px) {
  .sf-link { padding: 8px 12px; }
}

@media (min-width: 1600px) {
  .sf-bar { max-width: 1520px; }
  .sf-mobile { max-width: 1520px; }
  .sf-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
    color: var(--sf-navy);
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
  }
  .sf-phone svg { width: 16px; height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-header, .sf-bar, .sf-dd-menu, .sf-chev { transition: none; }
  .sf-mobile { animation: none; }
}

/* --------------------------------------------------------------------------
   Home hero: clear the floating header and keep the slider dots and scroll
   indicator below the hero text on small screens
   -------------------------------------------------------------------------- */
.sf-hero-content { padding-top: 104px; padding-bottom: 168px; }
.sf-hero-dots { bottom: 104px; }

[data-sf-dot]:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

@media (min-width: 1024px) {
  .sf-hero-content { padding-top: 120px; padding-bottom: 120px; }
  .sf-hero-dots { bottom: 6rem; }
}

/* --------------------------------------------------------------------------
   Page heroes run underneath the floating header. The top padding keeps the
   hero text in the same place it sat below the original solid header.
   -------------------------------------------------------------------------- */
.sf-page > section:first-child { padding-top: 10rem; }
.sf-page-flush > section:first-child { padding-top: 8.5rem; }

@media (min-width: 1024px) {
  .sf-page > section:first-child { padding-top: 13rem; }
  .sf-page-flush > section:first-child { padding-top: 9.5rem; }
}

/* --------------------------------------------------------------------------
   Forms: full-width, touch-friendly select triggers
   -------------------------------------------------------------------------- */
button[data-sf-select] { width: 100%; min-height: 2.5rem; }

/* --------------------------------------------------------------------------
   Tab filters (Admissions, Gallery, Team): one swipeable row on phones,
   centred and wrapping from tablet width up
   -------------------------------------------------------------------------- */
.sf-tabbar {
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin-left: -1rem;
  margin-right: -1rem;
  padding: 6px 1rem 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 1rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sf-tabbar::-webkit-scrollbar { display: none; }
.sf-tabbar > * { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
.sf-tabbar > [data-sf-tab] { padding: .625rem 1.125rem; }

@media (min-width: 640px) {
  .sf-tabbar {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    overflow: visible;
  }
  .sf-tabbar > [data-sf-tab] { padding: .75rem 1.5rem; }
}

/* --------------------------------------------------------------------------
   Staff bios: expandable when the text is longer than three lines
   -------------------------------------------------------------------------- */
p.line-clamp-3.sf-expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }
p[data-sf-readmore] { margin-bottom: .25rem; }
.sf-readmore {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sf-navy);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
}
.sf-readmore:hover { color: var(--sf-gold-dark); text-decoration: underline; }

/* Safeguarding page opens with a logo rather than a hero; clear the header */
.sf-page-safe > section:first-child { padding-top: 6rem; }

/* --------------------------------------------------------------------------
   Board portraits: preserve every face instead of cropping portrait photos to
   a landscape frame. Profile modals keep the image and heading in separate
   regions so the overlay never obscures a face.
   -------------------------------------------------------------------------- */
.member-image,
.modal-header {
  background: #eef2f7;
}

.member-image img,
.modal-header img {
  object-fit: contain;
  object-position: center top;
}

.member-image .image-overlay,
.modal-header-overlay {
  display: none;
}

.modal-header-info {
  position: static;
  padding: 1.5rem 2rem;
  background: #1e3a5f;
}

/* Footer credit remains readable, keyboard-visible and consistent with the
   school's gold accent on every page. */
.sf-credit-link {
  color: rgba(255, 255, 255, .78);
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  transition: color .2s ease;
}

.sf-credit-link:hover {
  color: #d4af37;
}

.sf-credit-link:focus-visible {
  border-radius: .25rem;
  outline: 2px solid #d4af37;
  outline-offset: 4px;
}
