:root {
  --header-height: 64px;
}

/* =========================
   GLOBAL SAFETY (FIX OVERFLOW)
========================= */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* =========================
   🔑 PAGE HEIGHT FIX (CRITICAL)
========================= */

html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

/* =========================
   HEADER (DESKTOP)
========================= */

.site-header,
#site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.logo {
  border: 2px solid black;
  border-radius: 2px;
  padding: 0.01rem 0.35rem;
}

.header-inner {
  max-width: 95%;
  margin: 0 auto;
  min-height: var(--header-height);
  padding: 0 1.25rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* =========================
   HERO
========================= */

.hero {
  background: radial-gradient(
    120% 120% at 100% 0%,
    #eef2ff 0%,
    #f9fafb 60%
  );
}

.hero-inner {
  max-width: 90%;
  margin: 0 auto;
  padding: 2rem 1.25rem 1.5rem;

  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

/* =========================
   MAIN CONTENT
========================= */

.page-content {
  width: 100%;
  max-width: 90%; /* 🔑 critical */
  margin: 0 auto;
  padding: 1.4rem 1.25rem 4rem;
  flex: 1;
}

/* =========================
   SECTIONS
========================= */

.section {
  margin-top: 2.6rem;
}

.section-header {
  margin-bottom: 0.9rem;
}

/* =========================
   FOOTER
========================= */

.site-footer {
  background: white;
  border-top: 1px dashed #6d6b68;

  /* 🔑 ENSURES FOOTER STAYS AT BOTTOM */
  margin-top: auto;
}

.footer-inner {
  max-width: 90%;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
}

.footer-nav a {
  white-space: nowrap;
}

/* =========================
   TABLET
========================= */

@media (max-width: 900px) {
  .hero-inner {
    padding: 1.8rem 1.25rem 1.2rem;
  }

  .page-content {
    padding: 1.2rem 1.25rem 3rem;
  }
}

/* =========================
   MOBILE (FINAL FIX)
========================= */
@media (max-width: 640px) {

  /* =========================
     GLOBAL MOBILE SAFETY
  ========================= */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* =========================
     HEADER (NON-STICKY)
  ========================= */
  .site-header,
  #site-header {
    position: static;
  }

  .header-inner {
    max-width: 100%;
    padding: 0.75rem 1rem;

    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    justify-items: center;
    text-align: center;
  }

  .logo {
    justify-self: center;
  }

  /* Hide nav completely on mobile */
  .main-nav {
    display: none !important;
  }

  /* Header search (inner pages) */
  #header-search {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  
  #header-search .search-bar {
    width: 100%;
    max-width: 420px;
  }

  /* =========================
     HERO FIX
  ========================= */

  .hero-inner {
    max-width: 100%;
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .hero-inner > * {
    max-width: 100%;
  }

  /* =========================
     CONTENT & FOOTER
  ========================= */
  .page-content,
  .footer-inner {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}


/* Search dropdown */
.search-results {
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain; /* mouse wheel stays local */
}

/* Result item */
.search-result-item {
  display: block;
  border: 0.5px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  text-decoration: none;
  outline: none;
}

/* Active (keyboard or mouse) */
.search-result-item.active {
  border: 0.5px solid #124bdc;
  background: transparent;
}

/* Optional hover matches keyboard */
.search-result-item:hover {
  border: 0.5px solid #124bdc;
}
