/* ============================================================
   Logan Custom Homes — Shared Layout  v4
   Nav, Footer, Inner-page header — used on every page
   ============================================================ */

/* ---- Nav ---- */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: max(var(--space-6), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) var(--space-6) max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--duration-base) var(--ease-out),
              padding var(--duration-base) var(--ease-out);
}

.site-nav.scrolled {
  /* No backdrop-filter: it creates a containing block that traps the
     fixed mobile menu overlay. The near-opaque background is enough. */
  background: rgba(20, 20, 26, 0.97);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(184, 149, 106, 0.15);
}

/* ---- Logo: horizontal lockup (submark + rule + wordmark) ---- */

.nav-logo {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  height: 44px;            /* slim footprint: keeps the bar height steady */
  overflow: visible;       /* let the badge overhang below */
  text-decoration: none;
  z-index: 102;
}

/* Primary horizontal lockup used as the header logo — overhangs the bar */
.nav-logo__img {
  height: 98px;            /* larger than the 44px footprint, so it hangs below */
  width: auto;
  display: block;
  position: relative;
  top: -8px;               /* small rise above the bar, most of it hangs below */
  transition: height var(--duration-base) var(--ease-out),
              top var(--duration-base) var(--ease-out),
              opacity var(--duration-base) var(--ease-out);
}

/* Text-only lockup (no "Est. 2003", no divider) overlaid for the sticky state.
   Same viewBox as the full mark, so LOGAN holds its position through the swap. */
.nav-logo__img--text {
  position: absolute;
  left: 0;
  opacity: 0;
  pointer-events: none;
}

/* When the bar becomes solid on scroll, tuck the logo closer to bar height
   and cross-fade the full lockup out for the cleaner text-only one. */
.site-nav.scrolled .nav-logo__img {
  height: 56px;
  top: 0;
}
.site-nav.scrolled .nav-logo__img--full {
  opacity: 0;
}
.site-nav.scrolled .nav-logo__img--text {
  opacity: 1;
}

/* Submark ring SVG */
.nav-logo__mark {
  width: 36px;
  height: 36px;
  color: var(--bone);
  flex-shrink: 0;
  opacity: 0.9;
}

/* Vertical bronze divider */
.nav-logo__rule {
  display: block;
  width: 1px;
  height: 32px;
  background: var(--bronze);
  opacity: 0.35;
  flex-shrink: 0;
}

/* Text stack wrapper */
.nav-logo__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-logo__primary {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  color: var(--bone);
  line-height: 1;
}

.nav-logo__sub {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  color: var(--bone);
  opacity: 0.7;
  line-height: 1;
}

.nav-logo__accent {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--bronze);
  line-height: 1;
}

/* ---- Nav links ---- */

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--bone);
  opacity: 0.75;
  transition: opacity var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
  padding: var(--space-2) 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-links a:hover {
  opacity: 1;
  color: var(--bronze-light);
}

.nav-links a.active {
  opacity: 1;
  color: var(--bronze);
}

/* Inquire button — hidden on mobile by default */
.nav-inquire {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--bronze);
  border: 1px solid var(--bronze);
  padding: var(--space-2) var(--space-6);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.nav-inquire:hover,
.nav-inquire.active {
  background: var(--bronze);
  color: var(--charcoal);
}

/* ---- Mobile menu toggle ---- */

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  z-index: 101;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 1px;
  background: var(--bone);
  transition: transform var(--duration-base) var(--ease-out),
              opacity var(--duration-fast);
  transform-origin: center;
}

/* Lock background scroll while the mobile menu overlay is open */
body.nav-open {
  overflow: hidden;
}

/* Hamburger → X animation */
.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---- Footer ---- */

.site-footer {
  padding: var(--space-16) 0 var(--space-10);
  border-top: 1px solid rgba(237, 229, 211, 0.08);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid rgba(237, 229, 211, 0.08);
  margin-bottom: var(--space-8);
}

.footer-brand__logo {
  width: clamp(240px, 22vw, 320px);
  height: auto;
  display: block;
  margin-bottom: var(--space-5);
}

.footer-brand__wordmark {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  color: var(--bone);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.footer-brand__sub {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  color: var(--bone);
  opacity: 0.5;
  margin-bottom: var(--space-1);
}

.footer-brand__tagline {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--bronze);
  margin-top: var(--space-3);
  margin-bottom: var(--space-6);
}

