/* =============================================================================
   ARTSY HOMES — header.css
   Place at: artsy-homes/css/header.css
   Enqueue in functions.php after artsy-homes-style
   ============================================================================= */

/* ─── Tokens (keep in sync with home-page.css) ──────────────────────────────── */
:root {
  --hdr-height:        72px;
  --hdr-height-scroll: 58px;
  --hdr-bg:            rgba(245, 240, 232, 0.0);   /* transparent on hero */
  --hdr-bg-scroll:     rgba(245, 240, 232, 0.97);  /* cream when scrolled */
  --hdr-border-scroll: rgba(176, 141, 106, 0.25);
  --hdr-shadow-scroll: 0 2px 24px rgba(26, 21, 16, 0.08);

  --nav-link-color:        rgba(253, 250, 245, 0.9);
  --nav-link-color-scroll: #2c2520;
  --nav-link-hover:        #9e5a38;

  --mobile-menu-bg:  #1a1510;
  --mobile-menu-w:   320px;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ─────────────────────────────────────────────────────────────────────────────
   HEADER SHELL
───────────────────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--hdr-height);
  background: var(--hdr-bg);
  transition:
    background   0.4s var(--ease),
    height       0.3s var(--ease),
    box-shadow   0.4s var(--ease),
    border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

/* Scrolled state — added by JS */
.site-header.is-scrolled {
  background:    var(--hdr-bg-scroll);
  height:        var(--hdr-height-scroll);
  box-shadow:    var(--hdr-shadow-scroll);
  border-color:  var(--hdr-border-scroll);
}

/* Compensate for fixed header so page content isn't hidden underneath.
   Only on non-front-page templates — front-page hero is full-viewport anyway. */
body:not(.home) .site-content {
  padding-top: var(--hdr-height);
}

/* ─────────────────────────────────────────────────────────────────────────────
   INNER LAYOUT
───────────────────────────────────────────────────────────────────────────── */
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  gap: 2rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BRANDING
───────────────────────────────────────────────────────────────────────────── */
.site-branding {
  flex-shrink: 0;
}

.site-branding__link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 2px;
}

/* Custom logo from WP (when uploaded) */
.site-branding .custom-logo {
  height: 40px;
  width: auto;
  display: block;
  transition: opacity 0.3s var(--ease);
}

.site-branding .custom-logo:hover {
  opacity: 0.8;
}

/* Text wordmark fallback */
.site-branding__wordmark {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.55rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--nav-link-color);
  transition: color 0.4s var(--ease);
}

.is-scrolled .site-branding__wordmark {
  color: var(--nav-link-color-scroll);
}

.site-branding__wordmark-secondary {
  font-style: italic;
  color: inherit;
  margin-left: 1px;
}

.site-branding__location {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(253, 250, 245, 0.55);
  transition: color 0.4s var(--ease);
}

.is-scrolled .site-branding__location {
  color: #b08d6a;
}

/* ─────────────────────────────────────────────────────────────────────────────
   DESKTOP NAVIGATION
───────────────────────────────────────────────────────────────────────────── */
.main-navigation {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  display: block;
  padding: 0.5rem 0.9rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--nav-link-color);
  border-radius: 2px;
  transition: color 0.3s var(--ease), background 0.3s var(--ease);
  white-space: nowrap;
}

.is-scrolled .nav-menu a {
  color: var(--nav-link-color-scroll);
}

