/* =====================================================================
   Reserve scrollbar gutter on every marketing page so the viewport width
   stays constant whether the page is tall (scrollbar present) or short
   (scrollbar absent). Without this, navigating from a tall page to a
   short page widened the viewport by ~15px and the header's
   `(100% - 980px) / 2` padding shifted the logo/buttons sideways — the
   "jitter" the user spotted. scrollbar-gutter: stable is supported in
   every modern browser (Chrome 94+, Firefox 97+, Safari 16+). */
html {
  scrollbar-gutter: stable;
}

/* =====================================================================
   Shared sticky header — single source of truth for every marketing page
   (landing, calculator, about, blog).

   Scoped on .csh-* tokens (NOT the host page's --accent / --line / --ink)
   so the header renders identically no matter which page-level palette
   sits in :root. The host page can use any tokens it wants — the header
   stays pixel-identical, eliminating the cross-page position/color jumps.

   Assumed root font-size: 17.6px (set on every marketing page so 1rem
   resolves to the same px width across the site).

   Mobile breakpoint is 760px (matches the rest of landing.html).
   ===================================================================== */
.header,
.header * {
  --csh-line: #e2e8f0;
  --csh-ink: #1e293b;
  --csh-ink-secondary: #475569;
  --csh-paper: #ffffff;
  --csh-accent: #1e40af;
  --csh-accent-light: #3b82f6;
  --csh-accent-bg: #eff6ff;
  --csh-accent-border: #bfdbfe;
}

.header {
  /* Glass: translucent fill + blur live on ::before so backdrop-filter
     never lands on the element itself (it would create a containing
     block and trap the fixed mobile nav). */
  background: transparent;
  border-bottom: 1px solid var(--csh-line);
  /* Logo + nav align to the 980px content column shared across pages.
     The glass bar (::before) still spans the full viewport width. */
  padding: 0.8rem max(1.5rem, calc((100% - 980px) / 2));
  display: flex;
  direction: ltr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
/* Header background — fully opaque white. Earlier the glass was
   translucent + backdrop-filter, but the backdrop-blur was sampling
   different page bgs (landing/calculator have a blue hero gradient
   under the header; about/blog have flat light-gray) and producing a
   subtle tint difference between page groups that read as visible
   "jitter" on navigation. Going solid white kills that vector entirely
   and also drops the per-frame GPU cost of the blur. */
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #ffffff;
  z-index: -1;
  pointer-events: none;
}

/* CareSlip wordmark — matches the in-app logo (azure "Care" + grey
   "Slip", dark stroke, soft drop shadow). */
.header .brand {
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-size: 1.95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1;
  color: oklch(0.62 0.14 240);
  -webkit-text-stroke: 1px oklch(0.24 0.018 250);
  paint-order: stroke fill;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
  text-decoration: none;
}
.header .brand .brand-slip {
  color: rgb(165, 165, 165);
  -webkit-text-stroke: 1px oklch(0.24 0.018 250);
  paint-order: stroke fill;
}

.header-nav { display: flex; gap: 0.6rem; margin-left: auto; }
/* Nav links as rounded-square chips. Explicit line-height so the chip
   height doesn't drift between pages with different body line-height
   (landing 1.4, calculator 1.6, blog 1.6 — without this, buttons would
   render ~3px taller on the higher line-height pages and the eye
   catches the jump on navigation). */
.header-nav a {
  color: var(--csh-ink-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.45rem 1.05rem;
  border: 2.5px solid var(--csh-line);
  border-radius: 8px;
  background: var(--csh-paper);
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.1s;
}
.header-nav a:hover {
  color: var(--csh-accent);
  background: var(--csh-accent-bg);
  border-color: var(--csh-accent-border);
}
.header-nav a:active { transform: translateY(1px); }

/* Active link — current page. Stays lit until the visitor navigates to
   another button; state lives in the URL, not in JS memory. */
.header-nav a.is-active,
.header-nav a[aria-current="page"] {
  color: #fff;
  background: var(--csh-accent);
  border-color: var(--csh-accent);
}
.header-nav a.is-active:hover,
.header-nav a[aria-current="page"]:hover {
  color: #fff;
  background: var(--csh-accent-light);
  border-color: var(--csh-accent-light);
}

/* Hamburger — hidden on desktop. */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
  z-index: 110;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--csh-ink);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  position: relative;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
}
.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  /* Dropdown panel anchored under the hamburger button instead of a
     full-screen overlay. */
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0.8rem;
    left: auto;
    bottom: auto;
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.6rem;
    border: 1px solid var(--csh-line);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    margin-top: 0.4rem;
    min-width: 11rem;
    z-index: 105;
  }
  .header-nav.open { display: flex; }
  .header-nav a {
    font-size: 0.95rem;
    text-align: right;
    padding: 0.55rem 0.85rem;
    border-radius: 6px;
    background: transparent;
    border: none;
  }
  .header-nav a:hover { background: var(--csh-accent-bg); border-color: transparent; }
}
