/**
 * Elimu ERP – Site Header & Footer
 * Colours, fonts and shadows come from Elimu ERP Core's design tokens (--eerp-*), so the school's
 * chosen colours apply automatically. Link and button states are set explicitly so the theme's own
 * hover and focus colours cannot override them.
 */

/* Hide the theme's own header and footer. */
body.eerp-has-site-header #masthead,
body.eerp-has-site-header #colophon,
body.eerp-has-site-header .ast-mobile-popup-drawer {
  display: none !important;
}

.eerp-sh-header,
.eerp-sh-header *,
.eerp-sh-footer,
.eerp-sh-footer * {
  box-sizing: border-box;
}

.eerp-sh-header ul,
.eerp-sh-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.eerp-sh-header,
.eerp-sh-footer {
  font-family: var(--eerp-font-body);
  line-height: 1.5;
}

.eerp-sh-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.eerp-sh-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--eerp-surface);
}
.admin-bar .eerp-sh-header { top: 32px; }
@media (max-width: 782px) {
  .admin-bar .eerp-sh-header { top: 46px; }
}

/* Thin contact bar */
.eerp-sh-bar {
  background: var(--eerp-brand);
  color: var(--eerp-on-brand);
  font-size: 12.5px;
}
.eerp-sh-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 34px;
}
.eerp-sh-bar-contact,
.eerp-sh-bar-social {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.eerp-sh-bar a,
.eerp-sh-bar a:hover,
.eerp-sh-bar a:focus {
  color: var(--eerp-on-brand) !important;
  text-decoration: none !important;
  opacity: 0.9;
}
.eerp-sh-bar a:hover,
.eerp-sh-bar a:focus {
  opacity: 1;
  text-decoration: underline !important;
}

/* Main row */
.eerp-sh-main {
  border-bottom: 1px solid var(--eerp-border);
}
.eerp-sh-row {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
}

/* Brand */
.eerp-sh-brand,
.eerp-sh-brand:hover,
.eerp-sh-brand:focus {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: var(--eerp-brand) !important;
  flex-shrink: 0;
}
.eerp-sh-crest {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--eerp-brand);
  color: var(--eerp-brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--eerp-font-display);
  font-size: 19px;
  font-weight: 500;
}
.eerp-sh-logo img {
  display: block;
  max-height: 46px;
  width: auto;
}
.eerp-sh-logo .custom-logo-link {
  display: block;
  line-height: 0;
}
.eerp-sh-brand-text {
  display: flex;
  flex-direction: column;
}
.eerp-sh-name {
  font-family: var(--eerp-font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--eerp-brand);
}
.eerp-sh-tagline {
  font-size: 11.5px;
  color: var(--eerp-text-muted);
}

/* Navigation */
.eerp-sh-nav {
  flex: 1;
  align-self: stretch;
  display: flex;
}
.eerp-sh-nav .eerp-sh-list {
  display: flex;
  align-items: stretch;
  gap: 2px;
  flex-wrap: wrap;
}
.eerp-sh-item {
  position: relative;
  display: flex;
  align-items: stretch;
}
.eerp-sh-item > a,
.eerp-sh-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--eerp-text-muted) !important;
  text-decoration: none !important;
  position: relative;
}
.eerp-sh-item > a:hover,
.eerp-sh-item > a:focus,
.eerp-sh-trigger:hover,
.eerp-sh-trigger:focus,
.eerp-sh-has-sub.is-open > .eerp-sh-trigger {
  color: var(--eerp-brand) !important;
  background: transparent !important;
}
.eerp-sh-item.is-active > a,
.eerp-sh-item.is-active > .eerp-sh-trigger {
  color: var(--eerp-brand) !important;
}
.eerp-sh-item.is-active > a::after,
.eerp-sh-item.is-active > .eerp-sh-trigger::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--eerp-brand-accent);
}
.eerp-sh-trigger:focus-visible,
.eerp-sh-item > a:focus-visible,
.eerp-sh-account-btn:focus-visible,
.eerp-sh-toggle:focus-visible,
.eerp-sh-close:focus-visible,
.eerp-sh-btn:focus-visible {
  outline: 2px solid var(--eerp-brand);
  outline-offset: -2px;
}
.eerp-sh-chevron {
  transition: transform 0.15s ease;
}
.eerp-sh-has-sub.is-open > .eerp-sh-trigger .eerp-sh-chevron,
.eerp-sh-account.is-open .eerp-sh-chevron {
  transform: rotate(180deg);
}