/* Animated underline */
.nav-menu a::after {
  content: '';
  display: block;
  height: 1px;
  background: #9e5a38;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
  margin-top: 2px;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current_page_item > a {
  color: #9e5a38;
}

.nav-menu a:hover::after,
.nav-menu .current-menu-item > a::after,
.nav-menu .current_page_item > a::after {
  transform: scaleX(1);
}

/* ── Dropdown sub-menus ── */
.nav-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: #fdfaf5;
  border: 1px solid rgba(176, 141, 106, 0.2);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(26, 21, 16, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  transform: translateX(-50%) translateY(-6px);
  pointer-events: none;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.nav-menu .sub-menu a {
  color: #2c2520;
  padding: 0.55rem 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.nav-menu .sub-menu a::after {
  display: none;
}

.nav-menu .sub-menu a:hover {
  color: #9e5a38;
  background: rgba(176, 141, 106, 0.08);
}

/* ─────────────────────────────────────────────────────────────────────────────
   HEADER ACTIONS (CTA + hamburger)
───────────────────────────────────────────────────────────────────────────── */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* Book Now CTA button */
.header-book-btn {
  display: inline-block;
  padding: 0.55em 1.4em;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fdfaf5;
  background: #9e5a38;
  border: 1px solid #9e5a38;
  border-radius: 2px;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.2s var(--ease);
  white-space: nowrap;
}

.header-book-btn:hover {
  background: #5a3e2b;
  border-color: #5a3e2b;
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   HAMBURGER BUTTON
───────────────────────────────────────────────────────────────────────────── */
.hamburger {
  display: none; /* shown via media query */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(253, 250, 245, 0.3);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.3s var(--ease);
  flex-shrink: 0;
}

.is-scrolled .hamburger {
  border-color: rgba(176, 141, 106, 0.4);
}

.hamburger:hover {
  border-color: #9e5a38;
}

.hamburger__bar {
  display: block;
  width: 18px;
  height: 1px;
  background: #fdfaf5;
  border-radius: 1px;
  transition:
    transform  0.35s var(--ease),
    opacity    0.25s var(--ease),
    background 0.3s var(--ease);
  transform-origin: center;
}

.is-scrolled .hamburger__bar {
  background: #2c2520;
}

/* Active (open) state — morphs into × */
.hamburger.is-active .hamburger__bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger.is-active .hamburger__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.is-active .hamburger__bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* When menu is open, bars are always dark (menu bg is dark) */
.hamburger.is-active .hamburger__bar {
  background: #fdfaf5;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MOBILE MENU DRAWER
───────────────────────────────────────────────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--mobile-menu-w);
  max-width: 90vw;
  background: var(--mobile-menu-bg);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.45s var(--ease);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu.is-open {
  transform: translateX(0);
}

.mobile-menu__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: calc(var(--hdr-height) + 1.5rem) 2rem 2.5rem;
  gap: 2rem;
}

/* Mobile nav links */
.mobile-nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.mobile-nav-menu li {
  border-bottom: 1px solid rgba(176, 141, 106, 0.12);
}

.mobile-nav-menu li:first-child {
  border-top: 1px solid rgba(176, 141, 106, 0.12);
}

.mobile-nav-menu > li > a {
  display: block;
  padding: 1rem 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 300;
  color: rgba(253, 250, 245, 0.9);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.25s var(--ease), padding-left 0.25s var(--ease);
}

.mobile-nav-menu > li > a:hover,
.mobile-nav-menu .current-menu-item > a {
  color: #b08d6a;
  padding-left: 0.5rem;
}

/* Mobile sub-menu */
.mobile-nav-menu .sub-menu {
  list-style: none;
  margin: 0 0 0.75rem 0;
  padding: 0 0 0 1rem;
}

.mobile-nav-menu .sub-menu a {
  display: block;
  padding: 0.4rem 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(176, 141, 106, 0.8);
  text-decoration: none;
  transition: color 0.2s;
}

.mobile-nav-menu .sub-menu a:hover {
  color: #b08d6a;
}

/* Mobile CTA */
.mobile-menu__cta {
  display: block;
  text-align: center;
  padding: 1em 2em;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fdfaf5;
  background: #9e5a38;
  border-radius: 2px;
  transition: background 0.3s var(--ease);
}

.mobile-menu__cta:hover {
  background: #5a3e2b;
}

/* Mobile menu footer info */
.mobile-menu__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mobile-menu__location {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: rgba(176, 141, 106, 0.5);
}

.mobile-menu__email {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.8rem;
  color: rgba(176, 141, 106, 0.7);
  text-decoration: none;
  border-bottom: 1px solid rgba(176, 141, 106, 0.25);
  display: inline-block;
  transition: color 0.2s, border-color 0.2s;
}

.mobile-menu__email:hover {
  color: #b08d6a;
  border-color: #b08d6a;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BACKDROP
───────────────────────────────────────────────────────────────────────────── */
.mobile-menu__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 16, 0.6);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.mobile-menu__backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Prevent body scroll when menu is open */
body.menu-is-open {
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
───────────────────────────────────────────────────────────────────────────── */

/* ── Show hamburger, hide desktop nav + book btn at ≤ 900px ── */
@media (max-width: 900px) {

  .main-navigation {
    display: none;
  }

  .header-book-btn {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .site-header__inner {
    padding: 0 1.25rem;
  }
}

/* ── Slightly tighter on small screens ── */
@media (max-width: 480px) {
  :root {
    --hdr-height: 60px;
    --mobile-menu-w: 100vw;
  }

  .mobile-menu__inner {
    padding-top: calc(var(--hdr-height) + 1rem);
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .mobile-menu,
  .mobile-menu__backdrop,
  .hamburger__bar,
  .nav-menu a,
  .nav-menu .sub-menu {
    transition: none;
  }
}

/* ── Non-home pages: always show the scrolled (light) header state ── */
body:not(.home) .site-header {
  background:   var(--hdr-bg-scroll);
  box-shadow:   var(--hdr-shadow-scroll);
  border-color: var(--hdr-border-scroll);
}

body:not(.home) .site-branding__wordmark {
  color: var(--nav-link-color-scroll);
}

body:not(.home) .site-branding__location {
  color: #b08d6a;
}

body:not(.home) .nav-menu a {
  color: var(--nav-link-color-scroll);
}

body:not(.home) .hamburger {
  border-color: rgba(176, 141, 106, 0.4);
}

body:not(.home) .hamburger__bar {
  background: #2c2520;
}

/* ── Home page: force transparent header until JS adds is-scrolled ── */
body.home .site-header:not(.is-scrolled) {
  background:   var(--hdr-bg) !important;
  box-shadow:   none !important;
  border-color: transparent !important;
}

body.home .site-header:not(.is-scrolled) .site-branding__wordmark { color: var(--nav-link-color) !important; }
body.home .site-header:not(.is-scrolled) .site-branding__location { color: rgba(253, 250, 245, 0.55) !important; }
body.home .site-header:not(.is-scrolled) .nav-menu a              { color: var(--nav-link-color) !important; }
body.home .site-header:not(.is-scrolled) .hamburger               { border-color: rgba(253, 250, 245, 0.3) !important; }
body.home .site-header:not(.is-scrolled) .hamburger__bar          { background: #fdfaf5 !important; }