/* css/nav.css — header, mega menu, mobile nav, sticky mobile CTA */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--color-border-subtle);
}
/* The translucent blur lives on a decorative ::before rather than directly on .site-header,
   because backdrop-filter on an ancestor establishes a new containing block for any
   position:fixed descendant (like the mobile nav panel below) — that silently shrank the
   full-screen mobile menu down to the header's own height, letting page content show through. */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(10, 13, 20, 0.86);
  backdrop-filter: blur(10px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding-block: 1rem;
  min-height: var(--header-height);
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text-primary);
  flex-shrink: 0;
}
.logo-dot { color: var(--color-sapphire-400); }

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-primary);
  transition: transform 200ms ease-out, opacity 200ms ease-out;
}
.nav-toggle-bar::before { transform: translateY(-6px); }
.nav-toggle-bar::after { transform: translateY(4px); }
body.nav-open .nav-toggle-bar { background: transparent; }
body.nav-open .nav-toggle-bar::before { transform: translateY(0) rotate(45deg); background: var(--color-text-primary); }
body.nav-open .nav-toggle-bar::after { transform: translateY(-2px) rotate(-45deg); background: var(--color-text-primary); }

.nav-collapse {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: fixed;
  inset: var(--header-height) 0 0 0;
  background: var(--color-bg-primary);
  padding: var(--space-8) 1.5rem;
  overflow-y: auto;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
body.nav-open .nav-collapse {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.mega-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.mega-menu > li > details > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 0.25rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mega-menu > li > details > summary::-webkit-details-marker { display: none; }
.mega-menu > li > details > summary::after {
  content: '+';
  color: var(--color-sapphire-400);
  font-weight: 400;
}
.mega-menu > li > details[open] > summary::after { content: '\2212'; }

/* Plain text menu item (Contact Us), styled like the Services label; blue glow while pressed and on its own page. */
.mega-menu__link {
  display: flex;
  align-items: center;
  padding: 0.85rem 0.25rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: color 200ms ease-out, text-shadow 200ms ease-out;
}
.mega-menu__link:hover { color: var(--color-sapphire-400); }
.mega-menu__link:focus-visible { outline: 2px solid var(--color-sapphire-400); outline-offset: 2px; border-radius: 4px; }
.mega-menu__link:active,
.mega-menu__link[aria-current="page"] {
  color: var(--color-sapphire-400);
  text-shadow: 0 0 6px rgb(59 130 246 / 0.85), 0 0 16px rgb(59 130 246 / 0.55);
}

.mega-panel {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) 0.25rem var(--space-6);
}
.mega-panel a {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}
.mega-panel a:hover,
.mega-panel a:focus-visible { background: var(--color-bg-surface); color: var(--color-text-primary); }

.nav-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: auto;
  padding-top: var(--space-6);
}

/* Fixed bottom-right controls share the corner with the OmniChat bubble (chat.softsapien.com/widget.js):
   a 60px launcher, 20px from the bottom/right edges (14px at <=480px). The widget itself is left untouched;
   these offsets keep the CTA bar to the left of the bubble and stack back-to-top directly above it. */
:root {
  --chat-edge: 20px;
  --chat-size: 60px;
}
@media (max-width: 480px) {
  :root { --chat-edge: 14px; }
}

.sticky-mobile-cta {
  position: fixed;
  left: 1rem; bottom: 1rem;
  right: calc(var(--chat-edge) + var(--chat-size) + 0.75rem);
  z-index: 90;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.sticky-mobile-cta.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.sticky-mobile-cta .cta { width: 100%; }

.back-to-top {
  position: fixed;
  /* centred over the chat bubble, 12px above it */
  right: calc(var(--chat-edge) + (var(--chat-size) - 2.75rem) / 2);
  bottom: calc(var(--chat-edge) + var(--chat-size) + 0.75rem);
  z-index: 91;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-sapphire-500);
  color: #fff;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out, background 150ms ease;
}
.back-to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:hover { background: var(--color-sapphire-400); }
.back-to-top svg { width: 1.15rem; height: 1.15rem; }

