/* ============================================================
   THE NEXT STEP — layout.css
   Header, navigation (desktop + mobile), page banners, footer.
   ============================================================ */

/* ---------- Top announcement bar ---------- */
.topbar {
  background: var(--navy-deep);
  color: rgba(251, 249, 244, .78);
  font-size: .8rem;
  letter-spacing: .04em;
  padding: 8px 0;
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar a { color: var(--gold-soft); font-weight: 600; }
.topbar a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 60;
  /* Solid fallback so the header can never render transparent,
     even if the blurred pseudo-element fails on an old browser. */
  background: rgba(251, 249, 244, .92);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .3s var(--ease);
}
/* The frosted-glass background lives on a pseudo-element instead of
   .header itself. Safari/iOS treats any element with backdrop-filter
   as the positioning anchor for position:fixed children — which broke
   the slide-in mobile menu (a fixed child of .header). A pseudo-element
   has no children, so the menu stays anchored to the viewport. */
.header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(251, 249, 244, .92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.header.is-scrolled { box-shadow: var(--shadow-soft); }

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 78px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand img { width: 52px; height: auto; flex-shrink: 0; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.06rem;
  color: var(--navy);
  line-height: 1.15;
  white-space: nowrap;
}
.brand__name small {
  display: block;
  font-family: var(--font-mono);
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Navigation ---------- */
.nav { display: flex; align-items: center; gap: 30px; }

.nav__link {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 0;
  position: relative;
  transition: color .2s var(--ease);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease);
}
.nav__link:hover,
.nav__link.is-active { color: var(--navy); }
.nav__link:hover::after,
.nav__link.is-active::after { transform: scaleX(1); }

.nav .btn { padding: 11px 22px; font-size: .88rem; }

/* Hamburger (mobile only) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Inner-page banner ---------- */
.page-hero {
  background: var(--navy);
  color: var(--white);
  padding: clamp(64px, 9vw, 104px) 0;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 10%, rgba(201, 162, 75, .22), transparent 42%),
    radial-gradient(circle at 8% 100%, rgba(228, 197, 132, .10), transparent 40%);
}
.page-hero .container { position: relative; }
.page-hero h1 { color: var(--white); max-width: 760px; }
.page-hero p {
  color: rgba(251, 249, 244, .75);
  max-width: 620px;
  margin-top: 18px;
  font-size: 1.08rem;
}
.page-hero .eyebrow { color: var(--gold-soft); }
.page-hero .eyebrow::before { background: var(--gold-soft); }

/* ---------- Footer ---------- */
.footer {
  background: var(--navy-deep);
  color: rgba(251, 249, 244, .68);
  padding: clamp(56px, 7vw, 80px) 0 0;
  font-size: .94rem;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 44px;
  padding-bottom: 52px;
}
.footer__brand img { width: 120px; margin-bottom: 18px; }
.footer__brand p { color: rgba(251, 249, 244, .6); max-width: 300px; }

.footer h4 {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 18px;
  font-weight: 500;
}
.footer li { margin-bottom: 11px; }
.footer a:hover { color: var(--gold-soft); }

.footer__contact li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.footer__contact svg {
  width: 16px; height: 16px;
  color: var(--gold-soft);
  flex-shrink: 0;
  margin-top: 4px;
}

.footer__bottom {
  border-top: 1px solid var(--line-dark);
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .82rem;
  color: rgba(251, 249, 244, .45);
}

/* ============================================================
   Responsive — tablet & mobile
   ============================================================ */
@media (max-width: 900px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .nav-toggle { display: flex; }

  /* IMPORTANT: the menu must NOT use position:fixed. The header's
     backdrop-filter makes the header the containing block for fixed
     descendants, which collapses the menu's background box — that
     was the "transparent menu" bug. position:absolute + top:100%
     anchors it to the sticky header's real bottom edge instead,
     which also self-adjusts when the top bar wraps to two lines. */
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    /* --nav-height is set by js/main.js to the exact space below
       the header; the calc() is only the no-JS fallback. */
    height: var(--nav-height, calc(100dvh - 78px));
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 28px 26px calc(48px + env(safe-area-inset-bottom, 0px));
    background: var(--cream);
    border-top: 1px solid var(--line);
    /* Short screens (small phones, landscape): the menu itself
       scrolls so every link — including the button — is reachable. */
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      opacity: 0;
      transform: translateY(-8px);
      pointer-events: none;
      visibility: hidden;
      transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s .25s;
      z-index: 55;
      max-width: 100%;
  }
  .nav.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    visibility: visible;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }

  .nav__link {
    width: 100%;
    font-size: 1.15rem;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }
  .nav .btn { margin-top: 18px; width: 100%; }

  body.nav-locked { overflow: hidden; }
}

@media (max-width: 560px) {
  .footer__grid { grid-template-columns: 1fr; gap: 32px; }
  .topbar .container { justify-content: center; text-align: center; }
}

/* Very narrow phones (≤ 380px) */
@media (max-width: 380px) {
  .brand img { width: 42px; }
  .brand__name { font-size: .92rem; }
  .header__inner { gap: 8px; }
}
