/* KHB Official — shared floating liquid-glass navigation */
header#hdr {
  position: fixed;
  inset: 14px 0 auto;
  z-index: 100;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

header#hdr .nav {
  position: relative;
  width: min(calc(100% - 32px), 1160px);
  height: 62px;
  margin: 0 auto;
  padding: 7px 9px 7px 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .045) 48%, rgba(240, 160, 32, .07)),
    rgba(20, 19, 58, .74);
  box-shadow:
    0 18px 48px -22px rgba(7, 6, 28, .88),
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(22px) saturate(155%);
  -webkit-backdrop-filter: blur(22px) saturate(155%);
  pointer-events: auto;
}

header#hdr .nav::before {
  content: "";
  position: absolute;
  inset: 1px 14% auto;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .38), transparent);
  pointer-events: none;
}

header#hdr .brand {
  --khb-logo-size: 46px;
  position: relative;
  gap: 10px;
  min-width: max-content;
  padding-right: 10px;
  border-radius: 999px;
}

header#hdr .brand::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 0;
  top: 50%;
  width: var(--khb-logo-size);
  height: var(--khb-logo-size);
  border-radius: 50%;
  background: linear-gradient(108deg, transparent 35%, rgba(255,255,255,.12) 43%, rgba(255,255,255,.98) 50%, rgba(247,213,138,.5) 56%, transparent 65%);
  background-size: 260% 100%;
  background-position: 155% 50%;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) rotate(8deg);
  mix-blend-mode: screen;
  animation: khbLogoShimmer 9s cubic-bezier(.22,1,.36,1) infinite;
}

header#hdr .logo-chip {
  width: 46px;
  height: 46px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 22px -11px rgba(240, 160, 32, .8);
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform, filter;
  animation: khbLogoFlip 9s cubic-bezier(.22,1,.36,1) infinite;
}

header#hdr .brand b {
  position: relative;
  display: inline-block;
  font-family: "Quicksand", "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.035em;
  white-space: nowrap;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.08));
}

header#hdr .brand b::after { content: none; }

@keyframes khbLogoFlip {
  0%, 42% { transform: perspective(620px) rotateY(0deg); filter: brightness(1) saturate(1); }
  70% { transform: perspective(620px) rotateY(360deg); filter: brightness(1) saturate(1); }
  78% { transform: perspective(620px) rotateY(360deg); filter: brightness(1.1) saturate(1.04) drop-shadow(0 0 6px rgba(247,213,138,.34)); }
  94%, 100% { transform: perspective(620px) rotateY(360deg); filter: brightness(1) saturate(1); }
}

@keyframes khbLogoShimmer {
  0%, 70% { opacity: 0; background-position: 155% 50%; }
  72% { opacity: 0; background-position: 155% 50%; }
  78% { opacity: .9; }
  93% { opacity: .76; }
  99%, 100% { opacity: 0; background-position: -55% 50%; }
}

header#hdr .nav-links {
  gap: 7px;
  margin-left: auto;
  padding-left: 14px;
  overflow: visible;
}

header#hdr .nav-links a {
  position: relative;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(255, 255, 255, .72);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
}

header#hdr .nav-links a:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .09);
  transform: translateY(-1px);
}

header#hdr .nav-links a.active {
  color: #17153d;
  border-color: rgba(255, 223, 157, .7);
  background: linear-gradient(135deg, #f7d58a, #f0a020);
  box-shadow: 0 8px 22px -12px rgba(240, 160, 32, .95), inset 0 1px 0 rgba(255, 255, 255, .55);
}

header#hdr .hamb {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(255, 255, 255, .075);
  transition: background .25s ease, border-color .25s ease, transform .25s ease;
}

header#hdr .hamb span {
  position: absolute;
  width: 19px;
  height: 1.5px;
  border-radius: 99px;
  transform-origin: center;
  transition: transform .36s cubic-bezier(.22, 1, .36, 1), opacity .2s ease, width .3s ease;
}

header#hdr .hamb span:nth-child(1) { transform: translateY(-6px); }
header#hdr .hamb span:nth-child(2) { transform: translateY(0); }
header#hdr .hamb span:nth-child(3) { width: 13px; transform: translate(3px, 6px); }

