/* ==========================================================================
   Layout — site header, primary nav, mobile drawer, footer, grid helpers
   ========================================================================== */

/* ---------- Top utility bar ---------- */

.utility-bar {
  background: var(--ink-950);
  color: var(--text-invert-muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
}

.utility-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  min-height: 38px;
}

.utility-bar__group {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.utility-bar a {
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.utility-bar a:hover {
  color: var(--brass-300);
}

.utility-bar__item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

.utility-bar__item svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Language switcher — English and Simplified Chinese only. */
.lang-switch {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.lang-switch a {
  padding: 2px var(--sp-2);
  border-radius: var(--r-xs);
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.lang-switch a[aria-current="true"] {
  background: rgba(255, 255, 255, 0.1);
  color: var(--brass-300);
  font-weight: 600;
}

@media (max-width: 900px) {
  .utility-bar__group--secondary {
    display: none;
  }
}

/* The address is `white-space: nowrap` (it must not break mid-street), which
   on a 320px screen is wide enough to force the whole page sideways. Below
   this breakpoint drop it and keep only the language switcher — the address
   is still in the footer, on the contact page and in the schema.org data. */
@media (max-width: 620px) {
  .utility-bar__item {
    display: none;
  }

  .utility-bar__inner {
    justify-content: center;
  }
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: box-shadow var(--dur-base) var(--ease-out);
}

/* The frosted backdrop lives on a pseudo-element, NOT on .site-header itself.
   `backdrop-filter` (like `filter`/`transform`) makes an element the containing
   block for its position:fixed descendants — on the header it shrank the
   mobile nav sheet to the header's own 64px box (BUG-11). */
.site-header::before {
  content: "";
  position: absolute;
  /* -1px: reach under the 1px bottom border, which an inset of 0 (the padding
     box) would leave showing the light page behind it. */
  inset: 0 0 -1px;
  z-index: -1;
  background: rgba(11, 20, 32, 0.92);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: background var(--dur-base) var(--ease-out);
}

/* Toggled by main.js once the page scrolls past the hero fold. */
.site-header.is-stuck {
  box-shadow: 0 10px 30px rgba(7, 14, 23, 0.28);
}

.site-header.is-stuck::before {
  background: rgba(7, 14, 23, 0.97);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand img {
  width: auto;
  height: 42px;
  transition: height var(--dur-base) var(--ease-out);
}

@media (max-width: 860px) {
  .brand img {
    height: 34px;
  }
}

/* ---------- Primary nav ---------- */

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.nav__link {
  position: relative;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  color: rgba(247, 244, 239, 0.82);
  font-size: var(--fs-base);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: var(--sp-4);
  right: var(--sp-4);
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--brass-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-out);
}

.nav__link:hover {
  color: #fff;
}

.nav__link:hover::after,
.nav__link[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav__link[aria-current="page"] {
  color: #fff;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

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

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--r-sm);
  color: var(--text-invert);
}

.nav-toggle__bars {
  position: relative;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: background var(--dur-fast) var(--ease-out);
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--dur-base) var(--ease-out);
}

.nav-toggle__bars::before {
  top: -6px;
}
.nav-toggle__bars::after {
  top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }

  .header-actions .btn--phone {
    display: none;
  }

  /* The nav becomes a full-height sheet below the header. main.js sets
     --nav-top to the header's real bottom edge on open (the utility bar above
     the header pushes it below --header-h at the top of the page). */
  .nav {
    position: fixed;
    inset: var(--nav-top, var(--header-h)) 0 0 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    margin: 0;
    padding: var(--sp-6) var(--gutter) var(--sp-12);
    background: var(--ink-950);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    /* Stepped visibility — same reasoning as the modal in components.css:
       visible immediately on open so the panel's links are focusable, delayed
       on close so the fade-out is still seen. */
    transition: opacity var(--dur-base) var(--ease-out),
      transform var(--dur-base) var(--ease-out),
      visibility 0s linear var(--dur-base);
  }

  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity var(--dur-base) var(--ease-out),
      transform var(--dur-base) var(--ease-out),
      visibility 0s;
  }

  .nav__link {
    padding: var(--sp-4) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    font-family: var(--font-display);
    font-size: var(--fs-xl);
  }

  .nav__link::after {
    left: 0;
    right: auto;
    width: 34px;
    bottom: 10px;
  }

  .nav__mobile-cta {
    margin-top: var(--sp-8);
    display: grid;
    gap: var(--sp-3);
  }
}

/* No-JS fallback: the drawer toggle is script-driven, so without JS a phone
   visitor would be left with a dead hamburger and no navigation at all.
   `.no-js` is on <html> until main.js removes it, so when scripting is off we
   render the nav inline as a wrapped row instead of an off-canvas panel. */
@media (max-width: 860px) {
  .no-js .nav-toggle {
    display: none;
  }

  .no-js .site-header__inner {
    flex-wrap: wrap;
  }

  .no-js .nav {
    position: static;
    inset: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-1);
    width: 100%;
    padding: 0 0 var(--sp-3);
    background: none;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .no-js .nav__link {
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 0;
    border-radius: var(--r-sm);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
  }

  .no-js .nav__link::after {
    left: var(--sp-3);
    right: var(--sp-3);
    width: auto;
    bottom: 2px;
  }

  .no-js .nav__mobile-cta {
    display: none;
  }
}

@media (min-width: 861px) {
  .nav__mobile-cta {
    display: none;
  }
}

/* On the narrowest phones the header keeps only the logo and the toggle —
   the CTA is repeated at the top of the open drawer. */
@media (max-width: 560px) {
  .header-actions .btn--cta {
    display: none;
  }
}

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

.site-footer {
  position: relative;
  background: var(--ink-950);
  color: var(--text-invert);
  padding-top: var(--sp-20);
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brass-gradient);
}