/* Dropdown panels */
.eerp-sh-sub,
.eerp-sh-account-panel {
  display: none;
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  min-width: 230px;
  padding: 8px;
  background: var(--eerp-surface);
  border: 1px solid var(--eerp-border);
  border-radius: var(--eerp-radius-lg);
  box-shadow: var(--eerp-shadow);
  z-index: 20;
}
.eerp-sh-has-sub.is-open > .eerp-sh-sub,
.eerp-sh-account.is-open .eerp-sh-account-panel {
  display: block;
}
@media (hover: hover) and (min-width: 961px) {
  .eerp-sh-has-sub:hover > .eerp-sh-sub {
    display: block;
  }
}
.eerp-sh-sub a,
.eerp-sh-account-panel a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--eerp-radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  color: var(--eerp-neutral-700) !important;
}
.eerp-sh-sub a:hover,
.eerp-sh-sub a:focus,
.eerp-sh-sub a.is-active,
.eerp-sh-account-panel a:hover,
.eerp-sh-account-panel a:focus {
  background: var(--eerp-brand-soft);
  color: var(--eerp-brand) !important;
}

/* Right-hand actions */
.eerp-sh-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}
.eerp-sh-nav + .eerp-sh-actions {
  margin-left: 0;
}
.eerp-sh-btn,
.eerp-sh-btn:hover,
.eerp-sh-btn:focus,
.eerp-sh-btn:active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--eerp-radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  color: var(--eerp-on-brand) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  white-space: nowrap;
}
.eerp-sh-btn {
  background: var(--eerp-brand) !important;
}
.eerp-sh-btn:hover,
.eerp-sh-btn:focus,
.eerp-sh-btn:active {
  background: var(--eerp-brand-hover) !important;
}
.eerp-sh-btn.eerp-sh-btn-outline,
.eerp-sh-btn.eerp-sh-btn-outline:hover,
.eerp-sh-btn.eerp-sh-btn-outline:focus {
  color: var(--eerp-brand) !important;
  border-color: var(--eerp-brand) !important;
}
.eerp-sh-btn.eerp-sh-btn-outline {
  background: var(--eerp-surface) !important;
}
.eerp-sh-btn.eerp-sh-btn-outline:hover,
.eerp-sh-btn.eerp-sh-btn-outline:focus {
  background: var(--eerp-brand-soft) !important;
}
.eerp-sh-link,
.eerp-sh-link:hover,
.eerp-sh-link:focus {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  color: var(--eerp-text-muted) !important;
}
.eerp-sh-link:hover,
.eerp-sh-link:focus {
  color: var(--eerp-brand) !important;
}

/* Account menu */
.eerp-sh-account {
  position: relative;
}
.eerp-sh-account-btn,
.eerp-sh-account-btn:hover,
.eerp-sh-account-btn:focus,
.eerp-sh-account-btn:active {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px !important;
  border: 1px solid var(--eerp-border) !important;
  background: var(--eerp-surface) !important;
  color: var(--eerp-neutral-700) !important;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none !important;
}
.eerp-sh-account-btn:hover,
.eerp-sh-account-btn:focus {
  background: var(--eerp-brand-soft) !important;
}
.eerp-sh-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--eerp-brand-soft);
  color: var(--eerp-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.eerp-sh-account-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eerp-sh-account-panel {
  left: auto;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
}
.eerp-sh-account-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--eerp-neutral-100);
}
.eerp-sh-account-head strong {
  font-size: 14px;
  color: var(--eerp-neutral-900);
}
.eerp-sh-account-head span {
  font-size: 12.5px;
  color: var(--eerp-text-muted);
}

