/* ============================================================
   AZRC UX Enhancement Stylesheet
   0. Missing Tailwind utilities (sr-only, focus variants, large text)
   1. Shrinking sticky nav
   2. Button hover & tap improvements
   3. Back-to-top button
   4. Typography for healthcare readability
   ============================================================ */

/* ── Arbitrary large font sizes not captured during CSS extraction ── */
.text-\[20rem\] { font-size: 20rem; }


/* ── 0. MISSING TAILWIND UTILITIES ──
   These weren't captured during CSS extraction because they only
   activate on keyboard focus — so they must be declared manually. */

/* Visually hides an element while keeping it accessible to screen readers */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

/* Reverses sr-only when the element receives keyboard focus */
.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Skip-link focus state: repositioned visibly in the top-left corner */
.focus\:absolute:focus      { position: absolute; }
.focus\:top-4:focus         { top: 1rem; }
.focus\:left-4:focus        { left: 1rem; }
.focus\:z-\[9999\]:focus    { z-index: 9999; }
.focus\:bg-\[\#FBBB4C\]:focus { background-color: #FBBB4C; }
.focus\:text-\[\#06213A\]:focus { color: #06213A; }
.focus\:px-4:focus          { padding-left: 1rem; padding-right: 1rem; }
.focus\:py-2:focus          { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.focus\:rounded-md:focus    { border-radius: 0.375rem; }
.focus\:font-bold:focus     { font-weight: 700; }
.focus\:text-sm:focus       { font-size: 0.875rem; line-height: 1.25rem; }


/* ── 1. SHRINKING STICKY NAV ── */

/* Box-shadow is painted on the main thread; animate it via a composited
   pseudo-element (opacity is GPU-composited) instead of box-shadow itself. */
nav {
  /* position: sticky (set via Tailwind .sticky class) also creates a containing block
     for ::after — declaring position:relative here would override sticky on the nav */
}
nav::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.3s ease; /* composited ✓ */
}

/* Applied via JS on scroll > 60px */
nav.scrolled {
  background-color: rgba(6, 33, 58, 0.97) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
nav.scrolled::after {
  opacity: 1; /* shadow fades in — no paint cost */
}

/* Inner nav container: padding is a layout property; removing transition
   makes the change instant (no animation = no Lighthouse flag). */
#nav-inner {
  /* no transition here — instant change on scroll */
}
nav.scrolled #nav-inner {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

/* Logo: height triggers layout — use transform: scale() instead (composited).
   transform-origin: left center keeps the logo anchored to the left edge. */
#nav-logo {
  height: 78px;
  transform-origin: left center;
  transition: transform 0.3s ease; /* composited ✓ */
}
nav.scrolled #nav-logo {
  transform: scale(0.667) !important; /* 52/78 ≈ 0.667 — visually matches original height shrink */
}


/* ── 2. BUTTON IMPROVEMENTS ── */

/* Minimum 44px tap target (WCAG / Apple HIG) */
a, button {
  min-height: 0; /* reset — only apply to CTAs below */
}

/* Gold primary CTA buttons */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  position: relative; /* for ::after shadow pseudo-element */
  transition: transform 0.18s ease !important; /* transform only — composited ✓ */
  will-change: transform;
}
/* Glow shadow via pseudo-element opacity (composited) instead of box-shadow transition */
.btn-gold::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 8px 24px rgba(249, 188, 75, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease; /* composited ✓ */
}
.btn-gold:hover {
  transform: translateY(-2px);
  background-color: #e8a930 !important; /* instant color change — no animation to flag */
}
.btn-gold:hover::after {
  opacity: 1; /* glow fades in — GPU-composited */
}
.btn-gold:active {
  transform: translateY(0) scale(0.98);
}

/* Ghost / outline buttons */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: transform 0.18s ease !important; /* transform only — composited ✓ */
  will-change: transform;
}
.btn-ghost:hover {
  transform: translateY(-2px);
  background-color: rgba(255, 255, 255, 0.12) !important; /* instant — no animation to flag */
}
.btn-ghost:active {
  transform: translateY(0) scale(0.98);
}

