/* ==========================================================================
   Xroad chrome: brand tokens, DM Sans, and the canonical site header + footer.
   Loaded on every page before theme.css. Also the only theme stylesheet on the
   services landing pages (template-service-landing.php), whose design files bring
   their own base styles, so every rule here is scoped to #xroad-header/#xroad-footer
   except the font face and the tokens.
   ========================================================================== */

/* Self-hosted DM Sans (variable, weights 100–1000) — no Google Fonts hotlink */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url('../fonts/dm-sans.woff2') format('woff2');
}

:root {
  /* Color tokens (exact hex) */
  --xr-brand-purple:  #342669; /* primary: headings, primary buttons, header bg */
  --xr-deep-purple:   #2A1F4F; /* darkest: footer bg, gradient start */
  --xr-brand-blue:    #6873B7; /* secondary accents, focus, links */
  --xr-light-purple:  #E8E3F3; /* card/callout fill, input borders, icon badges */
  --xr-brand-orange:  #F7941D; /* CTA gradient start, accent (ONE per section max) */
  --xr-accent-orange: #F15A29; /* CTA gradient end, urgency accent */
  --xr-charcoal:      #414042; /* body text */
  --xr-warm-gray:     #F7F7F7; /* section backgrounds */
  --xr-success-green: #00B878; /* validation/check accents only */
  --xr-white:         #FFFFFF;
  --xr-scroll-purple: #1A1333; /* header bg after scroll */

  /* Gradients */
  --xr-hero-grad:   linear-gradient(145deg, #2A1F4F 0%, #342669 100%);
  --xr-bar-grad:    linear-gradient(90deg, #2A1F4F, #342669);
  --xr-orange-grad: linear-gradient(90deg, #F7941D, #F15A29);

  /* Type */
  --xr-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --xr-font-head: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --xr-maxw: 1200px;
  --xr-gutter: 24px;

  /* Card shadow */
  --xr-card-shadow: 0 6px 24px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  --xr-card-shadow-lg: 0 16px 40px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08); /* hover / focus-within lift */
}

/* ==========================================================================
   Header (Appendix A)
   ========================================================================== */
#xroad-header {
  background: var(--xr-brand-purple);
  padding: 14px 0;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 99999;
  transition: background .4s ease, box-shadow .4s ease;
  box-shadow: none;
}
#xroad-header.scrolled { background: var(--xr-scroll-purple); box-shadow: 0 4px 20px rgba(0,0,0,.45); }
#xroad-header .xr-header-inner {
  max-width: var(--xr-maxw); margin: 0 auto; padding: 0 var(--xr-gutter);
  display: flex; align-items: center; justify-content: space-between;
}
#xroad-header .xr-logo { display: flex; align-items: center; text-decoration: none; }
#xroad-header .xr-nav { display: flex; align-items: center; gap: 28px; }
#xroad-header .xr-nav-link {
  font-family: var(--xr-font-body); font-size: 15px; font-weight: 500;
  color: var(--xr-white); text-decoration: none; padding: 6px 10px; border-radius: 6px;
  transition: text-shadow .3s ease, color .3s ease;
}
#xroad-header .xr-nav-link:hover {
  text-shadow: 0 0 12px rgba(247,148,29,.7), 0 0 24px rgba(241,90,41,.4);
  color: var(--xr-brand-orange);
}
#xroad-header .xr-nav-btn-outline {
  font-family: var(--xr-font-body); font-size: 15px; font-weight: 600;
  color: var(--xr-white); text-decoration: none; padding: 10px 22px;
  border: 2px solid var(--xr-white); border-radius: 6px;
  transition: border-color .3s ease, box-shadow .3s ease, color .3s ease;
}
#xroad-header .xr-nav-btn-outline:hover {
  border-color: var(--xr-brand-orange); color: var(--xr-brand-orange);
  box-shadow: 0 0 14px rgba(247,148,29,.5), 0 0 28px rgba(241,90,41,.25);
}
#xroad-header .xr-nav-btn-solid {
  font-family: var(--xr-font-body); font-size: 15px; font-weight: 600;
  color: var(--xr-brand-purple); text-decoration: none; padding: 10px 22px;
  background: var(--xr-white); border: 2px solid var(--xr-white); border-radius: 6px;
  transition: box-shadow .3s ease, background .3s ease, border-color .3s ease;
}
#xroad-header .xr-nav-btn-solid:hover {
  background: var(--xr-brand-orange); border-color: var(--xr-brand-orange); color: var(--xr-white);
  box-shadow: 0 0 14px rgba(247,148,29,.5), 0 0 28px rgba(241,90,41,.25);
}

/* Hamburger (hidden on desktop) */
#xroad-header .xr-burger {
  display: none; background: none; border: 0; cursor: pointer; padding: 8px;
  width: 44px; height: 44px;
}
#xroad-header .xr-burger span {
  display: block; width: 24px; height: 2px; background: var(--xr-white); margin: 5px auto;
  transition: transform .3s ease, opacity .3s ease;
}
#xroad-header.menu-open .xr-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#xroad-header.menu-open .xr-burger span:nth-child(2) { opacity: 0; }
#xroad-header.menu-open .xr-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  #xroad-header .xr-burger { display: block; }
  #xroad-header .xr-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 8px;
    background: var(--xr-scroll-purple); padding: 16px var(--xr-gutter);
    box-shadow: 0 12px 24px rgba(0,0,0,.4);
    /* display state in CSS, never inline (past bug: inline display:flex stuck the menu open) */
    display: none;
  }
  #xroad-header.menu-open .xr-nav { display: flex; }
  #xroad-header .xr-nav-link,
  #xroad-header .xr-nav-btn-outline,
  #xroad-header .xr-nav-btn-solid { text-align: center; }
}

