/* base.css — global resets and shared element styles */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body-regular-family);
  font-size: var(--font-body-regular-size);
  color: var(--color-neutral-900);
  background: var(--color-white);
}

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

a {
  color: inherit;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ==========================================================================
   SITE HEADER — shared across every page (partials/header.html)
   ========================================================================== */

/* Its own box would otherwise be exactly as tall as .site-header (the only
   thing inside it), which gives a sticky child nowhere to travel before its
   containing block's bottom edge — flush with its own — scrolls past the
   viewport top, releasing it immediately. display:contents removes this
   wrapper from the box tree so .site-header's containing block becomes
   <body> instead, which is as tall as the whole page. */
[data-include="header"] {
  display: contents;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 80px;
  /* Figma Navbar: white at 50% opacity. The blur isn't in Figma — it keeps
     nav text legible over content scrolling under the sticky header. */
  background: color-mix(in srgb, var(--color-white) 50%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-neutral-250);
}

/* Figma Brand Logo: wordmark, ® and slogan sit flush (no gaps). ® hangs at
   the top like a superscript; the slogan's baseline lines up with the
   wordmark's bottom edge (an <img>'s baseline is its bottom edge). */
.site-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  text-decoration: none;
}

.site-logo__mark {
  height: 21px;
  width: auto;
}

.site-logo__trademark {
  font-family: var(--font-body-small-family);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-0);
  color: var(--color-primary-500);
  align-self: flex-start;
  line-height: 1;
}

.site-logo__slogan {
  font-family: var(--font-body-small-family);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-0);
  letter-spacing: var(--font-slogan-letter-spacing);
  color: var(--color-neutral-400);
}

/* .site-nav-panel wraps the links and the CTA as a single unit. On desktop
   it just reproduces the original 3-part header layout (logo | nav | cta)
   via the same flex math — .site-nav-panel takes the remaining space and
   .site-nav centers itself within it, so the CTA still lands flush right.
   The wrapper only starts to matter at tablet/mobile, where it becomes the
   collapsible panel controlled by .nav-toggle. */
.site-nav-panel {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-lg);
}

.site-nav a {
  font-family: var(--font-body-regular-family);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-body-regular-size);
  line-height: var(--font-body-regular-line-height);
  letter-spacing: var(--font-nav-letter-spacing);
  color: var(--color-neutral-500);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-hover);
}

/* Hover underline (Figma nav link :hover): 2px Primary/500 bar 3px below the
   text. Figma adds it as padding + bottom border, which grows the link 5px;
   an absolutely positioned bar gives the same look without shifting layout. */
.site-nav a::after,
.site-footer__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  background: var(--color-primary-500);
  opacity: 0;
  transition: opacity var(--transition-hover);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-footer__nav a:hover,
.site-footer__nav a:focus-visible {
  color: var(--color-primary-600);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after,
.site-footer__nav a:hover::after,
.site-footer__nav a:focus-visible::after {
  opacity: 1;
}

/* Keyboard focus ring, shared by every interactive component that has a
   Figma hover state (page files repeat it for .button and arrow links). */
.site-nav a:focus-visible,
.site-footer__nav a:focus-visible,
.nav-cta:focus-visible,
.nav-dropdown__toggle:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* "Who We Serve" dropdown ---------------------------------------------------
   Not in Figma: built from the existing nav link, card and focus styles.
   Disclosure pattern — a button with aria-expanded showing/hiding a list of
   links (main.js); opens on click/tap rather than hover so it works the same
   for touch and keyboard. */
.nav-dropdown {
  position: relative;
}

/* Same type, color, and hover underline as the sibling nav links. */
.nav-dropdown__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-body-regular-family);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-body-regular-size);
  line-height: var(--font-body-regular-line-height);
  letter-spacing: var(--font-nav-letter-spacing);
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: color var(--transition-hover);
}

.nav-dropdown__toggle::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  background: var(--color-primary-500);
  opacity: 0;
  transition: opacity var(--transition-hover);
}

.nav-dropdown__toggle:hover,
.nav-dropdown__toggle:focus-visible,
.nav-dropdown__toggle[aria-expanded="true"] {
  color: var(--color-primary-600);
}

