/* =================================================================
   Custom Header v1.2.0 — Faithful to Figma design
   Hangar 3: figma.com/design/5T4RBvHnWmhzi7vpdk28yj
================================================================= */

/* -----------------------------------------------------------------
   DIVI CONTAINER RESET
----------------------------------------------------------------- */
.et_pb_text_inner { overflow: visible !important; }
.et_pb_text_inner:has(#ch-header),
.et_pb_module:has(#ch-header) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
}
#main-header, .et-fixed-header { display: none !important; }

/* Remove Divi top spacing that creates the white gap under the header */
#page-container,
#et-main-area,
#main-content,
.et_pb_section:first-of-type {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
body.et-tb-has-header #page-container,
body.et-tb-has-template #page-container,
body #et-boc {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* -----------------------------------------------------------------
   RESET
----------------------------------------------------------------- */
.ch-header *, .ch-panel *, .ch-overlay { box-sizing: border-box; }

/* -----------------------------------------------------------------
   HEADER
   - Transparent by default, frosted on scroll
   - Height: 80px desktop / 60px mobile
----------------------------------------------------------------- */
.ch-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 80px;
  z-index: 9000;
  font-family: var(--ch-font, 'Outfit', sans-serif);
}

/* Frosted bg layer — translateY trick from Figma */
.ch-header-bg {
  position: absolute; inset: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 0;
}
.ch-header.is-scrolled .ch-header-bg {
  opacity: 1;
  transform: translateY(0);
}

/* Inner layout — positioning context only, children are absolute */
.ch-inner {
  position: relative; z-index: 1;
  height: 100%;
  padding: 0 30px;
}

/* -----------------------------------------------------------------
   LOGO
   Figma: 175×44px, left 30px, top 18px
   Two images: default (white) + sticky (dark)
----------------------------------------------------------------- */
.ch-logo {
  display: block;
  width: 175px;
  height: 44px;
  position: absolute;                 /* Figma: left:30px top:18px */
  left: 30px;
  top: 18px;
  text-decoration: none;
}

.ch-logo-default,
.ch-logo-sticky {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: left center;
  transition: opacity 0.3s ease;
}

/* Default (white) visible when NOT scrolled */
.ch-logo-default { opacity: 1; }
.ch-header.is-scrolled .ch-logo-default { opacity: 0; }

/* Sticky (dark/green) visible when scrolled */
.ch-logo-sticky { opacity: 0; }
.ch-header.is-scrolled .ch-logo-sticky { opacity: 1; }

/* Fallback text */
.ch-logo-text {
  display: flex; align-items: center;
  height: 100%;
  font-weight: 700; font-size: 16px; letter-spacing: 0.04em;
  color: #fff;
  transition: color 0.3s;
}
.ch-header.is-scrolled .ch-logo-text { color: #61652F; }

/* -----------------------------------------------------------------
   RIGHT GROUP
   Figma: nav links + burger + lang pill, all in one row
----------------------------------------------------------------- */
/* Right group — absolutely positioned at top:20px, matching Figma exactly */
.ch-right {
  position: absolute;
  top: 20px;
  right: 30px;
  display: flex;
  align-items: center;
  gap: 40px;
  z-index: 2;
}

/* Phantom spacer — reserves 40px for the absolute pill so nav+burger don't overlap it */
.ch-right::after {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  pointer-events: none;
}

/* -----------------------------------------------------------------
   DESKTOP NAV LINKS
   Figma: Outfit Medium 16px, white, no underline
----------------------------------------------------------------- */
.ch-nav {
  display: flex;
  align-items: center;
  gap: 0; /* links are spaced 91px apart in Figma — use inline gap */
}

.ch-nav-link {
  font-family: var(--ch-font, 'Outfit', sans-serif);
  font-weight: 500;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  padding: 4px 0;
  margin-right: 50px; /* approximate Figma spacing */
  transition: opacity 0.2s;
  white-space: nowrap;
}
.ch-nav-link:last-child { margin-right: 0; }
.ch-nav-link:hover { opacity: 0.75; }
.ch-header.is-scrolled .ch-nav-link { color: #2a2a2a; }
.ch-header.is-scrolled .ch-nav-link:hover { color: #61652F; }

/* -----------------------------------------------------------------
   BURGER BUTTON
   Figma: 20×14px icon inside 40×40px area
----------------------------------------------------------------- */
.ch-burger {
  width: 40px; height: 40px;
  background: transparent; border: none; padding: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.ch-burger-icon {
  display: flex; flex-direction: column;
  gap: 5px; width: 20px;
}

.ch-burger-icon span {
  display: block;
  width: 100%; height: 2px;
  background: #fff;
  border-radius: 1px;
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

.ch-header.is-scrolled .ch-burger-icon span { background: #2a2a2a; }

/* X state — panel open */
.ch-burger.is-open .ch-burger-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ch-burger.is-open .ch-burger-icon span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.ch-burger.is-open .ch-burger-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* When panel is open, burger in header shows X in white (on #61652F overlay) */
.ch-header.panel-open .ch-burger-icon span { background: #fff; }

/* -----------------------------------------------------------------
   LANGUAGE PILL
   
   The pill is position:absolute on the HEADER, anchored to top:20px right:30px.
   This means it NEVER participates in any flexbox layout, so opening it
   cannot push or pull any other element. It simply grows downward from its
   fixed anchor point.
   
   .ch-lang          — absolute pill shell (border, radius, overflow, height anim)
   .ch-lang-current  — top 40px: the button
   .ch-lang-options  — below: the other lang options, revealed by height grow
----------------------------------------------------------------- */

/* Remove lang from flex flow entirely */
.ch-lang {
  position: absolute;
  top: 0;         /* top of .ch-right which is already at top:20px of header */
  right: 0;       /* right of .ch-right which is already at right:30px of header */
  z-index: 10;
  width: 40px;
  height: 40px;   /* JS animates this */
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transition: height 0.25s ease, background 0.25s ease;
  background: transparent;
  cursor: pointer;
}

.ch-lang.is-open {
  background: rgba(255, 255, 255, 0.33);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.ch-header.is-scrolled .ch-lang {
  border-color: rgba(97, 101, 47, 0.5);
}
.ch-header.is-scrolled .ch-lang.is-open {
  background: rgba(97, 101, 47, 0.12);
}

/* Button — top 40px slot */
.ch-lang-current {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.ch-lang-active {
  font-family: var(--ch-font, 'Outfit', sans-serif);
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  line-height: 1;
  text-align: center;
  display: block;
  pointer-events: none;
  transition: color 0.25s;
}
.ch-header.is-scrolled .ch-lang-active { color: #61652F; }

/* Options — below button, clipped by overflow:hidden until height grows */
.ch-lang-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 12px;            /* Figma: 12px between items (item tops at y:0,30,60 → 30-18=12px) */
  padding: 0 0 10px;    /* Figma: 10px bottom padding */
}

.ch-lang-opt {
  font-family: var(--ch-font, 'Outfit', sans-serif);
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  text-decoration: none;
  text-align: center;
  width: 100%;
  height: 18px;          /* Figma: text height = 18px */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.ch-lang-opt:hover { opacity: 0.7; }
.ch-header.is-scrolled .ch-lang-opt { color: #61652F; }

/* ── PANEL SWITCHER ──
   Inside panel, the pill is a normal flex child of .ch-panel-bar.
   Use the same pill styles but positioned statically (not absolute).
   align-self:flex-start + margin-top:20px centres it and anchors growth downward. */
.ch-panel-lang-wrap {
  /* Full reset of .ch-lang absolute positioning */
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  /* Sit at top of panel-bar flex row, grow downward */
  align-self: flex-start;
  margin-top: 20px;
  /* Start at 40px — JS will animate height on open */
  height: 40px;
  /* Always white border (on green panel bg) */
  border-color: rgba(255, 255, 255, 0.7) !important;
  /* Transparent background when closed — no blur */
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  flex-shrink: 0;
  z-index: 100;
}
.ch-panel-lang-wrap.is-open {
  background: rgba(255, 255, 255, 0.33) !important;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* All text in panel pill is always white */
.ch-panel-lang-wrap .ch-lang-active,
.ch-panel-lang-wrap .ch-lang-opt { color: #fff !important; }

/* -----------------------------------------------------------------
   OVERLAY
   Figma sidebar-open: left side has rgba(0,0,0,0.6) backdrop
----------------------------------------------------------------- */
.ch-overlay {
  position: fixed; inset: 0;
  background: transparent;
  z-index: 9050;    /* above header (9000) so it covers it when panel opens */
  pointer-events: none;
  transition: background 0.35s ease;
}
.ch-overlay.is-active {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter:blur(5px);
  pointer-events: auto;
}

/* -----------------------------------------------------------------
   PANEL
   Desktop: sidebar from right (width ~438/1280 = ~34% of viewport)
   Mobile: fullscreen, background #61652F
   Figma: bg #61652F, text white
----------------------------------------------------------------- */
.ch-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  background: #61652F;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--ch-font, 'Outfit', sans-serif);
  overflow: visible;   /* pill in panel-bar must be able to grow downward */
}

.ch-panel { display: none; }
.ch-panel.is-ready { display: flex; }
.ch-panel.is-open { transform: translateX(0); }

/* Panel top bar — X left, lang pill right */
.ch-panel-bar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  overflow: visible;   /* pill grows below bar */
}

/* Close button (X) — margin-top centres it in the 80px bar */
.ch-panel-close {
  width: 40px; height: 40px;
  background: transparent; border: none; padding: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.ch-panel-close:hover { opacity: 0.7; }

/* Lang pill in panel — same style but always white */


/* Nav links */
/* Ensure panel lang options are always visible white text */
.ch-panel .ch-lang-options { color: #fff !important; }
.ch-panel .ch-lang-opt {
  color: #fff !important;
  opacity: 1 !important;
}

.ch-panel-nav {
  flex: 1;
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;   /* below panel-bar z-index:10 and lang wrap z-index:100 */
}

.ch-panel-link {
  font-family: var(--ch-font, 'Outfit', sans-serif);
  font-weight: 500;
  font-size: 20px;
  color: #fff;
  text-decoration: none;
  padding: 12px 0;
  display: block;
  transition: opacity 0.15s;
}
.ch-panel-link:hover { opacity: 0.75; }

/* Footer CTA */
.ch-panel-footer {
  padding: 24px;
  flex-shrink: 0;
}

.ch-panel-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 25px;
  font-family: var(--ch-font, 'Outfit', sans-serif);
  font-weight: 500; font-size: 16px;
  color: #fff;
  text-decoration: none;
  border: 1px solid #fff;
  border-radius: 5px;
  background: #61652F;
  transition: background 0.2s, color 0.2s;
}
.ch-panel-cta:hover {
  background: rgba(255,255,255,0.1);
}

/* =================================================================
   RESPONSIVE
================================================================= */

/* Hide desktop nav on tablet */
@media (max-width: 1023px) {
  .ch-nav { display: none; }
  .ch-right { gap: 20px; }
}

/* Mobile — ch-right repositions to fit 60px header, burger left, lang right */
@media (max-width: 767px) {
  .ch-header { height: 60px; }
  .ch-panel { width: 100%; }
  .ch-panel-bar { height: 60px; }
  .ch-panel-lang-wrap { margin-top: 10px; }  /* (60px - 40px) / 2 */

  /* Logo: centred absolutely */
  .ch-logo {
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    width: 140px; height: 35px;
  }

  /* Right group: only lang pill remains on the right */
  .ch-right {
    top: 10px;    /* (60px - 40px) / 2 */
    right: 16px;
    gap: 0;
  }

  .ch-nav { display: none; }

  /* Burger: escape ch-right, anchor to LEFT of the header itself */
  .ch-burger {
    position: fixed;   /* fixed so it's relative to viewport, not ch-right */
    left: 16px;
    top: 10px;
    z-index: 9001;     /* above header (9000) */
  }

  /* Hide burger from ch-right flex flow on mobile — it's now fixed-positioned */
  /* ch-right on mobile only shows the ::after spacer and the lang pill */
  .ch-right::after { display: none; }  /* no spacer needed — nav is hidden */
}
