/* Antares header — self-contained component (ax-*) with Metallic Pastel design pattern. */
.ax-header {
  --ax-h: 60px;
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(1320px, calc(100vw - 32px));
  height: var(--ax-h);
  padding: 0 8px 0 22px;
  color: #f7f5f0;
  background: rgba(18, 19, 24, 0.72);
  border: 1px solid rgba(242, 110, 80, 0.16);
  border-radius: 999px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(247, 245, 240, 0.12);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transform: translate3d(-50%, 0, 0);
  will-change: background, border-color, box-shadow;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  transition: background .3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color .3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow .3s cubic-bezier(0.16, 1, 0.3, 1);
}
.ax-header.is-scrolled {
  background: rgba(14, 15, 20, 0.88);
  border-color: rgba(242, 110, 80, 0.26);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(247, 245, 240, 0.14);
}
.ax-header a { text-decoration: none; }
.ax-brand, .ax-nav-foot a { color: inherit; }
.ax-header ul { list-style: none; margin: 0; padding: 0; }
.ax-header p { margin: 0; }

.ax-brand { display: inline-flex; align-items: center; gap: 10px; flex: none; font-size: 13px; font-weight: 800; letter-spacing: .16em; }
.ax-sigil { --logo-bg: #141316; display: inline-block; width: 28px; height: 28px; flex: none; }
.ax-sigil .ax-logo { display: block; width: 100%; height: 100%; overflow: visible; }
.ax-sigil .ax-logo-ring { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.ax-sigil .ax-logo-back { opacity: .42; }
.ax-sigil .ax-logo-gap { fill: none; stroke: var(--logo-bg); stroke-width: 4.4; stroke-linecap: round; }
.ax-sigil .ax-logo-star { fill: #F26E50; }
.ax-sigil .ax-logo-glint { fill: #F2B8A2; opacity: .75; }
.ax-sigil .ax-logo-companion { fill: #B0D1D9; }

.ax-nav { flex: 1; display: flex; justify-content: center; min-width: 0; }
.ax-menu { display: flex; align-items: center; gap: 4px; }
.ax-header .ax-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 14px;
  color: rgba(248, 246, 242, 0.82);
  background: none; border: 0; border-radius: 999px;
  font: 600 13.5px/1 inherit; font-family: inherit; white-space: nowrap; cursor: pointer;
  transition: color .2s ease, background .2s ease;
}
.ax-header .ax-link:hover, .ax-header .ax-link:focus-visible, .ax-mega.is-open .ax-link { color: #f8f6f2; background: rgba(242, 110, 80, 0.12); }
.ax-link:focus-visible, .ax-cta:focus-visible, .ax-lang:focus-visible, .ax-toggle:focus-visible { outline: 2px solid #F26E50; outline-offset: 2px; }
.ax-header .ax-link-accent { color: #F26E50; }
.ax-header .ax-link-accent:hover { color: #F2B8A2; }
.ax-link svg { width: 10px; height: 6px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform .2s ease; }
.ax-mega.is-open .ax-link svg { transform: rotate(180deg); }

.ax-actions { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.ax-lang { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: rgba(248, 246, 242, 0.75); }
.ax-lang:hover { color: #f8f6f2; background: rgba(242, 110, 80, 0.12); }
.ax-cta {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px;
  color: #141316 !important;
  background: linear-gradient(135deg, #F2B8A2 0%, #F2A74B 48%, #F26E50 100%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px; font-size: 13px; font-weight: 750; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(242, 110, 80, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: filter .2s ease, transform .2s ease, box-shadow .2s ease;
}
.ax-cta:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 12px 30px rgba(242, 110, 80, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.ax-toggle { display: none; }
.ax-nav-foot { display: none; }

/* Mega panel (desktop) */
.ax-mega { position: static; }
.ax-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 28px;
  padding: 26px;
  color: #141316;
  background: linear-gradient(145deg, #faf8f5 0%, #f1ede6 100%);
  border: 1px solid rgba(20, 19, 22, 0.1);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.ax-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.ax-mega.is-open .ax-panel { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.ax-panel-intro {
  display: flex; flex-direction: column; gap: 6px; padding: 22px; color: #f8f6f2;
  background: radial-gradient(circle at 85% 15%, rgba(242, 110, 80, 0.24), transparent 55%), #141316;
  border-radius: 16px;
}
.ax-kicker { color: #F26E50; font: 600 10.5px/1.4 "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.ax-intro-title { margin: 6px 0 14px !important; font-family: inherit; font-size: 18px; font-weight: 700; line-height: 1.35; color: #f8f6f2; letter-spacing: -0.01em; }
.ax-intro-link { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 13px; font-weight: 600; color: rgba(248, 246, 242, 0.85) !important; }
.ax-intro-link:hover { color: #F26E50 !important; }
.ax-panel-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.ax-col-title { margin-bottom: 10px !important; padding-bottom: 8px; border-bottom: 1px solid rgba(20, 19, 22, 0.1); color: #C85236; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.ax-col ul { display: grid; gap: 2px; }
.ax-col a { color: #141316; display: grid; gap: 3px; padding: 9px 10px; margin: 0 -10px; border-radius: 10px; transition: background .15s ease; }
.ax-col a:hover, .ax-col a:focus-visible { background: rgba(242, 110, 80, 0.22); outline: none; }
.ax-col b { font-size: 13.5px; font-weight: 650; line-height: 1.3; }
.ax-col span { color: rgba(20, 19, 22, 0.58); font-size: 12px; line-height: 1.4; }

@media (max-width: 1240px) {
  .ax-panel { grid-template-columns: 1fr; }
  .ax-panel-intro { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding: 14px 18px; }
  .ax-intro-title { display: none; }
  .ax-kicker { flex-basis: 100%; }
  .ax-intro-link { border: 0; padding: 4px 0; gap: 6px; }
}

/* Mobile / tablet */
@media (max-width: 1080px) {
  .ax-header { top: 10px; width: calc(100vw - 20px); height: 56px; padding: 0 6px 0 18px; }
  .ax-lang { display: none; }
  .ax-cta { height: 40px; padding: 0 16px; }
  .ax-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    height: 44px; padding: 0 16px;
    color: #f8f6f2; background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(242, 110, 80, 0.24); border-radius: 999px;
    font: 700 11px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  }
  .ax-bars { position: relative; width: 14px; height: 10px; }
  .ax-bars i { position: absolute; left: 0; width: 14px; height: 1.6px; background: currentColor; transition: transform .2s ease, top .2s ease; }
  .ax-bars i:first-child { top: 1px; }
  .ax-bars i:last-child { top: 7px; }
  .ax-header.is-open .ax-bars i:first-child { top: 4px; transform: rotate(45deg); }
  .ax-header.is-open .ax-bars i:last-child { top: 4px; transform: rotate(-45deg); }

  .ax-nav {
    position: fixed;
    top: 76px;
    left: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    max-height: calc(100dvh - 92px);
    padding: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #17161b;
    border: 1px solid rgba(242, 110, 80, 0.18);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  .ax-header.is-open .ax-nav { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .ax-menu { flex-direction: column; align-items: stretch; gap: 2px; }
  .ax-header .ax-link { width: 100%; height: 52px; justify-content: space-between; padding: 0 14px; font-size: 16px; border-radius: 14px; }
  .ax-panel {
    position: static;
    display: none;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 4px 0 8px;
    padding: 12px;
    border-radius: 16px;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .ax-panel::before { display: none; }
  .ax-mega.is-open .ax-panel { display: grid; }
  .ax-panel-intro { padding: 12px 14px; }
  .ax-panel-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .ax-col span { display: none; }
  .ax-nav-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 14px 14px 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); color: rgba(248, 246, 242, 0.6); font-size: 13px; }
}
@media (max-width: 560px) {
  .ax-cta { display: none; }
  .ax-panel-grid { grid-template-columns: 1fr; }
}
html.menu-open, body.menu-open { overflow: hidden; }
.ax-brand { gap: 0; }
.ax-wordmark .ax-word-v12 {
  display: block;
  height: 15px;
  width: auto;
  overflow: visible;
}
.ax-wordmark .ax-word-v12 .ax-word-solid {
  fill: url(#axBeamGrad);
}
.ax-wordmark .ax-word-v12 .ax-word-bridge {
  fill: url(#axDiamondGrad);
  filter: drop-shadow(0 0 4px rgba(237, 179, 181, .45));
  transform-box: view-box;
  transform-origin: 76.5px 15.8px;
  animation: ax-hdr-bridge-pulse 4.2s cubic-bezier(.4, 0, .2, 1) infinite;
  transition: transform .38s cubic-bezier(.22, 1, .36, 1), filter .38s ease, fill .38s ease;
}
.ax-brand:hover .ax-word-v12 .ax-word-bridge {
  animation: none;
  transform: translateY(-1.1px) scale(1.16);
  filter: drop-shadow(0 0 8px rgba(242, 110, 80, .85));
}
@keyframes ax-hdr-bridge-pulse {
  0%, 30%, 100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 4px rgba(237, 179, 181, .42));
  }
  62% {
    transform: translateY(-.7px) scale(1.10);
    filter: drop-shadow(0 0 7px rgba(242, 110, 80, .78));
  }
}
@media (prefers-reduced-motion: reduce) {
  .ax-wordmark .ax-word-v12 .ax-word-bridge {
    animation: none;
  }
}

/* ==========================================================================
   Theme Toggle Button & Full Light/Dark Mode for Header (ax-*)
   ========================================================================== */
.ax-theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: rgba(248, 246, 242, 0.82);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
}
.ax-theme-toggle:hover,
.ax-theme-toggle:focus-visible {
  color: #f8f6f2;
  background: rgba(242, 110, 80, 0.16);
  border-color: rgba(242, 110, 80, 0.45);
  transform: translateY(-1px);
  outline: none;
}
.ax-theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.ax-theme-toggle:hover svg {
  transform: rotate(18deg) scale(1.06);
}
/* In dark mode (default), show Sun icon to switch to Light; in light mode, show Moon icon to switch to Dark */
.ax-theme-toggle .ax-icon-moon { display: none; }
html[data-theme="light"] .ax-theme-toggle .ax-icon-sun { display: none; }
html[data-theme="light"] .ax-theme-toggle .ax-icon-moon { display: block; }

/* Light Mode Header Bar */
html[data-theme="light"] .ax-header {
  color: #121318;
  background: rgba(247, 245, 240, 0.78);
  border-color: rgba(20, 19, 24, 0.10);
  box-shadow: 0 12px 34px rgba(20, 19, 24, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}
html[data-theme="light"] .ax-header.is-scrolled {
  background: rgba(245, 243, 237, 0.88);
  border-color: rgba(242, 110, 80, 0.24);
  box-shadow: 0 16px 40px rgba(20, 19, 24, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}
html[data-theme="light"] .ax-wordmark .ax-word-v12 .ax-word-solid {
  fill: #141316;
}
html[data-theme="light"] .ax-wordmark .ax-word-v12 .ax-word-bridge {
  fill: #e04826;
  filter: drop-shadow(0 0 4px rgba(224, 72, 38, 0.35));
}
html[data-theme="light"] .ax-header .ax-link {
  color: rgba(20, 19, 24, 0.78);
}
html[data-theme="light"] .ax-header .ax-link:hover,
html[data-theme="light"] .ax-header .ax-link:focus-visible,
html[data-theme="light"] .ax-mega.is-open .ax-link {
  color: #141316;
  background: rgba(242, 110, 80, 0.14);
}
html[data-theme="light"] .ax-header .ax-link-accent {
  color: #C85236;
}
html[data-theme="light"] .ax-header .ax-link-accent:hover {
  color: #a03b22;
}
html[data-theme="light"] .ax-lang {
  color: rgba(20, 19, 24, 0.74);
}
html[data-theme="light"] .ax-lang:hover {
  color: #141316;
  background: rgba(242, 110, 80, 0.14);
}
html[data-theme="light"] .ax-theme-toggle {
  color: #141316;
  background: rgba(20, 19, 24, 0.05);
  border-color: rgba(20, 19, 24, 0.14);
}
html[data-theme="light"] .ax-theme-toggle:hover,
html[data-theme="light"] .ax-theme-toggle:focus-visible {
  color: #C85236;
  background: rgba(242, 110, 80, 0.15);
  border-color: rgba(242, 110, 80, 0.45);
}
html[data-theme="light"] .ax-toggle {
  color: #141316;
  background: rgba(20, 19, 24, 0.06);
  border-color: rgba(20, 19, 24, 0.16);
}
@media (max-width: 1080px) {
  html[data-theme="light"] .ax-nav {
    background: #faf8f5;
    border-color: rgba(20, 19, 24, 0.14);
    box-shadow: 0 28px 70px rgba(20, 19, 24, 0.18);
  }
  html[data-theme="light"] .ax-nav-foot {
    border-top-color: rgba(20, 19, 24, 0.1);
    color: rgba(20, 19, 24, 0.65);
  }
}

/* Native CSS Scroll-Driven Animation (GPU Compositor Thread) */
@supports (animation-timeline: scroll()) {
  @keyframes axHeaderScrollDark {
    to {
      background: rgba(14, 15, 20, 0.88);
      border-color: rgba(242, 110, 80, 0.26);
      box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(247, 245, 240, 0.14);
    }
  }
  @keyframes axHeaderScrollLight {
    to {
      background: rgba(245, 243, 237, 0.88);
      border-color: rgba(242, 110, 80, 0.24);
      box-shadow: 0 16px 40px rgba(20, 19, 24, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.96);
    }
  }
  .ax-header {
    animation: axHeaderScrollDark linear both;
    animation-timeline: scroll();
    animation-range: 0px 40px;
  }
  html[data-theme="light"] .ax-header {
    animation-name: axHeaderScrollLight;
  }
}

/* Mobile performance: no live blur, no scroll-timeline repaint, opaque bar. */
@media (max-width: 900px), (pointer: coarse) {
  .ax-header {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    animation: none !important;
    will-change: auto;
    background: rgba(16, 17, 22, 0.96);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    transition: border-color .2s ease;
  }
  html[data-theme="light"] .ax-header {
    background: rgba(247, 245, 240, 0.97);
    box-shadow: 0 8px 20px rgba(20, 19, 24, 0.08);
  }
}