.nav-dropdown__toggle:hover::after,
.nav-dropdown__toggle:focus-visible::after,
.nav-dropdown__toggle[aria-expanded="true"]::after {
  opacity: 1;
}

/* Chevron icon used as a mask so it takes the text color. */
.nav-dropdown__chevron {
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url("../assets/icons/chevron-down.svg") center / contain no-repeat;
  mask: url("../assets/icons/chevron-down.svg") center / contain no-repeat;
  transition: transform var(--transition-hover);
}

.nav-dropdown__toggle[aria-expanded="true"] .nav-dropdown__chevron {
  transform: rotate(180deg);
}

/* Card under the toggle — border, radius and shadow match the form card and
   mobile nav panel. Centered under the toggle; --nav-dropdown-shift (set by
   main.js) nudges it back inside the viewport on narrow laptop widths.

   Open/close is animated, so instead of [hidden] the closed state uses
   visibility:hidden (which also removes it from the accessibility tree and
   tab order). Opening: fade + 6px slide down over 200ms ease-out. Closing is
   faster (140ms) and only flips visibility once the fade has finished. */
.nav-dropdown__menu {
  --nav-dropdown-shift: 0px;
  position: absolute;
  top: calc(100% + var(--space-md));
  left: 50%;
  z-index: 10;
  width: max-content;
  max-width: 320px;
  margin: 0;
  padding: var(--space-sm);
  list-style: none;
  background: var(--color-white);
  border: 1px solid var(--color-neutral-250);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(24, 25, 27, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translate(calc(-50% + var(--nav-dropdown-shift)), -6px);
  transition:
    opacity 140ms ease-in,
    transform 140ms ease-in,
    visibility 0s linear 140ms;
}

.nav-dropdown__menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(calc(-50% + var(--nav-dropdown-shift)), 0);
  transition:
    opacity 200ms ease-out,
    transform 200ms ease-out,
    visibility 0s linear 0s;
}

/* Hover bridge: invisible strip filling the gap above the card, so the
   cursor never "leaves" the dropdown while moving down from the toggle. */
.nav-dropdown__menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: calc(var(--space-md) + 1px);
}

@media (prefers-reduced-motion: reduce) {
  .nav-dropdown__menu,
  .nav-dropdown__menu.is-open,
  .nav-dropdown__chevron {
    transition: none;
  }

  .nav-dropdown__menu,
  .nav-dropdown__menu.is-open {
    transform: translate(calc(-50% + var(--nav-dropdown-shift)), 0);
  }
}

/* Menu items are full rows with a tinted hover, not the underline. */
.nav-dropdown__menu a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  transition: color var(--transition-hover), background-color var(--transition-hover);
}

/* One-line description under each link title, smaller and muted. */
.nav-dropdown__desc {
  font-size: var(--font-body-small-size);
  line-height: var(--font-body-small-line-height);
  letter-spacing: 0;
  color: var(--color-neutral-400);
}

.nav-dropdown__menu a::after {
  display: none;
}

.nav-dropdown__menu a:hover,
.nav-dropdown__menu a:focus-visible {
  background: var(--color-primary-50);
}

.nav-dropdown__menu a:focus-visible {
  outline-offset: -2px;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--color-primary-600);
  color: var(--color-white);
  font-family: var(--font-body-small-family);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-body-small-size);
  text-decoration: none;
  transition: background-color var(--transition-hover), color var(--transition-hover), box-shadow var(--transition-hover);
}

/* Figma CTA :hover — inverted fill with a 1px inside stroke. Drawn as an
   inset shadow (= Figma's INSIDE stroke) so the button doesn't resize; the
   Figma hover variant's 12/12 padding is not carried over. */
.nav-cta:hover,
.nav-cta:focus-visible {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
  box-shadow: inset 0 0 0 1px var(--color-primary-600);
}

/* Hamburger toggle — hidden on desktop; the header nav renders inline. */
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-neutral-900);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Morph the three bars into an X when the panel is open. */
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   SITE FOOTER — shared across every page (partials/footer.html)
   ========================================================================== */

.site-footer {
  padding: 64px 80px 40px;
  border-top: 1px solid var(--color-neutral-250);
  /* Figma Footer fill, converted from its gradient transform: the gradient
     line starts above the footer and ends below it, so the stops fall
     outside 0–100%. (Figma's ~0.5° tilt is dropped.) */
  background: linear-gradient(180deg, var(--color-white) -14%, var(--color-primary-25) 72%, var(--color-secondary-50) 142%);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
}

