/* ==========================================================================
   Portable floating navbar — The Atypical Mind
   Behaviour, geometry and motion ported from bro-ga
   (header.js, styles.css, responsive.css, motion.js, motion.css).

   The header must be a direct child of #top, and #top must not use
   overflow-x: hidden (hidden kills position: sticky; clip does not).
   ========================================================================== */

:root {
  --header-height: 72px;
  --nav-ease: cubic-bezier(.22, 1, .36, 1);
  --booking-feedback: 180ms;
  --booking-arrow-motion: 360ms;
  --booking-cue-duration: 900ms;
  --booking-cue-delay: 650ms;
}

@media (min-width: 1024px) {
  :root { --header-height: 88px; }
}

[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(var(--header-height) + 16px); }

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-180%);
  padding: 12px 18px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms var(--nav-ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Header shell ---------- */
.site-header {
  position: relative;
  z-index: 50;
  width: 100%;
  margin-inline: auto;
  padding-inline: 20px;
  height: var(--header-height);
  background: transparent;
  transform: translateY(0);
  transition: transform 480ms var(--nav-ease),
              width 150ms var(--nav-ease) 480ms,
              background-color 150ms var(--nav-ease) 480ms,
              border-radius 150ms var(--nav-ease) 480ms,
              box-shadow 150ms var(--nav-ease) 480ms,
              padding 150ms var(--nav-ease) 480ms;
}
.site-header.is-enhanced {
  position: sticky;
  top: calc(-1 * var(--header-height));
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  margin-inline: auto;
}

@media (min-width: 768px) {
  .site-header { padding-inline: 32px; }
}
@media (min-width: 1024px) {
  .site-header { padding-inline: 56px; }
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-tag {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--secondary);
  white-space: nowrap;
}

/* ---------- Primary nav ---------- */
.main-nav { display: none; }

@media (min-width: 1024px) {
  .main-nav {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }
}

/* 1024–1279 also carries the icon-only CTA inside the pill; a slightly
   tighter link gap keeps all five labels on one line without overlap. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .main-nav { gap: 12px; }
}

.nav-link {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms var(--nav-ease);
}
.nav-link::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--nav-ease);
}
.nav-link:hover::after,
.nav-link:focus-visible::after { transform: scaleX(1); }
.nav-link[aria-current="location"] { color: var(--navy); }
.nav-link[aria-current="location"]::after { transform: scaleX(1); }
.nav-link--mobile { display: none; }

/* ---------- Header actions + CTA ---------- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
}

.header-cta {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 4px 4px 16px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  color: #fff;
  background: var(--action);
  font-size: 15px;
  line-height: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--ink), 0 8px 16px rgba(23, 43, 69, 0.14);
  transition: transform var(--booking-feedback) var(--nav-ease),
              box-shadow var(--booking-feedback) var(--nav-ease),
              background-color var(--booking-feedback) var(--nav-ease);
}
.header-cta::before {
  position: absolute;
  inset: -5px;
  z-index: -1;
  border: 1px solid var(--action);
  border-radius: 17px;
  opacity: 0;
  content: "";
  pointer-events: none;
}
.cta-label { padding-bottom: 1px; }
.cta-icon {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
}
.cta-arrow {
  position: absolute;
  inset: 7px;
  width: 20px;
  height: 20px;
  transition: transform var(--booking-arrow-motion) var(--nav-ease),
              opacity var(--booking-feedback) var(--nav-ease);
}
.cta-arrow--next {
  transform: translate(-160%, 160%);
  opacity: 0;
}
.header-cta:is(:hover, :focus-visible) {
  transform: translateY(-2px);
  background: var(--action-hover);
  box-shadow: 0 5px 0 var(--ink), 0 12px 22px rgba(23, 43, 69, 0.18);
}
.header-cta:is(:hover, :focus-visible) .cta-arrow:not(.cta-arrow--next) {
  transform: translate(160%, -160%);
  opacity: 0;
}
.header-cta:is(:hover, :focus-visible) .cta-arrow--next {
  transform: translate(0, 0);
  opacity: 1;
}
.header-cta:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 5px;
}
.header-cta:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

/* Phones and the compact pill (1024–1279) show the icon tile only; the label
   stays in the DOM, visually hidden, so the accessible name is unchanged.
   From 640px and from 1280px the full label is shown. */
@media (max-width: 639px), (min-width: 1024px) and (max-width: 1279px) {
  .header-cta {
    gap: 0;
    padding: 4px;
    min-height: 46px;
  }
  .cta-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

/* ---------- Menu toggle ---------- */
.menu-toggle {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  transition: background-color var(--booking-feedback) var(--nav-ease),
              border-color var(--booking-feedback) var(--nav-ease);
}
.menu-toggle svg { width: 22px; height: 22px; }
.menu-toggle:hover { background: var(--mist); }
.menu-toggle[aria-expanded="true"] {
  border-color: var(--ink);
  background: var(--mist);
}

@media (max-width: 1023px) {
  .menu-toggle:not([hidden]) { display: grid; }
}

/* ---------- Floating pill (desktop) ---------- */
@media (min-width: 1024px) {
  .site-header.is-stuck {
    width: min(calc(100% - 128px), 1120px);
    padding-inline: 20px;
    border-radius: 12px;
    background: var(--paper);
    outline: 1px solid var(--rule);
    box-shadow: 0 10px 30px rgba(23, 43, 69, 0.08);
    transform: translateY(var(--floating-shift, calc(var(--header-height) + 16px)));
    transition: transform 480ms var(--nav-ease);
  }
  .site-header.is-stuck .header-inner { max-width: none; }
  .site-header.is-stuck .brand-tag { display: none; }
  .site-header.is-stuck .brand-name { font-size: 18px; }
  .site-header.is-stuck .brand-mark { width: 24px; height: 24px; }

  .site-header.is-snapping {
    transform: translateY(0);
    transition: none;
  }
  .site-header[inert] { pointer-events: none; }
}

/* ---------- Compact header + dropdown panel ---------- */
@media (max-width: 1023px) {
  .site-header,
  .site-header.is-stuck,
  .site-header.is-snapping {
    width: 100%;
    height: var(--header-height);
    padding-inline: 20px;
    border-radius: 0;
    outline: 0;
    background: var(--paper);
    box-shadow: 0 1px 0 var(--rule);
    transform: none;
    transition: none;
  }
  .site-header.is-enhanced { top: 0; }

  .site-header.is-enhanced .main-nav {
    position: absolute;
    inset: 100% 16px auto 16px;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    max-height: calc(100dvh - var(--header-height) - 24px);
    padding: 12px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--rule);
    border-radius: 0 0 16px 16px;
    background: var(--paper);
    box-shadow: 0 18px 30px rgba(23, 43, 69, 0.12);
  }
  .site-header .nav-link {
    display: flex;
    width: 100%;
    min-height: 56px;
    justify-content: flex-start;
    font-size: 18px;
    line-height: 26px;
  }
  .site-header .nav-link + .nav-link { border-top: 1px solid var(--rule); }
  .site-header .nav-link::after { display: none; }
  .site-header .nav-link--mobile { display: flex; }

  /* No-JS fallback: the nav stays readable under the header. */
  .site-header:not(.is-enhanced) .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: 10px;
    gap: 10px;
  }
  .site-header:not(.is-enhanced) .main-nav {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    flex: 1 0 100%;
    order: 3;
    padding-block: 8px 0;
  }
}

