/* Typography tuning to minimize CLS from font swaps */

/* Global default: Inter with system fallbacks */
html, body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji','Segoe UI Emoji';
  /* Use font-size-adjust to match fallback metrics to web fonts */
  font-size-adjust: 0.52;
  /* Ensure smooth font swap without layout shift */
  font-synthesis: none;
}

/* Display headings using Playfair Display; provide metric hint */
.font-display, h1, h2 {
  font-family: 'Playfair Display', 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial;
  /* Playfair Display approx aspect */
  font-size-adjust: 0.45;
}

/* Space Grotesk areas (where used via class) */
.font-grotesk {
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial;
  /* Space Grotesk approx aspect */
  font-size-adjust: 0.62;
}

/* Antialiasing applied immediately via inline CSS to prevent FOUC */
body.antialiased {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Global CLS guards: nav + mobile menu */
#mobile-menu:not([data-ready="1"]) { display: none; }

/* Reserve nav height early across pages that use fixed top nav */
#main-nav, nav.fixed.top-0 { min-height: 64px; }
@media (min-width: 640px) {
  #main-nav, nav.fixed.top-0 { min-height: 80px; }
}

/* Ensure mobile menu overlay doesn't push layout when toggled */
#mobile-menu {
  position: fixed;
  left: 0; right: 0;
  top: 64px;
  max-height: calc(100vh - 64px);
  overflow: auto;
}
@media (min-width: 640px) {
  #mobile-menu {
    top: 80px;
    max-height: calc(100vh - 80px);
  }
}

/* Stabilize nav link metrics early */
.nav-link { font-size: 1rem; line-height: 1.5rem; }

/* Marquee stabilization (safe globally) */
.marquee-section { min-height: 3.75rem; }
.marquee-section .marquee-content span { line-height: 1.75rem; }

/* Explicit heading sizes to avoid UA defaults (deprecation fix) */
h1 {
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  line-height: 1.15;
  font-weight: 800;
  margin: 0.5em 0 0.35em;
}

h2 {
  font-size: clamp(1.75rem, 4.5vw, 2.25rem);
  line-height: 1.2;
  font-weight: 700;
  margin: 0.75em 0 0.4em;
}

h3 {
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  line-height: 1.25;
  font-weight: 700;
  margin: 0.85em 0 0.45em;
}

h4 {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  line-height: 1.3;
  font-weight: 600;
  margin: 1em 0 0.5em;
}

h5 {
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 600;
  margin: 1em 0 0.5em;
}

h6 {
  font-size: 0.875rem;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 1em 0 0.5em;
}
