/* =====================================================================
   Kareva: site header

   Two states, switched by header.js:
   - default      full-width bar: wordmark left, menu centred, button right
   - .is-compact  centred floating pill with the small brand mark
   The move between them is animated with GSAP Flip (positions and sizes),
   while colours, the glass and the logo swap use the CSS transitions below.

   Colours follow body.header-light (set per section by home.js / site.js):
   light text over dark sections, dark text over light ones.
   ===================================================================== */

.site-header {
  --hdr-ink: #f7f4ed;
  --hdr-ink-soft: rgba(247, 244, 237, .78);
  --hdr-accent: #e2333d;
  --hdr-cta-bg: #f7f4ed;
  --hdr-cta-fg: #161513;
  --hdr-glass-bg: rgba(22, 21, 19, .6);
  --hdr-glass-line: rgba(255, 255, 255, .12);
  --hdr-glass-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .22);
  --hdr-glass-inset: inset 0 1px 0 rgba(255, 255, 255, .08);
  --hdr-ease: cubic-bezier(.65, 0, .35, 1);

  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 22px clamp(20px, 2.8vw, 48px) 0;
  pointer-events: none;
  transition: padding .6s var(--hdr-ease);
}

body.header-light .site-header {
  --hdr-ink: #161513;
  --hdr-ink-soft: rgba(22, 21, 19, .8);
  --hdr-cta-bg: #161513;
  --hdr-cta-fg: #fff;
  --hdr-glass-bg: rgba(255, 255, 255, .8);
  --hdr-glass-line: rgba(255, 255, 255, .55);
  --hdr-glass-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .08);
  --hdr-glass-inset: inset 0 1px 0 rgba(255, 255, 255, .9);
}


/* ---------- the bar ---------- */

.hdr-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 1488px;
  height: 64px;
  padding: 0;
  border-radius: 999px;
  color: var(--hdr-ink);
  pointer-events: auto;
}

.hdr-glass {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 1px solid var(--hdr-glass-line);
  border-radius: inherit;
  background: var(--hdr-glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--hdr-glass-inset), var(--hdr-glass-shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity .45s ease,
    background .45s ease,
    border-color .45s ease,
    box-shadow .45s ease;
}

.hdr-bar > :not(.hdr-glass) {
  position: relative;
  z-index: 1;
}


/* ---------- logo: wordmark <-> mark ---------- */

@property --kl-navy    { syntax: "<color>"; inherits: true; initial-value: #f3eee4; }
@property --kl-orange  { syntax: "<color>"; inherits: true; initial-value: #e2333d; }
@property --kl-shade-1 { syntax: "<color>"; inherits: true; initial-value: rgba(255,255,255,.22); }
@property --kl-shade-2 { syntax: "<color>"; inherits: true; initial-value: rgba(255,255,255,.13); }
@property --kl-shade-3 { syntax: "<color>"; inherits: true; initial-value: rgba(255,255,255,.05); }

.brand-logo {
  --kl-navy: #f3eee4;
  --kl-orange: #e2333d;
  --kl-mark-red: #d2333c;
  --kl-shade-1: rgba(255,255,255,.22);
  --kl-shade-2: rgba(255,255,255,.13);
  --kl-shade-3: rgba(255,255,255,.05);
  --logo-w: 124px;
  --logo-h: 42px;

  justify-self: start;
  display: block;
  width: var(--logo-w);
  height: var(--logo-h);
  overflow: hidden;
  transition:
    --kl-navy .45s ease,
    --kl-orange .45s ease,
    --kl-shade-1 .45s ease,
    --kl-shade-2 .45s ease,
    --kl-shade-3 .45s ease;
}

body.header-light .brand-logo {
  --kl-navy: #151354;
  --kl-shade-1: #e6e6ec;
  --kl-shade-2: #cdccdc;
  --kl-shade-3: #6f6d98;
}

.brand-logo-full,
.brand-logo-mark {
  position: absolute;
  top: 50%;
  left: 0;
  display: block;
  transition:
    opacity .45s ease,
    transform .7s var(--hdr-ease);
}

.brand-logo-full {
  width: 124px;
  transform: translateY(-50%);
}

.brand-logo-full .brand-logo-svg {
  display: block;
  width: 100%;
  height: auto;
}

.brand-logo-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(-50%) translateX(26px) scale(.6) rotate(-12deg);
}

.brand-mark-svg {
  display: block;
  width: 30px;
  height: auto;
  overflow: visible;
}

.brand-logo:focus-visible {
  outline: 2px solid var(--hdr-accent);
  outline-offset: 6px;
  border-radius: 8px;
}


/* ---------- menu ---------- */

.floating-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.floating-nav a,
.nav-group > a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  color: var(--hdr-ink-soft);
  font-family: "Figtree", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: color .3s ease;
}

.floating-nav a:hover,
.floating-nav a:focus-visible,
.floating-nav > a.active,
.nav-group:hover > a,
.nav-group:focus-within > a {
  color: var(--hdr-ink);
}

/* open bar over a photo: a soft shadow keeps light text readable */
body:not(.header-light) .site-header:not(.is-compact) .floating-nav > a,
body:not(.header-light) .site-header:not(.is-compact) .nav-group > a {
  text-shadow: 0 1px 14px rgba(0, 0, 0, .35);
}

/* the small red dot under the current item */
.floating-nav > a::after,
.nav-group > a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--hdr-accent);
  opacity: 0;
  transform: scale(0);
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .25s ease;
}