.footer-brand__address {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--bone);
  opacity: 0.5;
}

.footer-col__heading {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: var(--space-6);
}

.footer-col__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col__links a {
  font-size: var(--text-base);
  color: var(--bone);
  opacity: 0.55;
  transition: opacity var(--duration-fast);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.footer-col__links a:hover {
  opacity: 1;
}

.footer-social {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.footer-social a {
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--bone);
  opacity: 0.45;
  transition: opacity var(--duration-fast);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.footer-social a:hover {
  opacity: 1;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-bottom__copy {
  font-size: var(--text-sm);
  color: var(--bone);
  opacity: 0.3;
  letter-spacing: 0.02em;
}

.footer-bottom__est {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  color: var(--bone);
  opacity: 0.5;
}

.footer-bottom__est a:hover {
  color: var(--bronze-light);
}

/* ---- Inner Page Header ---- */

.page-header {
  padding: clamp(130px, 20vw, 220px) 0 clamp(60px, 8vw, 100px);
  text-align: center;
  border-bottom: 1px solid rgba(184, 149, 106, 0.12);
  position: relative;
  overflow: hidden;
}

/* Optional treated regional photo behind a page header (set --ph-bg per page) */
.page-header--photo::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--ph-bg);
  background-size: cover;
  background-position: center;
}

.page-header--photo::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(20, 20, 26, 0.86) 0%,
    rgba(20, 20, 26, 0.72) 45%,
    rgba(20, 20, 26, 0.92) 100%
  );
}

.page-header--photo > * {
  position: relative;
  z-index: 2;
}

.page-header__eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: var(--space-6);
}

.page-header__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-5xl), 9vw, 8rem);
  font-weight: 400;
  letter-spacing: var(--tracking-wide);
  color: var(--bone);
  line-height: 1;
  margin-bottom: var(--space-6);
  overflow-wrap: break-word;
}

.page-header__rule {
  width: 1px;
  height: 50px;
  background: var(--bronze);
  opacity: 0.5;
  margin: var(--space-8) auto 0;
}

.page-header__sub {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: clamp(var(--text-lg), 2vw, var(--text-xl));
  color: var(--bone);
  opacity: 0.5;
  margin-top: var(--space-6);
  max-width: 560px;
  margin-inline: auto;
  display: block;
}

/* ---- Mobile ---- */

@media (max-width: 1024px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
}

@media (max-width: 768px) {

  /* Mobile nav overlay — fully opaque so page content never shows through */
  .nav-links {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #14141a;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    margin: 0;
    padding: 0;
    z-index: 99;
    list-style: none;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links.open li {
    opacity: 0;
    animation: navItemIn 0.4s var(--ease-out) forwards;
  }

  .nav-links.open li:nth-child(1) { animation-delay: 0.05s; }
  .nav-links.open li:nth-child(2) { animation-delay: 0.10s; }
  .nav-links.open li:nth-child(3) { animation-delay: 0.15s; }
  .nav-links.open li:nth-child(4) { animation-delay: 0.20s; }
  .nav-links.open li:nth-child(5) { animation-delay: 0.25s; }

  @keyframes navItemIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
  }

  .nav-links.open a {
    font-size: var(--text-2xl);
    letter-spacing: var(--tracking-wider);
    opacity: 0.9;
    padding: var(--space-3) 0;
  }

  /* Show Inquire button at bottom of overlay when nav is open */
  .nav-inquire {
    display: none;
  }

  body.nav-open .nav-inquire {
    display: inline-flex;
    position: fixed;
    bottom: calc(clamp(var(--space-10), 8vh, var(--space-16)) + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 101;
    white-space: nowrap;
    padding: var(--space-4) var(--space-10);
    border-color: rgba(184, 149, 106, 0.5);
    /* dedicated keyframe keeps the translateX(-50%) so it stays centered */
    animation: navInquireIn 0.4s var(--ease-out) 0.28s both;
  }

  @keyframes navInquireIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%); }
  }

  .nav-toggle {
    display: flex;
  }

  /* Smaller overhang on mobile so it doesn't crowd the menu button */
  .nav-logo {
    height: 40px;
  }
  .nav-logo__img {
    height: 60px;      /* 4:1 lockup -> ~240px wide, clears the hamburger at 360px */
    top: -6px;
    max-width: 66vw;
  }
  .site-nav.scrolled .nav-logo__img {
    height: 46px;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .nav-logo__accent {
    display: none;
  }
}