@media (max-width: 1080px) {
  header#hdr { top: 10px; }

  header#hdr .nav {
    width: calc(100% - 24px);
    height: 60px;
    padding: 7px 8px;
    background:
      linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.055) 48%, rgba(240,160,32,.08)),
      rgba(20,19,58,.78);
    backdrop-filter: blur(30px) saturate(165%);
    -webkit-backdrop-filter: blur(30px) saturate(165%);
  }

  header#hdr .brand { --khb-logo-size: 44px; }
  header#hdr .logo-chip { width: 44px; height: 44px; }
  header#hdr .brand b { font-size: 1.03rem; }

  header#hdr .hamb { display: flex; margin-left: auto; }

  header#hdr .nav-links {
    position: fixed;
    top: 72px;
    right: 0;
    left: auto;
    width: min(340px, calc(100vw - 24px));
    max-height: calc(100dvh - 96px);
    gap: 4px;
    margin: 0;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 24px;
    background:
      radial-gradient(circle at 18% 0%, rgba(139,137,214,.2), transparent 42%),
      linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.025) 48%, rgba(240,160,32,.045)),
      #1b1949;
    box-shadow:0 34px 80px -24px rgba(7,6,28,.98),inset 0 1px 0 rgba(255,255,255,.25),inset 0 -1px 0 rgba(255,255,255,.06);
    backdrop-filter: blur(42px) saturate(165%);
    -webkit-backdrop-filter: blur(42px) saturate(165%);
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(100% + 28px)) scale(.97);
    transform-origin: top right;
    transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .22s ease;
  }

  header#hdr .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
  }

  header#hdr .nav-links::before {
    content: "";
    position: absolute;
    inset: 1px 12% auto;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg,transparent,rgba(255,255,255,.48),transparent);
    pointer-events: none;
  }

  header#hdr .nav-links a {
    width: 100%;
    padding: 12px 15px;
    border-radius: 14px;
    font-size: .84rem;
    color: rgba(255,255,255,.84);
    opacity: 0;
    transform: translateX(18px);
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .35s cubic-bezier(.22, 1, .36, 1), opacity .28s ease;
  }

  header#hdr .nav-links a:hover {
    border-color: rgba(255,255,255,.14);
    background: rgba(255,255,255,.09);
  }

  header#hdr .nav-links a.active {
    border-color: rgba(255,226,166,.72);
    background: linear-gradient(135deg,#f9d77f,#f0a020);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65),0 13px 28px -16px rgba(240,160,32,.95);
  }

  header#hdr .nav-links.open a { opacity: 1; transform: translateX(0); }
  header#hdr .nav-links.open a:nth-child(2) { transition-delay: .025s; }
  header#hdr .nav-links.open a:nth-child(3) { transition-delay: .05s; }
  header#hdr .nav-links.open a:nth-child(4) { transition-delay: .075s; }
  header#hdr .nav-links.open a:nth-child(5) { transition-delay: .1s; }
  header#hdr .nav-links.open a:nth-child(6) { transition-delay: .125s; }
  header#hdr .nav-links.open a:nth-child(7) { transition-delay: .15s; }
  header#hdr .nav-links.open a:nth-child(8) { transition-delay: .175s; }
  header#hdr .nav-links.open a:nth-child(9) { transition-delay: .2s; }

  header#hdr .nav:has(.nav-links.open) .hamb {
    border-color: rgba(240, 160, 32, .44);
    background: rgba(240, 160, 32, .15);
    transform: rotate(90deg);
  }

  header#hdr .nav:has(.nav-links.open) .hamb span:nth-child(1) { transform: rotate(45deg); }
  header#hdr .nav:has(.nav-links.open) .hamb span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  header#hdr .nav:has(.nav-links.open) .hamb span:nth-child(3) { width: 19px; transform: rotate(-45deg); }
}

@media (max-width: 420px) {
  header#hdr .nav { width: calc(100% - 18px); }
  header#hdr .nav-links { width: calc(100vw - 18px); }
}

@media (prefers-reduced-motion: reduce) {
  header#hdr *, header#hdr *::before, header#hdr *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