.nav-group > a::after {
  margin-left: -9px; /* centre under the word, not the chevron */
}

.floating-nav > a.active::after,
.nav-group > a.active::after {
  opacity: 1;
  transform: scale(1);
}

.floating-nav a:focus-visible {
  outline: 2px solid var(--hdr-accent);
  outline-offset: -4px;
  border-radius: 999px;
}

.nav-chev {
  width: 10px;
  height: 6px;
  margin-top: 1px;
  transition: transform .35s var(--hdr-ease);
}

.nav-group:hover .nav-chev,
.nav-group:focus-within .nav-chev {
  transform: rotate(180deg);
}


/* ---------- dropdown ---------- */

.nav-group {
  position: relative;
}

.nav-drop {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 14px;
  min-width: 190px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .35s var(--hdr-ease), visibility 0s .35s;
}

.nav-group:hover .nav-drop,
.nav-group:focus-within .nav-drop {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .25s ease, transform .35s var(--hdr-ease), visibility 0s;
}

.nav-drop ul {
  list-style: none;
  margin: 0;
  padding: 12px 8px;
  border-radius: 22px;
  background: #161513;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}

.nav-group.is-closed .nav-drop {
  opacity: 0;
  visibility: hidden;
}

.floating-nav .nav-drop a {
  display: flex;
  height: auto;
  padding: 10px 18px;
  border-radius: 12px;
  color: rgba(247, 244, 237, .78);
  font-size: 15px;
  font-weight: 400;
  transition: color .25s ease, background .25s ease;
}

.floating-nav .nav-drop a:hover,
.floating-nav .nav-drop a:focus-visible,
.floating-nav .nav-drop a[aria-current] {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}


/* ---------- right side: button ---------- */

.hdr-end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px 0 20px;
  border-radius: 999px;
  background: var(--hdr-cta-bg);
  color: var(--hdr-cta-fg);
  font-family: "Parkinsans", sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background .35s ease, color .35s ease;
}

.header-cta svg {
  width: 11px;
  height: 11px;
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1);
}

.header-cta:hover {
  background: var(--hdr-accent);
  color: #fff;
}

.header-cta:hover svg {
  transform: rotate(45deg);
}

.header-cta:focus-visible {
  outline: 2px solid var(--hdr-accent);
  outline-offset: 4px;
}


/* ---------- compact pill ---------- */

.site-header.is-compact {
  padding-top: 14px;
}

.site-header.is-compact .hdr-bar {
  grid-template-columns: auto auto auto;
  gap: 18px;
  width: auto;
  height: 66px;
  padding: 0 11px 0 13px;
}

.site-header.is-compact .hdr-glass {
  opacity: 1;
}

.site-header.is-compact .brand-logo {
  --logo-w: 40px;
  --logo-h: 40px;
}

.site-header.is-compact .brand-logo-full {
  opacity: 0;
  transform: translateY(-50%) translateX(-70px);
}

.site-header.is-compact .brand-logo-mark {
  opacity: 1;
  transform: translateY(-50%);
}

.site-header.is-compact .floating-nav > a,
.site-header.is-compact .nav-group > a {
  padding: 0 12px;
}


/* ---------- mobile button ---------- */

