/* ==========================================================================
   hf-shared.css
   Shared design tokens, base reset, header/nav, and footer styles.
   Imported by both css/mstyles.css (home) and css/substyles.css (sub pages)
   so every page shares one header and one footer look.
   ========================================================================== */

:root {
  /* Brand color tokens */
  --color-navy: #1b3d6d;
  --color-navy-dark: #12294a;
  --color-red: #d72131;
  --color-red-dark: #ab1826;
  --color-cream: #f6f3ec;
  --color-ink: #1c2430;
  --color-slate: #5b6472;
  --color-white: #ffffff;
  --color-border: #e2ddd0;

  /* Type tokens */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Layout tokens */
  --max-width: 1200px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 10px;
  --radius-lg: 18px;

  /* Motion */
  --transition-fast: 150ms ease;
  --transition-med: 260ms ease;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-white);
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-red-dark);
}

a:not([class]) {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-navy);
  line-height: 1.2;
  margin-top: 0;
}

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-red);
  outline-offset: 2px;
}

/* ---------- Visually hidden but accessible ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  background: var(--color-navy);
  color: var(--color-white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  z-index: 1000;
  transform: translateY(-150%);
  transition: transform var(--transition-fast);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Ribbon motif ----------
   Signature device: a narrow navy/red/navy stripe bar echoing a
   service ribbon bar. Used sparingly as a divider under key headings. */
.ribbon-bar {
  display: block;
  width: 72px;
  height: 6px;
  margin: 0.85rem 0 1.5rem;
  background: repeating-linear-gradient(
    90deg,
    var(--color-navy) 0 22px,
    var(--color-red) 22px 30px,
    var(--color-navy) 30px 52px
  );
  border-radius: 3px;
}

.ribbon-bar--center {
  margin-inline: auto;
}

.ribbon-bar--light {
  background: repeating-linear-gradient(
    90deg,
    var(--color-white) 0 22px,
    var(--color-red) 22px 30px,
    var(--color-white) 30px 52px
  );
  opacity: 0.92;
}

/* Ribbon-tick list marker, used for the Purposes list */
.ribbon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.ribbon-list li {
  position: relative;
  padding-left: 2rem;
}

.ribbon-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 14px;
  height: 14px;
  background: var(--color-red);
  clip-path: polygon(50% 0%, 100% 35%, 82% 100%, 50% 78%, 18% 100%, 0% 35%);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.btn-primary {
  background: var(--color-red);
  color: var(--color-white);
}
.btn-primary:hover {
  background: var(--color-red-dark);
  color: var(--color-white);
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}
.btn-secondary:hover {
  background: var(--color-white);
  color: var(--color-navy);
}

.btn-outline-navy {
  background: transparent;
  border-color: var(--color-navy);
  color: var(--color-navy);
}
.btn-outline-navy:hover {
  background: var(--color-navy);
  color: var(--color-white);
}

/* ==========================================================================
   Header / Navigation
   Rebuilt on a proven, simple pattern: no position:fixed, no overlays,
   no backdrop-filter anywhere near the nav. Mobile nav is just a normal
   block that shows/hides in the page flow — nothing that can be hijacked
   by containing-block quirks in any browser.
   ========================================================================== */

/* ---------- Logo bar ---------- */
.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

.brand-row {
  display: flex;
  justify-content: center;
  padding-block: 1.1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--color-navy);
}

.brand-mark {
  flex-shrink: 0;
  height: 56px;
  width: auto;
  object-fit: contain;
}

@media (min-width: 768px) {
  .brand-mark {
    height: 92px;
  }
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  font-size: clamp(1.05rem, 2.4vw, 1.55rem);
  letter-spacing: -0.01em;
}

.brand:hover .brand-text {
  color: var(--color-red-dark);
}

/* ---------- Nav bar ---------- */
.site-nav {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 500;
  transition: box-shadow var(--transition-fast);
}

.site-nav.is-scrolled {
  box-shadow: 0 6px 18px rgba(18, 41, 74, 0.1);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 0.4rem;
}

/* Mobile menu button — hidden on medium/large screens */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-navy);
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-block: 0.5rem;
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
}

/* Nav list */
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list > li {
  position: relative;
}

.nav-list > li > a,
.nav-list > li > button.has-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-ink);
  background: none;
  border: none;
  text-decoration: none;
  padding: 0.85rem 0.35rem;
  cursor: pointer;
  text-align: left;
}

.nav-list a:hover,
.nav-list button.has-sub:hover {
  color: var(--color-red-dark);
}

.caret {
  font-size: 0.7em;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.has-sub[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

/* Dropdown */
.dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}

.dropdown.open {
  display: block;
}

.dropdown a {
  display: block;
  padding: 0.65rem 0.35rem 0.65rem 1.25rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-ink);
  text-decoration: none;
}

.dropdown a:hover {
  color: var(--color-red-dark);
}

.nav-cta {
  display: inline-block;
  background: var(--color-red) !important;
  color: var(--color-white) !important;
  border-radius: 999px;
  padding: 0.7rem 1.25rem !important;
  text-align: center;
}

.nav-cta:hover {
  background: var(--color-red-dark) !important;
  color: var(--color-white) !important;
}

/* ---------- Mobile layout (<768px): plain stacked accordion menu ---------- */
@media (max-width: 767px) {
  .nav-row {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-list {
    display: none;
    width: 100%;
    padding-bottom: 0.75rem;
  }

  .nav-list.open {
    display: block;
  }

  .nav-list > li {
    border-top: 1px solid var(--color-border);
  }

  .dropdown {
    background: var(--color-cream);
  }

  .nav-cta {
    display: block;
    margin: 0.75rem 0.35rem 0.25rem;
  }
}

/* ---------- Desktop/tablet layout (>=768px): normal horizontal bar ---------- */
@media (min-width: 768px) {
  .nav-list {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.1rem;
  }

  .nav-list > li > a,
  .nav-list > li > button.has-sub {
    width: auto;
    padding: 0.65rem 0.7rem;
    font-size: 0.92rem;
  }

  .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 16px 32px rgba(18, 41, 74, 0.16);
    padding: 0.5rem;
    z-index: 50;
  }

  .dropdown--wide {
    columns: 2;
    column-gap: 0.5rem;
    min-width: 420px;
  }

  .dropdown--wide li {
    break-inside: avoid;
  }

  .dropdown a {
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
  }

  .dropdown a:hover {
    background: var(--color-cream);
  }

  .nav-cta {
    margin-left: 0.4rem;
  }
}

@media (min-width: 768px) and (max-width: 1099px) {
  .nav-list > li > a,
  .nav-list > li > button.has-sub {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--color-navy-dark);
  color: #dbe4f2;
  margin-top: 4rem;
}

.footer-inner {
  padding-block: 3rem 2rem;
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1.3fr 1fr 1fr;
}

@media (max-width: 780px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

.footer-inner h2 {
  color: var(--color-white);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-body);
  margin-bottom: 0.85rem;
}

.footer-inner a {
  color: #dbe4f2;
  text-decoration: none;
}

.footer-inner a:hover {
  color: var(--color-white);
  text-decoration: underline;
}

.footer-org-name {
  font-family: var(--font-display);
  color: var(--color-white);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.footer-social {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

.footer-social a:hover {
  background: var(--color-red);
}

.site-info {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-block: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: #aebada;
}

.page-scroll-up {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 400;
}

.page-scroll-up a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--color-navy);
  color: var(--color-white);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(18, 41, 74, 0.35);
}

.page-scroll-up a:hover {
  background: var(--color-red);
}
