/* 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: 22px;
  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 {
  margin-left: 4px;
  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;
  gap: 24px;
}

.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. Left edge lined up with 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));
  /* The card's left edge lines up with "Who We Serve", so the links sit
     slightly indented under it (reads as a sub-menu). */
  left: 0;
  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(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(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(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);
}

/* "For Patients" + CTA, grouped at the right of the header. The patient link
   is deliberately quieter than the CTA: plain small text, no fill. It catches
   patients who land on the homepage after a call from Carrie. */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

/* Thin divider separating the patient link + CTA from the main nav. */
.nav-actions::before {
  content: "";
  width: 1px;
  height: 20px;
  background: var(--color-neutral-250);
}

.nav-patients {
  position: relative;
  font-family: var(--font-body-small-family);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-body-small-size);
  color: var(--color-neutral-500);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-hover);
}

.nav-patients::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-patients:hover,
.nav-patients:focus-visible {
  color: var(--color-primary-600);
}

.nav-patients:hover::after,
.nav-patients:focus-visible::after {
  opacity: 1;
}

.nav-patients:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* Nav labels never wrap onto two lines; the header tightens instead. */
.site-nav a,
.nav-dropdown__toggle,
.nav-cta {
  white-space: nowrap;
}

/* Dropdown descriptions still wrap inside their card. */
.nav-dropdown__menu a {
  white-space: normal;
}

/* 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);
  /* White → Primary/25 through the top three quarters, then Secondary/50
     blue in the bottom 25% only (2026-10-18). Earlier versions: the Figma
     fill (stops -14% / 72% / 142%, blue barely visible) and a 0 / 45 / 100%
     fill (blue blended in from halfway up). */
  background: linear-gradient(180deg, var(--color-white) 0%, var(--color-primary-25) 75%, var(--color-secondary-50) 100%);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 1280px;
  margin: 0 auto;
}

/* Brand on the left, three equal link columns on the right. */
.site-footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
}

.site-footer__top .site-logo {
  flex-shrink: 0;
}

.site-footer__cols {
  display: grid;
  grid-template-columns: repeat(3, 208px);
  gap: 72px;
  margin-left: auto;
}

.site-footer__col {
  display: flex;
  flex-direction: column;
}

/* Column heading: Primary/600 text over a 1px Primary/600 rule. */
.site-footer__head {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-primary-600);
  font-family: var(--font-body-small-family);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-0);
  color: var(--color-primary-600);
}

.site-footer__nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

/* Footer links: hover bar sits closer to the text than the header's. */
.site-footer__nav a::after {
  bottom: -2px;
}

.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;
}

/* "Evaluating Carrie?" column: supporting line + outlined soft-tint button. */
.site-footer__note {
  margin: 0 0 14px;
  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: 1.5;
  color: var(--color-neutral-500);
}

.site-footer__col--cta .nav-cta {
  align-self: flex-start;
  padding: 8px 16px;
  font-size: 13px;
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  box-shadow: inset 0 0 0 1px var(--color-primary-600);
}

.site-footer__col--cta .nav-cta:hover,
.site-footer__col--cta .nav-cta:focus-visible {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}

/* Bottom bar: legal line left, "A product of [DTx+ mark]" right, text
   sharing one baseline. */
.site-footer__bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-neutral-200);
}

.site-footer__product {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-footer__dtx {
  display: inline-block;
  height: 16px;
  width: auto;
  transform: translateY(1px);
}


/* Narrow laptops: tighten the header so every label stays on one line. */
@media (max-width: 1360px) {
  .site-header {
    padding-left: 56px;
    padding-right: 56px;
  }

  .site-nav {
    gap: 26px;
  }
}

@media (max-width: 1280px) {
  .site-header {
    padding-left: 40px;
    padding-right: 40px;
  }

  .site-nav {
    gap: 22px;
  }
}

/* Tablet: brand stacks above the three columns. */
@media (max-width: 1100px) {
  .site-footer__top {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .site-footer__cols {
    margin-left: 0;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px;
  }
}

/* ==========================================================================
   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.
   ========================================================================== */
/* Header collapses to the menu button at 1200px and below: the full nav, the
   "Did Carrie call you?" link and the CTA no longer fit comfortably on one line. */
@media (max-width: 1200px) {
  .site-header {
    padding: 16px var(--space-md);
  }

  .site-logo__mark {
    height: 19px;
  }

  .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-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-patients {
    padding: 14px var(--space-sm);
    border-bottom: 1px solid var(--color-neutral-100);
    font-family: var(--font-body-regular-family);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-body-bold-size);
  }

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

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

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

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

@media (max-width: 768px) {
  .site-footer {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
  }

  .site-footer__top {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .site-footer__cols {
    margin-left: 0;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg) var(--space-md);
  }

  .site-footer__nav {
    gap: 0;
  }

  .site-footer__head {
    margin-bottom: 0;
  }

  .site-footer__col--cta {
    grid-column: 1 / -1;
  }

  .site-footer__note {
    margin: 12px 0 14px;
  }

  .site-footer__col--cta .nav-cta {
    align-self: stretch;
    margin-top: 0;
    padding: 14px 20px; /* keep the full-size tap target on phones */
  }

  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* 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);
  }

  .site-footer__cols {
    grid-template-columns: 1fr;
  }
}