/* ---------- Compact brand safety ---------- */
@media (max-width: 1023px) {
  .brand-name { font-size: 20px; }
}
@media (max-width: 639px) {
  .brand { gap: 8px; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-name { font-size: 19px; }
  .brand-tag { font-size: 11px; }
  .header-inner { gap: 10px; }
  .header-actions { gap: 8px; }
}
@media (max-width: 379px) {
  .site-header { padding-inline: 16px; }
  .brand-mark { display: none; }
  .brand-name { font-size: 17px; }
  .brand-tag { font-size: 10px; }
}

/* ---------- One-time booking invitation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .header-cta::before {
    animation: booking-invite var(--booking-cue-duration) var(--nav-ease) var(--booking-cue-delay) 1;
  }
  @keyframes booking-invite {
    0%   { opacity: 0; transform: scale(.98); }
    20%  { opacity: .55; }
    100% { opacity: 0; transform: scale(1.12); }
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .site-header.is-stuck,
  .site-header.is-snapping,
  .header-cta,
  .cta-arrow,
  .nav-link::after,
  .menu-toggle {
    transition: none !important;
  }
  .header-cta::before { animation: none !important; }
  .cta-arrow--next { display: none; }
  .header-cta:is(:hover, :focus-visible) .cta-arrow:not(.cta-arrow--next) {
    transform: none;
    opacity: 1;
  }
}

/* ---------- Forced colors ---------- */
@media (forced-colors: active) {
  .site-header.is-stuck,
  .menu-toggle,
  .header-cta {
    border: 1px solid ButtonText;
    outline: 1px solid ButtonText;
    color: ButtonText;
    background: ButtonFace;
    box-shadow: none;
  }
  .cta-icon {
    color: ButtonFace;
    background: ButtonText;
  }
  .nav-link::after { background: ButtonText; }
}