/* Desktop layout */
@media (min-width: 1024px) {
  .nav-toggle { display: none; }

  .nav-collapse {
    position: static;
    flex-direction: row;
    align-items: center;
    background: none;
    padding: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    inset: auto;
    overflow: visible;
  }

  .mega-menu {
    flex-direction: row;
    gap: var(--space-8);
    position: relative;
  }
  .mega-menu > li > details > summary,
  .mega-menu__link {
    border-bottom: none;
    padding: 0.5rem 0;
  }
  .mega-menu > li > details[open] > summary::after,
  .mega-menu > li > details > summary::after { content: ''; }
  .mega-panel {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 0;
    min-width: 16rem;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-4);
  }

  .nav-actions {
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    margin-top: 0;
    padding-top: 0;
  }

  .sticky-mobile-cta { display: none; }
}

/* Language menu (includes/lang-switch.php), last item in the header actions. Native <details>, works without JS. */
.lang-switch { position: relative; }
.lang-switch__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.lang-switch__toggle::-webkit-details-marker { display: none; }
.lang-switch__toggle:hover,
.lang-switch[open] .lang-switch__toggle { color: var(--color-text-primary); border-color: var(--color-slate-600); }
.lang-switch__toggle:focus-visible { outline: 2px solid var(--color-sapphire-400); outline-offset: 2px; }
.lang-switch__icon { flex: none; }
.lang-switch__menu {
  position: absolute;
  z-index: 60;
  min-width: 12rem;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.lang-switch--header .lang-switch__menu { top: calc(100% + 0.5rem); left: 0; }
.lang-switch__menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}
.lang-switch__menu a:hover,
.lang-switch__menu a:focus-visible { background: var(--color-bg-surface-2); color: var(--color-text-primary); }
.lang-switch__menu a[aria-current="true"] { color: var(--color-text-primary); font-weight: 600; }
.lang-switch__menu a[aria-current="true"]::after { content: ' \2713'; color: var(--color-sapphire-400); }

@media (min-width: 1024px) {
  .lang-switch--header .lang-switch__menu { left: auto; right: 0; }
}

/* Language prompt (js/locale-prompt.js): a modal <dialog> in the middle of the screen offering the visitor's
   language. A light card over a dimmed page, as Adobe, IBM and Dell do, so it stands apart from the dark
   site instead of blending into it. */
.locale-prompt {
  width: min(34rem, calc(100% - 2rem));
  max-width: none;
  margin: auto;
  padding: var(--space-8) var(--space-8) var(--space-6);
  border: 0;
  border-radius: var(--radius-xl);
  background: #FFFFFF;
  color: #0B1220;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  text-align: left;
}
.locale-prompt::backdrop { background: rgba(5, 8, 14, 0.78); }
.locale-prompt__title {
  margin: 0;
  padding-right: var(--space-8);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: #0B1220;
}
.locale-prompt [lang="ja"] { word-break: auto-phrase; } /* Japanese: break between phrases, not inside them */
.locale-prompt__body { margin: var(--space-3) 0 0; font-size: 0.98rem; line-height: 1.55; color: #334155; }
.locale-prompt__also {
  margin: var(--space-4) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid #E2E8F0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #64748B;
}
.locale-prompt__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.locale-prompt__go,
.locale-prompt__stay {
  flex: 1 1 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.locale-prompt__go { background: var(--color-sapphire-500); border: 1px solid var(--color-sapphire-500); color: #FFFFFF; }
.locale-prompt__go:hover { background: #1D4ED8; border-color: #1D4ED8; }
.locale-prompt__stay { background: #FFFFFF; border: 1px solid #CBD5E1; color: #0B1220; }
.locale-prompt__stay:hover { background: #F1F5F9; border-color: #94A3B8; }
.locale-prompt__go:focus-visible,
.locale-prompt__stay:focus-visible,
.locale-prompt__close:focus-visible { outline: 2px solid var(--color-sapphire-500); outline-offset: 2px; }
.locale-prompt__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #475569;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.locale-prompt__close:hover { background: #F1F5F9; color: #0B1220; }
@media (max-width: 480px) {
  .locale-prompt { padding: var(--space-6) var(--space-6) var(--space-6); }
  .locale-prompt__go, .locale-prompt__stay { white-space: normal; flex-basis: 100%; }
  .locale-prompt__title { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .locale-prompt[open] { animation: locale-prompt-in 220ms ease-out; }
  .locale-prompt[open]::backdrop { animation: locale-prompt-fade 220ms ease-out; }
  @keyframes locale-prompt-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
  @keyframes locale-prompt-fade { from { opacity: 0; } to { opacity: 1; } }
}