/* Mobile menu button and drawer */
.eerp-sh-toggle,
.eerp-sh-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
}
.eerp-sh-toggle,
.eerp-sh-toggle:hover,
.eerp-sh-toggle:focus,
.eerp-sh-toggle:active,
.eerp-sh-close,
.eerp-sh-close:hover,
.eerp-sh-close:focus,
.eerp-sh-close:active {
  border-radius: var(--eerp-radius) !important;
  border: 1px solid var(--eerp-border) !important;
  background: var(--eerp-surface) !important;
  color: var(--eerp-brand) !important;
  box-shadow: none !important;
}
.eerp-sh-toggle:hover,
.eerp-sh-toggle:focus,
.eerp-sh-close:hover,
.eerp-sh-close:focus {
  background: var(--eerp-brand-soft) !important;
}
.eerp-sh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 1001;
}
.eerp-sh-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.eerp-sh-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(88vw, 360px);
  display: flex;
  flex-direction: column;
  background: var(--eerp-surface);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
  z-index: 1002;
  overflow-y: auto;
}
.eerp-sh-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}
.eerp-sh-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--eerp-border);
}
.eerp-sh-list-drawer {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  flex: 1;
}
.eerp-sh-list-drawer .eerp-sh-item {
  display: block;
}
.eerp-sh-list-drawer .eerp-sh-item > a,
.eerp-sh-list-drawer .eerp-sh-trigger {
  width: 100%;
  justify-content: space-between;
  padding: 14px 12px;
  border-radius: var(--eerp-radius) !important;
  font-size: 15px;
}
.eerp-sh-list-drawer .eerp-sh-item.is-active > a::after,
.eerp-sh-list-drawer .eerp-sh-item.is-active > .eerp-sh-trigger::after {
  display: none;
}
.eerp-sh-list-drawer .eerp-sh-item.is-active > a,
.eerp-sh-list-drawer .eerp-sh-item.is-active > .eerp-sh-trigger {
  background: var(--eerp-brand-soft) !important;
}
.eerp-sh-list-drawer .eerp-sh-sub {
  position: static;
  min-width: 0;
  padding: 0 0 0 12px;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.eerp-sh-drawer-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--eerp-border);
}
.eerp-sh-drawer-foot .eerp-sh-account-head {
  padding: 0 0 8px;
  border: 0;
  margin: 0;
}
body.eerp-sh-locked {
  overflow: hidden;
}

@media (max-width: 960px) {
  .eerp-sh-nav,
  .eerp-sh-tagline,
  .eerp-sh-link,
  .eerp-sh-account-name,
  .eerp-sh-account-btn .eerp-sh-chevron,
  .eerp-sh-bar-social {
    display: none !important;
  }
  .eerp-sh-toggle {
    display: inline-flex;
  }
  .eerp-sh-close {
    display: inline-flex;
    width: 40px;
    height: 40px;
  }
  .eerp-sh-account-btn {
    padding: 3px !important;
  }
  .eerp-sh-actions {
    /* !important needed: .eerp-sh-nav + .eerp-sh-actions (margin-left: 0) has higher
       specificity than this rule and would otherwise win even though nav is hidden here. */
    margin-left: auto !important;
  }
  .eerp-sh-row {
    min-height: 62px;
    gap: 12px;
  }
}
@media (max-width: 520px) {
  .eerp-sh-bar-contact a:nth-child(2) {
    display: none;
  }
  .eerp-sh-name {
    font-size: 18px;
  }
}

/* ---------- Footer ---------- */
.eerp-sh-footer {
  background: var(--eerp-brand);
  color: var(--eerp-on-brand);
  border-top: 3px solid var(--eerp-brand-accent);
  font-size: 14px;
}
.eerp-sh-footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr 1fr;
  gap: 32px;
  padding-top: 44px;
  padding-bottom: 32px;
}
.eerp-sh-footer-title {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--eerp-brand-accent);
}
.eerp-sh-footer-school {
  font-family: var(--eerp-font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--eerp-on-brand);
}
.eerp-sh-footer p {
  margin: 0 0 10px;
  opacity: 0.85;
}
.eerp-sh-footer-tagline {
  color: var(--eerp-brand-accent);
  opacity: 1 !important;
}
.eerp-sh-footer li {
  margin-bottom: 8px;
  opacity: 0.9;
}
.eerp-sh-footer a,
.eerp-sh-footer a:hover,
.eerp-sh-footer a:focus {
  color: var(--eerp-on-brand) !important;
  text-decoration: none !important;
}
.eerp-sh-footer a:hover,
.eerp-sh-footer a:focus {
  color: var(--eerp-brand-accent) !important;
  text-decoration: underline !important;
}
.eerp-sh-footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px;
}
.eerp-sh-footer-bottom-row {
  display: flex;
  justify-content: center;
  text-align: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  padding-bottom: 16px;
  opacity: 0.85;
}
@media (max-width: 900px) {
  .eerp-sh-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .eerp-sh-footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
