/* ============================================================
   BASE — Reset, typography, global elements
   ============================================================ */

/* --- Modern reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Images --- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* --- Form elements inherit font --- */
input,
button,
textarea,
select {
  font: inherit;
}

/* --- Remove default list styles where used for UI --- */
ul[class],
ol[class] {
  list-style: none;
}

/* --- Anchor defaults --- */
a {
  color: inherit;
  text-decoration: none;
}

/* Visible focus for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Headings --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: inherit;
}

h1 { font-size: var(--fs-4xl); font-weight: 700; }
h2 { font-size: var(--fs-3xl); font-weight: 700; }
h3 { font-size: var(--fs-2xl); font-weight: 600; }
h4 { font-size: var(--fs-xl);  font-weight: 600; }
h5 { font-size: var(--fs-lg);  font-weight: 600; }
h6 { font-size: var(--fs-base); font-weight: 600; }

p {
  line-height: var(--lh-normal);
}

strong {
  font-weight: 600;
}

/* --- Container utility --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* --- Section base rhythm --- */
.section {
  padding-block: var(--section-py);
}

.section--dark {
  background-color: var(--color-bg-dark);
  color: var(--color-text-light);
}

.section--soft {
  background-color: var(--color-bg-soft);
}

/* --- Section heading pattern --- */
.section__eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--color-accent);
  display: block;
  margin-bottom: var(--space-3);
}

.section__title {
  font-size: var(--fs-3xl);
  margin-bottom: var(--space-4);
}

.section__subtitle {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  max-width: 52ch;
  line-height: var(--lh-normal);
}

.section__header {
  margin-bottom: var(--space-12);
}

.section__header--center {
  text-align: center;
}

.section__header--center .section__subtitle {
  margin-inline: auto;
}

/* --- Horizontal rule --- */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
}

/* --- backdrop-filter fallback for Android/older browsers ---
   When backdrop-filter is unsupported, replace semi-transparent
   backgrounds with fully opaque ones to avoid black/broken rendering. */
@supports not (backdrop-filter: blur(1px)) {
  /* Header base: solid dark glass (mobile pill + desktop transparent-start) */
  .site-header {
    background: #0A0C10 !important;
  }

  /* Desktop scrolled: frosted light → solid light */
  @media (min-width: 1024px) {
    .site-header.is-scrolled {
      background: rgba(250, 250, 249, 0.99) !important;
    }
  }

  /* Mobile scrolled: keep the dark pill, never go white */
  @media (max-width: 1023px) {
    .site-header.is-scrolled {
      background: rgba(15, 15, 15, 0.90) !important;
      box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.50),
        0 8px  20px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
    }
    /* Hamburger and logo stay light against the dark pill */
    .site-header .hamburger__line,
    .site-header.is-scrolled .hamburger__line {
      background-color: #ffffff !important;
    }
  }

  .nav__dropdown {
    background: #fafaf9 !important;
  }
  /* Mobile menu: already dark, just make it fully opaque */
  .mobile-menu {
    background: #0A0C10 !important;
  }
  /* Dark glass elements: make them fully opaque */
  .hero-form {
    background: rgba(10, 12, 16, 0.95) !important;
  }
}

/* ── Prevent iOS Safari auto-zoom on input focus ──────────────────────────────
   Safari zooms in whenever a focused input renders below 16px. This catch-all
   forces every interactive field to exactly 1rem (16px) on mobile.
   !important is intentional: it must beat all component-level font-size rules. */
@media (max-width: 767px) {
  input,
  textarea,
  select,
  .hero-form__input,
  .hf-picker-trigger,
  .bd-input {
    font-size: 1rem !important;
  }

  input::placeholder,
  textarea::placeholder,
  .hero-form__input::placeholder,
  .bd-input::placeholder {
    font-size: 1rem !important;
  }
}