/* Nav "Request Consultation" button — always minimum tap height */
nav a[href="contact.html"] {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  transition: transform 0.15s ease !important; /* transform only — composited ✓ */
}
nav a[href="contact.html"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(249, 188, 75, 0.4); /* instant — no animation to flag */
}


/* ── 3. BACK TO TOP BUTTON ── */

#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  background-color: #06213A;
  color: #FBBB4C;
  border: 2px solid #FBBB4C;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease; /* opacity + transform only — both composited ✓ */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#back-to-top:hover {
  background-color: #FBBB4C; /* instant — no transition declared for this property */
  color: #06213A; /* instant — no transition declared for this property */
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 188, 75, 0.5);
}

#back-to-top:active {
  transform: scale(0.95);
}

/* Arrow icon inside the button */
#back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ── 3b. FOCUS-VISIBLE GLOBAL RING ── */
/* Restores visible keyboard focus ring removed by Tailwind's focus:outline-none */
:focus-visible {
  outline: 2px solid #FBBB4C;
  outline-offset: 3px;
  border-radius: 4px;
}
/* Override for elements that use their own focus style */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none; /* these use border-bottom highlight instead */
}


/* ── 4. TYPOGRAPHY — HEALTHCARE READABILITY ── */

/* Base body: loose leading, anti-aliased, comfortable tracking */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.7;
}

/* Paragraph text: generous line height and slight tracking */
p {
  line-height: 1.8;
  letter-spacing: 0.012em;
}

/* Body text sizes */
.text-lg  { line-height: 1.8 !important; }
.text-xl  { line-height: 1.75 !important; }
.text-2xl { line-height: 1.65 !important; }

/* Headlines: tight leading, subtle negative tracking for impact */
h1, h2, h3, h4, h5, h6,
.font-headline {
  line-height: 1.12;
  letter-spacing: -0.025em;
}

/* Section sub-labels / eyebrow text */
.font-label {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* Clinical / small body text */
.text-sm {
  line-height: 1.65;
  letter-spacing: 0.01em;
}

/* Nav links */
nav a {
  letter-spacing: 0.01em;
}

/* Soften bold link underlines on desktop */
@media (min-width: 768px) {
  a.border-b {
    text-underline-offset: 3px;
  }
}


/* ── 5. FONT CLS PREVENTION ──
   font-display: optional (set via ?display=optional in the Google Fonts URL)
   means the browser never swaps fonts mid-render → zero font CLS.
   These @font-face fallbacks use size-adjust + metric overrides so that
   the system-font placeholder occupies the same line-box as the web font,
   meaning even the first-visit fallback render is shift-free. */

/* Inter fallback — matches Inter's cap-height / descent on Arial */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("sans-serif");
  size-adjust: 107%;        /* Inter glyphs are ~7% wider than Arial glyphs */
  ascent-override: 90%;     /* shrink ascent to match Inter's ascender height */
  descent-override: 22%;    /* adjust descender to match Inter */
  line-gap-override: 0%;    /* Inter has no line gap */
}

/* Manrope fallback — matches Manrope's cap-height / descent on Arial */
@font-face {
  font-family: "Manrope Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("sans-serif");
  size-adjust: 103%;        /* Manrope glyphs are ~3% wider than Arial */
  ascent-override: 95%;
  descent-override: 25%;
  line-gap-override: 0%;
}

/* Override Tailwind's font-family utilities to include our metric-matched fallbacks.
   This ensures that when the web font is unavailable (first visit, font-display:optional),
   the fallback takes up the SAME space, preventing layout shift on font load. */
.font-body,
body {
  font-family: "Inter", "Inter Fallback", system-ui, -apple-system, Arial, sans-serif;
}
.font-headline,
h1, h2, h3, h4, h5, h6 {
  font-family: "Manrope", "Manrope Fallback", "Inter", "Inter Fallback", Arial, sans-serif;
}
.font-label {
  font-family: "Inter", "Inter Fallback", Arial, sans-serif;
}


/* ── 6. NON-COMPOSITED ANIMATION OVERRIDES ──
   Lighthouse flags elements whose transition-property includes layout-triggering
   or paint-triggering CSS properties, even if those properties never change.
   These overrides replace Tailwind's transition-all (property: all) with
   composited-only transitions (transform, opacity) on the specific elements. */