/* ==========================================================================
   Footer (Appendix B)
   ========================================================================== */
#xroad-footer { background: var(--xr-deep-purple); padding: 64px 0 0; }
#xroad-footer .xr-footer-top {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 48px;
  padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,.1);
}
#xroad-footer .xr-footer-blurb {
  font-size: 14px; color: rgba(255,255,255,.7); line-height: 1.6;
  margin: 0 0 20px; max-width: 280px;
}
#xroad-footer h2 { /* was h4: h2 is sequential after any page body (h1 only, or h2 sections) */
  font-size: 14px; font-weight: 600; color: var(--xr-white); margin: 0 0 16px;
  text-transform: uppercase; letter-spacing: .5px;
}
#xroad-footer .xr-footer-col nav { display: flex; flex-direction: column; gap: 10px; }
#xroad-footer a { color: rgba(255,255,255,.7); text-decoration: none; font-size: 14px; transition: color .3s ease, text-shadow .3s ease; }
#xroad-footer a:hover { color: var(--xr-brand-orange); text-shadow: 0 0 12px rgba(247,148,29,.6); }
#xroad-footer .xr-social { display: flex; gap: 10px; flex-wrap: wrap; }
#xroad-footer .xr-social a {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  background: rgba(255,255,255,.1); border-radius: 6px; color: #fff;
  transition: background .3s ease, box-shadow .3s ease, color .3s ease;
}
#xroad-footer .xr-social a:hover {
  color: var(--xr-brand-orange); background: rgba(255,255,255,.15);
  box-shadow: 0 0 14px rgba(247,148,29,.4);
}
#xroad-footer .xr-footer-cta {
  display: inline-block; font-size: 14px; font-weight: 600; color: var(--xr-deep-purple);
  background: var(--xr-white); padding: 10px 20px; border-radius: 6px;
}
#xroad-footer .xr-footer-cta:hover { background: var(--xr-brand-orange); color: var(--xr-white); }
#xroad-footer .xr-footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 0; flex-wrap: wrap; gap: 16px;
}
#xroad-footer .xr-footer-bottom p,
#xroad-footer .xr-footer-bottom a { font-size: 13px; color: rgba(255,255,255,.5); margin: 0; }
#xroad-footer .xr-footer-bottom nav { display: flex; gap: 24px; flex-wrap: wrap; }

@media (max-width: 768px) {
  #xroad-footer .xr-footer-top { grid-template-columns: 1fr; text-align: center; }
  #xroad-footer .xr-footer-col nav { align-items: center; }
  #xroad-footer .xr-social { justify-content: center; }
  #xroad-footer .xr-footer-bottom { flex-direction: column; text-align: center; }
}

/* 2. Fixed header: respect notch / safe areas, and let the mobile dropdown scroll on
      short (landscape) viewports instead of being cut off. */
#xroad-header .xr-header-inner {
  padding-left:  max(var(--xr-gutter), env(safe-area-inset-left));
  padding-right: max(var(--xr-gutter), env(safe-area-inset-right));
}
@media (max-width: 768px) {
  #xroad-header .xr-nav { max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); overflow-y: auto; -webkit-overflow-scrolling: touch; gap: 4px; }
  /* 44px minimum tap height for every item in the mobile menu (was ~34px text links) */
  #xroad-header .xr-nav-link,
  #xroad-header .xr-nav-btn-outline,
  #xroad-header .xr-nav-btn-solid {
    display: flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 12px 16px; font-size: 16px;
  }
  #xroad-header .xr-nav-link:hover { text-shadow: none; }
}

/* 3. Footer tap targets (were 21–22px tall; WCAG 2.5.8 minimum is 24px, 44px recommended) */
#xroad-footer .xr-footer-col nav { gap: 0; }
#xroad-footer .xr-footer-col nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
#xroad-footer .xr-social a { width: 44px; height: 44px; }
#xroad-footer .xr-footer-cta { padding: 12px 22px; min-height: 44px; }
#xroad-footer .xr-footer-bottom nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
#xroad-footer .xr-footer-bottom p,
#xroad-footer .xr-footer-bottom a { font-size: 14px; }
@media (max-width: 768px) {
  #xroad-footer { padding-top: 48px; }
  #xroad-footer .xr-footer-top { gap: 32px; padding-bottom: 32px; }
  #xroad-footer .xr-footer-blurb { margin-left: auto; margin-right: auto; }
  #xroad-footer .xr-footer-bottom nav { gap: 8px 16px; justify-content: center; }
}

/* Self-sufficient chrome: what theme.css's base layer gives the header and footer on
   ordinary pages, restated (scoped) for pages that load chrome.css alone. */
#xroad-header, #xroad-footer { font-family: var(--xr-font-body); line-height: 1.6; }
#xroad-footer h2 { font-family: var(--xr-font-head); line-height: 1.2; }
#xroad-footer .xr-container { max-width: var(--xr-maxw); margin: 0 auto; padding: 0 var(--xr-gutter); }
#xroad-header :is(a, button):focus-visible,
#xroad-footer a:focus-visible {
  outline: 2px solid var(--xr-white);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--xr-brand-purple);
}