.mobile-menu-btn {
  position: relative;
  z-index: 2;
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hdr-cta-bg);
  cursor: pointer;
  transition: background .35s ease;
}

.mobile-menu-btn .bar {
  display: block;
  width: 16px;
  height: 1.5px;
  margin: 5px auto;
  border-radius: 2px;
  background: var(--hdr-cta-fg);
  transition:
    transform .4s var(--hdr-ease),
    background .3s ease;
}

.mobile-menu-btn.is-open .bar:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.mobile-menu-btn.is-open .bar:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--hdr-accent);
  outline-offset: 3px;
}


/* ---------- tablets and phones ---------- */

@media (max-width: 1100px) {
  .floating-nav > a,
  .nav-group > a,
  .site-header.is-compact .floating-nav > a,
  .site-header.is-compact .nav-group > a {
    padding: 0 11px;
    font-size: 15px;
  }
}

@media (max-width: 900px) {

  .site-header,
  .site-header.is-compact {
    padding: 14px 14px 0;
  }

  .hdr-bar,
  .site-header.is-compact .hdr-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: 58px;
    padding: 0 7px 0 18px;
  }

  .hdr-glass,
  .site-header.is-compact .hdr-glass {
    opacity: 1;
  }

  .floating-nav,
  .header-cta {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .brand-logo,
  .site-header.is-compact .brand-logo {
    --logo-w: 104px;
    --logo-h: 36px;
  }

  .brand-logo-full {
    width: 104px;
  }

  .site-header.is-compact .brand-logo-full {
    opacity: 1;
    transform: translateY(-50%);
  }

  .site-header.is-compact .brand-logo-mark {
    opacity: 0;
  }

  /* menu open: the pill dissolves into the dark overlay */
  .site-header.menu-open .hdr-glass {
    opacity: 0;
  }

  .site-header.menu-open .brand-logo {
    --kl-navy: #f3eee4;
    --kl-shade-1: rgba(255,255,255,.22);
    --kl-shade-2: rgba(255,255,255,.13);
    --kl-shade-3: rgba(255,255,255,.05);
  }

  .site-header.menu-open .mobile-menu-btn {
    background: #f7f4ed;
  }

  .site-header.menu-open .mobile-menu-btn .bar {
    background: #161513;
  }
}


/* ---------- mobile menu overlay ---------- */

.mobile-nav {
  background: #161513;
  justify-content: center;
}

.mobile-nav-list {
  padding: 0 clamp(36px, 11vw, 72px);
}

.mobile-nav-item {
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 4px 0;
}

.mobile-nav-num {
  display: none;
}

.mobile-nav-item a {
  font-family: "Parkinsans", sans-serif;
  font-size: clamp(34px, 10.5vw, 52px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.02em;
  color: #f7f4ed;
}

.mobile-nav-item::before {
  left: -20px;
  top: calc(4px + clamp(34px, 10.5vw, 52px) * .6);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%) scale(0);
}

.mobile-nav-item.is-current::before,
.mobile-nav-item:hover::before,
.mobile-nav-item:focus-within::before {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.mobile-nav-item:hover a,
.mobile-nav-item:focus-within a {
  color: #fff;
}

.mobile-nav-sub {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  width: 100%;
  margin: 2px 0 8px;
  padding: 0;
}

.mobile-nav-sub a {
  font-family: "Figtree", sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  color: rgba(247, 244, 237, .6);
}

.mobile-nav-foot {
  justify-content: flex-start;
  gap: 18px 24px;
  padding: 0 clamp(36px, 11vw, 72px);
}

.mobile-nav-cta {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  background: #f7f4ed;
  color: #161513;
  font-family: "Parkinsans", sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.mobile-nav-social {
  position: absolute;
  left: clamp(36px, 11vw, 72px);
  right: clamp(36px, 11vw, 72px);
  bottom: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  opacity: 0;
  transition: opacity .4s ease;
}

.mobile-nav.is-open .mobile-nav-social {
  opacity: 1;
  transition-delay: .45s;
}

.mobile-nav-social a {
  color: rgba(247, 244, 237, .6);
  font-family: "Figtree", sans-serif;
  font-size: 15px;
  text-decoration: none;
  transition: color .3s ease;
}

.mobile-nav-social a:hover {
  color: #f7f4ed;
}


/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .brand-logo-full,
  .brand-logo-mark,
  .hdr-glass,
  .nav-drop {
    transition-duration: .01s !important;
  }
}