.footer-grid {
  display: grid;
  /* Last column (business hours) sizes to its content so the day/time rows
     never wrap or spill; the link columns share what is left. */
  grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr)) max-content;
  gap: var(--sp-10) var(--sp-8);
  padding-bottom: var(--sp-16);
}

@media (max-width: 1040px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.footer-brand img {
  height: 46px;
  width: auto;
  margin-bottom: var(--sp-5);
}

.footer-brand p {
  max-width: 34ch;
  color: var(--text-invert-muted);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
}

.footer-contact {
  margin-top: var(--sp-6);
  display: grid;
  gap: var(--sp-2);
  font-size: var(--fs-base);
}

.footer-contact a {
  text-decoration: none;
  color: var(--text-invert);
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-contact a:hover {
  color: var(--brass-300);
}

.footer-col__title {
  margin-bottom: var(--sp-5);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--brass-300);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--sp-3);
}

.footer-col a,
.footer-col li {
  font-size: var(--fs-base);
  color: var(--text-invert-muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-col a:hover {
  color: #fff;
}

/* Two aligned columns — days | times — that never wrap mid-range. The <div>
   rows use display: contents so every dt/dd shares one grid. */
.footer-hours {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: var(--sp-3) var(--sp-5);
  margin: 0;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  color: var(--text-invert-muted);
}

.footer-hours div {
  display: contents;
}

.footer-hours dt,
.footer-hours dd {
  margin: 0;
  white-space: nowrap;
}

.footer-hours dd {
  color: var(--text-invert);
}

.footer-hours dd.footer-hours__closed {
  color: var(--text-invert-muted);
}

.social-row {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-pill);
  color: var(--text-invert-muted);
  transition: border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.social-row a:hover {
  border-color: var(--brass-500);
  background: rgba(194, 147, 58, 0.14);
  color: var(--brass-300);
}

.social-row svg {
  width: 16px;
  height: 16px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-block: var(--sp-8) var(--sp-10);
}

.footer-bottom__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  font-size: var(--fs-xs);
  color: rgba(247, 244, 239, 0.58);
}

.footer-bottom a {
  color: inherit;
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--brass-300);
}

.footer-badges {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.footer-badges img {
  height: 40px;
  width: auto;
  opacity: 0.78;
  /* The EHO badge is dark artwork; invert so it reads on the ink footer. */
  filter: brightness(0) invert(1);
}

/* ---------- Generic grid helpers ---------- */

.grid {
  display: grid;
  gap: var(--sp-6);
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid--2,
  .grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Page hero (interior pages) ---------- */

.page-hero {
  position: relative;
  background: var(--ink-900);
  color: var(--text-invert);
  padding-block: clamp(3rem, 2rem + 4.5vw, 5.5rem);
  overflow: hidden;
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 120% at 12% 0%, rgba(194, 147, 58, 0.20), transparent 62%),
    radial-gradient(50% 100% at 100% 100%, rgba(42, 64, 89, 0.55), transparent 70%);
  pointer-events: none;
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.page-hero h1 {
  max-width: 20ch;
  color: var(--text-invert);
}

.page-hero p {
  max-width: 60ch;
  margin-top: var(--sp-5);
  color: var(--text-invert-muted);
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
}