/* Hamburger bars: JS only animates transform and opacity — both composited.
   Override transition-all so only composited properties are declared. */
#ham-1,
#ham-2,
#ham-3 {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity   0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Service cards: hover bg/color changes are instant (no transition);
   the card itself gets no animated paint. */
.bg-surface-container-low.rounded-xl {
  transition: none !important;
}

/* Editorial "28%" stat card: hover:bg-white transition-all → instant */
.bg-surface-container-lowest.rounded-xl {
  transition: none !important;
}


/* ── 7. LOGO INTRINSIC SIZE LOCK ──
   Forces the <picture> wrapper to reserve the exact pixel footprint of the logo
   before the image bytes arrive, eliminating any logo-caused layout shift. */
#nav-logo,
#footer-logo {
  width: 132px;
  height: 78px;
  object-fit: contain;
}
/* The picture element itself must not collapse before image loads */
a:has(#nav-logo) picture,
div:has(#footer-logo) picture {
  display: block;
  width: 132px;
  height: 78px;
}


/* ── 8. LOGO RENDERING QUALITY ──
   The PNG logo can appear slightly blurry when the browser downsamples it.
   -webkit-optimize-contrast tells WebKit/Blink to use nearest-neighbour for
   pixel-art-style images with hard edges (like logos) instead of bilinear. */
#nav-logo,
#footer-logo {
  image-rendering: -webkit-optimize-contrast; /* Safari / Chrome */
  image-rendering: crisp-edges;               /* Firefox / standard */
}


/* ── 9. MISSING TAILWIND UTILITIES ──
   Classes used in HTML that were not captured during the tailwind.min.css
   extraction pass because they were added after the snapshot was taken. */

/* bg-surface-container — the mid-tier surface tint, between container-low
   (rgb 238 244 255) and container-high (rgb 219 233 255).
   Used on the contact page newsletter section and harvest.html. */
.bg-surface-container {
  --tw-bg-opacity: 1;
  background-color: rgb(228 240 255 / var(--tw-bg-opacity, 1));
}
.hover\:bg-surface-container:hover {
  --tw-bg-opacity: 1;
  background-color: rgb(228 240 255 / var(--tw-bg-opacity, 1));
}

/* hover:shadow-md — elevation lift on card hover.
   Missing from tailwind.min.css; ux.css already sets transition:none on
   .bg-surface-container-lowest.rounded-xl so the shadow appears instantly
   (no transition flag for Lighthouse), which is still visually correct. */
.hover\:shadow-md:hover {
  --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

/* hover:shadow-lg — used on CTA buttons */
.hover\:shadow-lg:hover {
  --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

/* hover:bg-primary\/90 — used on contact page Subscribe button */
.hover\:bg-primary\/90:hover {
  background-color: rgb(6 33 58 / 0.9);
}

/* primary-container color token — used on providers Why section quote panel.
   Color sourced from index.html inline critical CSS: rgb(31 55 81). */
.bg-primary-container {
  --tw-bg-opacity: 1;
  background-color: rgb(31 55 81 / var(--tw-bg-opacity, 1));
}
.hover\:bg-primary-container:hover {
  --tw-bg-opacity: 1;
  background-color: rgb(31 55 81 / var(--tw-bg-opacity, 1));
}


/* border-primary — outline button border color token (success page CTA).
   Missing from tailwind.min.css extraction. */
.border-primary {
  --tw-border-opacity: 1;
  border-color: rgb(6 33 58 / var(--tw-border-opacity, 1));
}

/* hover:bg-primary\/10 — ghost hover for outline button */
.hover\:bg-primary\/10:hover {
  background-color: rgb(6 33 58 / 0.1);
}

/* sm:flex-row — side-by-side layout for CTA button pairs at ≥640px.
   Missing from static tailwind.min.css snapshot. */
@media (min-width: 640px) {
  .sm\:flex-row {
    flex-direction: row;
  }
}


/* ── 10. TAP TARGETS ──
   Google Lighthouse mobile requires tap targets ≥ 48px.
   Footer and mobile menu links get explicit padding so they
   meet the 48 × 48 px minimum touch area on all pages. */
footer a {
  padding: 12px !important;
}
#mobile-menu a {
  padding: 12px !important;
}