.site-footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-footer__nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.site-footer__nav a {
  font-family: var(--font-body-regular-family);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-0);
  letter-spacing: var(--font-nav-letter-spacing);
  line-height: var(--font-body-regular-line-height);
  color: var(--color-neutral-500);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-hover);
}

.site-footer__legal {
  font-family: var(--font-body-regular-family);
  font-weight: var(--font-weight-medium);
  font-size: 12px;
  line-height: 1.8;
  color: var(--color-neutral-500);
  margin: 0;
}

.site-footer__legal a {
  color: var(--color-primary-600);
  text-decoration: none;
}

/* ==========================================================================
   RESPONSIVE — header/nav collapse and footer reflow, tablet + mobile.
   Shared across every page since header.html/footer.html are the same
   partial everywhere. Desktop-first cascade: the 768px block covers both
   tablet and mobile, the 480px block refines mobile-only specifics.
   ========================================================================== */
@media (max-width: 768px) {
  .site-header {
    padding: 16px var(--space-md);
  }

  .site-logo__mark {
    height: 18px;
  }

  .nav-toggle {
    display: flex;
  }

  /* The panel becomes a full-width dropdown anchored under the header,
     hidden until .nav-toggle sets aria-expanded="true" and toggles
     .is-open (see main.js). Built from a real click handler rather than
     the checkbox-hack so the toggle can carry proper aria-expanded state. */
  .site-nav-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: calc(100vh - 100%);
    overflow-y: auto;
    padding: var(--space-sm) var(--space-md) var(--space-md);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-neutral-250);
    box-shadow: 0 12px 24px rgba(24, 25, 27, 0.1);
  }

  .site-nav-panel.is-open {
    display: flex;
  }

  .site-nav {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
  }

  /* Generous vertical padding on stacked nav links keeps the tap target
     comfortably above the ~44px touch-target guideline. */
  .site-nav a {
    padding: 14px var(--space-sm);
    border-bottom: 1px solid var(--color-neutral-100);
    font-size: var(--font-body-bold-size);
  }

  /* Stacked links already carry a divider line, so the hover underline would
     double up — keep only the color change in the mobile panel. */
  .site-nav a::after {
    display: none;
  }

  /* Stacked links are full-width with padding — inset the ring so it isn't
     clipped by the panel's overflow. */
  .site-nav a:focus-visible,
  .nav-dropdown__toggle:focus-visible {
    outline-offset: -2px;
  }

  /* Dropdown becomes an accordion row in the stacked panel: the toggle looks
     like the other stacked links (chevron at the right), and the menu opens
     inline as an indented sub-list instead of a floating card. */
  .nav-dropdown__toggle {
    justify-content: space-between;
    width: 100%;
    padding: 14px var(--space-sm);
    border-bottom: 1px solid var(--color-neutral-100);
    font-size: var(--font-body-bold-size);
    text-align: left;
  }

  .nav-dropdown__toggle::after {
    display: none;
  }

  .nav-dropdown__menu {
    display: none;
    position: static;
    width: auto;
    max-width: none;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .nav-dropdown__menu.is-open {
    display: block;
    transform: none;
    transition: none;
  }

  .nav-dropdown__menu::before {
    display: none;
  }

  .nav-dropdown__menu a {
    padding: 14px var(--space-sm) 14px var(--space-lg);
    border-radius: 0;
  }

  .nav-cta {
    width: 100%;
    margin-top: var(--space-md);
    padding: 14px 20px;
  }

  .site-footer {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
  }

  .site-footer__row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .site-footer__nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  /* 18px line + 13px top/bottom = 44px tap target (the padding also does
     the spacing between stacked links, so the nav gap is 0). */
  .site-footer__nav a {
    padding: 13px 0;
  }

  /* Keep the hover bar 3px below the text despite the 13px tap padding. */
  .site-footer__nav a::after {
    bottom: 8px;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 14px var(--space-md);
  }

  .site-footer {
    padding: var(--space-lg) var(--space-md) var(--space-md);
  }
}
