/* Excellence Realty - base layer. Small and deliberate; grows as sections are built.
   Depends on tokens.css. On a live Astra site we scope-and-override (higher specificity,
   :where() resets) rather than stripping the parent's CSS. */

:where(html) { -webkit-text-size-adjust: 100%; }

/* Foundation colours. `html body` (0,0,2) beats every Astra `body` rule (0,0,1) regardless of load order. */
html,
html body {
  background-color: var(--er-bg);
}
/* Astra sets the site background through a body layout class (0,1,x), which outranks `html body`.
   Match that specificity (no !important) so the token wins in both themes and every container mode. */
html body.ast-separate-container,
html body.ast-plain-container,
html body.ast-narrow-container,
html body.ast-page-builder-template {
  background-color: var(--er-bg);
}
html body {
  font-family: var(--er-font-sans);
  font-weight: 400;
  line-height: var(--er-leading-normal);
  color: var(--er-fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display voice: Cormorant Garamond for headings and anything opting in with .er-display */
body h1, body h2, body h3, body h4, .er-display,
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 {
  font-family: var(--er-font-display);
  font-weight: 500;
  letter-spacing: var(--er-tracking-display);
  line-height: var(--er-leading-display);
  color: var(--er-fg);
}

/* Links inherit the teal brand colour by default */
html body a { color: var(--er-primary); }

/* Shared content container - one width, one left edge, hero included */
.er-container {
  width: 100%;
  max-width: var(--er-container);
  margin-inline: auto;
  padding-inline: var(--er-gutter);
}

/* Section vertical rhythm: 96px -> 128px at large */
.er-section { padding-block: var(--er-section-y); }
@media (min-width: 1024px) {
  .er-section { padding-block: var(--er-section-y-lg); }
}

/* Ground variants used by the alternating section pattern */
.er-section--cream { background-color: var(--er-cream); }
.er-section--teal {
  background-color: var(--er-primary);
  color: var(--er-primary-fg);
}
.er-section--teal :where(h1,h2,h3,h4) { color: var(--er-primary-fg); }

/* Eyebrow label */
.er-eyebrow {
  font-family: var(--er-font-sans);
  text-transform: uppercase;
  letter-spacing: var(--er-tracking-eyebrow);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--er-muted-fg);
}

/* Button base - shape only; colour variants added with components later */
.er-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--er-font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.875rem 1.9rem;
  border-radius: var(--er-radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.er-btn:active { transform: translateY(1px); }
.er-btn--primary { background-color: var(--er-primary); color: var(--er-primary-fg); }
.er-btn--secondary { background-color: transparent; color: var(--er-fg); border-color: var(--er-border); }
.er-btn--gold { background-color: var(--er-gold); color: var(--er-gold-fg); }

/* Visible focus ring for keyboard users */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--er-ring);
  outline-offset: 2px;
  border-radius: var(--er-radius-sm);
}

/* ---- Header ---- */
#masthead {
  position: sticky;
  top: 0;
  z-index: 999;
  background-color: var(--er-card);
  background-color: color-mix(in oklab, var(--er-card) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--er-border);
}
#masthead .main-header-bar,
#masthead .ast-above-header-wrap,
#masthead .ast-below-header-wrap { background: transparent; }

#masthead .main-header-menu .menu-link,
#masthead .ast-hfb-menu-1 .menu-link,
#masthead .main-header-menu .menu-link:hover {
  font-family: var(--er-font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--er-fg);
}
#masthead .main-header-menu .menu-item:hover > .menu-link,
#masthead .main-header-menu .current-menu-item > .menu-link { color: var(--er-primary); }

/* Logo only, no site-title text (logo already carries the brand) */
#masthead .ast-site-title-wrap,
#masthead .site-title { display: none; }
#masthead .custom-logo-link img,
#masthead .site-logo-img .custom-logo {
  max-height: 54px;
  width: auto;
  border-radius: 6px;
  background: #fff;
}

.er-headmeta { display: inline-flex; align-items: center; gap: 0.85rem; white-space: nowrap; }
.er-headmeta__phone {
  font-family: var(--er-font-sans);
  font-size: 0.9rem;
  color: var(--er-fg);
  text-decoration: none;
  white-space: nowrap;
}
.er-headmeta__phone:hover { color: var(--er-primary); }

.er-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-family: var(--er-font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.45rem 0.85rem;
  border-radius: var(--er-radius-full);
  border: 1px solid var(--er-border);
  background: transparent;
  color: var(--er-fg);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}
.er-theme-toggle:hover { border-color: var(--er-primary); color: var(--er-primary); }

.er-langswitch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--er-border);
  border-radius: var(--er-radius-full);
  padding: 2px;
}
.er-langswitch__link {
  font-family: var(--er-font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--er-muted-fg);
  text-decoration: none;
  padding: 0.32rem 0.55rem;
  border-radius: var(--er-radius-full);
}
.er-langswitch__link.is-current { background: var(--er-primary); color: var(--er-primary-fg); }
.er-langswitch__link:not(.is-current):hover { color: var(--er-fg); }
.er-theme-toggle__icon { display: inline-flex; }
.er-theme-toggle__icon::before { content: "\263E"; font-size: 0.95em; line-height: 1; }
.er-theme-toggle[aria-pressed="true"] .er-theme-toggle__icon::before { content: "\2600"; }

/* Astra header button: style the real button, hide the stacked-menu fallback anchor */
#masthead .ast-builder-button-wrap > .menu-link { display: none; }
#masthead .ast-header-button-1 .ast-custom-button-link { display: inline-flex; text-decoration: none; }
#masthead .ast-header-button-1 .ast-custom-button {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--er-font-sans);
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: var(--er-radius-full);
  background-color: var(--er-primary);
  color: var(--er-primary-fg);
  border: 0;
  padding: 0.8rem 1.6rem;
  transition: background-color 160ms ease, color 160ms ease;
}
#masthead .ast-header-button-1 .ast-custom-button-link:hover .ast-custom-button {
  background-color: var(--er-fg);
  color: var(--er-bg);
}

@media (max-width: 921px) {
  .er-headmeta__phone { display: none; }
  #masthead .custom-logo-link img { max-height: 46px; }
}

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


/* ---- Mobile header: keep it on one line at 375px ---- */
@media (max-width: 600px) {
  #masthead .ast-container,
  #masthead .site-primary-header-wrap { padding-left: 12px; padding-right: 12px; }
  #masthead .ast-builder-grid-row,
  #masthead .site-header-section { gap: 0.45rem; column-gap: 0.45rem; }
  #masthead .custom-logo-link img { max-height: 38px; }
  .er-headmeta { gap: 0.5rem; }
  .er-theme-toggle { padding: 0.4rem 0.55rem; gap: 0.3rem; }
  .er-theme-toggle__text {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .er-langswitch { padding: 1px; }
  .er-langswitch__link { padding: 0.3rem 0.45rem; font-size: 0.66rem; }
}

/* Guard against sub-pixel overflow without breaking position:sticky on the header */
body { overflow-x: clip; }
