/* ═══════════════════════════════════════════════════════
   Crestix Universal Navbar — Self-contained styles
   ※ グローバルCSSと衝突しないよう cx- プレフィックス統一
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────── */
#cx-navbar *,
#cx-navbar *::before,
#cx-navbar *::after {
  box-sizing: border-box;
}

/* ── Navbar Shell ─────────────────────────────────────── */
#cx-navbar {
  /*
    Header logo size controls
    ここだけ変更すれば、ヘッダーロゴの高さを調整できます。
    - PC: 1024px以上
    - SP: 768px以下
    例: PCを大きくするなら --cx-nav-logo-height-pc: 52px;
  */
  --cx-nav-logo-height-pc: 100px;
  --cx-nav-logo-height-mobile: 100px;
  --cx-nav-logo-height: var(--cx-nav-logo-height-mobile);
  --cx-mega-offset: 8px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  height: 90px;                         /* ← 全ページ共通の高さ基準 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  transition:
    background 0.35s ease,
    backdrop-filter 0.35s ease,
    border-color 0.35s ease,
    transform 0.45s cubic-bezier(0.76,0,0.24,1);
  will-change: transform;
}

/* Scrolled state (added by JS) */
#cx-navbar.cx-scrolled {
  background: rgba(10,15,30,0.85);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-color: rgba(255,255,255,0.08);
}

/* Hidden (smart hide on scroll down) */
#cx-navbar.cx-hidden {
  transform: translateY(-110%);
}

/* ── Logo ─────────────────────────────────────────────── */
.cx-nav-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cx-nav-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}
#cx-nav-logo {
  height: var(--cx-nav-logo-height);
  width: auto;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
  transition: transform 0.3s ease;
}
.cx-nav-logo-link:hover #cx-nav-logo {
  transform: scale(1.05);
}

/* ── Center nav ───────────────────────────────────────── */
.cx-nav-center {
  display: flex;
  align-items: center;        /* ← Y軸統一 */
  gap: 2rem;
  height: 64px;               /* ← 親と同じ高さ */
}

/* ── Nav Links ────────────────────────────────────────── */
.cx-nav-link {
  /* Y軸完全統一 */
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0;
  margin: 0;
  line-height: 1;

  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255,255,255,0.80);
  white-space: nowrap;
  transition: color 0.2s ease;
  position: relative;
}
.cx-nav-link:hover {
  color: #ffffff;
}

/* Active underline */
.cx-nav-link.cx-active {
  color: #ffffff;
}
.cx-nav-link.cx-active::after {
  content: '';
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  height: 2px;
  background: #FF5C00;
  border-radius: 2px;
}

/* ── Mega Menu Trigger ────────────────────────────────── */
.cx-mega-trigger {
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
}

/* ── Mega Menu Dropdown ───────────────────────────────── */
.cx-mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 320px;
  background: rgba(10,15,30,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 16px 0;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.20s ease,
    transform 0.20s cubic-bezier(0.16,1,0.3,1);
  z-index: 600;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

/* Arrow */

    /* Bridge the hover gap */
    .cx-mega-menu::after {
      content: "";
      position: absolute;
      top: -24px;
      left: 0;
      right: 0;
      height: 24px;
      background: transparent;
    }

    .cx-mega-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  clip-path: polygon(50% 0%,0% 100%,100% 100%);
  background: rgba(255,255,255,0.10);
}

/* Show on trigger hover */
.cx-mega-trigger:hover .cx-mega-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cx-mega-label {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #FF5C00;
  padding: 6px 20px 4px;
  display: block;
}
.cx-mega-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.60);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.cx-mega-menu a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.06);
}
.cx-mega-menu a i {
  font-size: 8px;
  color: rgba(255,92,0,0.55);
  flex-shrink: 0;
}
.cx-mega-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 6px 16px;
}

/* ── Mega Menu Desktop Redesign (>= 1024px) ───────────── */
@media (min-width: 1024px) {
  /* Remove position:relative so menu anchors to #cx-navbar, not the trigger */
  .cx-mega-trigger {
    position: static;
  }

  /* Outer wrapper: transparent hit area, anchored to navbar */
  .cx-mega-menu {
    position: absolute;
    top: calc(100% + var(--cx-mega-offset));
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    min-width: unset;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0 0 16px 16px;
    border: none;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.18);
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 0.28s ease,
      transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 600;
  }

  /* Show on trigger hover */
  .cx-mega-trigger:hover .cx-mega-menu {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  /* Bridge gap to prevent hover loss when moving from nav to panel */
  .cx-mega-menu::after {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
  }

  /* Hide small top arrow */
  .cx-mega-menu::before {
    display: none;
  }

  /* ── Panel — white floating card ────────────────────── */
  .cx-mega-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 3rem;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 44px;
    box-sizing: border-box;
    color: #111827;
  }

  /* ── Title block — centered ─────────────────────────── */
  .cx-mega-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .cx-mega-title {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(44px, 4vw, 64px);
    font-weight: 900;
    color: #111827;
    margin: 0;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    line-height: 1;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
    text-align: center;
  }

  /* Orange accent line under title */
  .cx-mega-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 3px;
    background: #FF5C00;
    border-radius: 2px;
  }

  /* Japanese subtitle */
  .cx-mega-subtitle {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: rgba(17, 24, 39, 0.55);
    margin: 0;
    text-align: center;
    letter-spacing: 0.12em;
  }

  /* ── Link grid — 3 columns ──────────────────────────── */
  .cx-mega-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 48px;
    width: 100%;
  }

  /* MEMBERS mega menu: centered content-width links */
  #mega-members .cx-mega-grid {
    display: flex;
    justify-content: center;
    gap: 48px;
  }

  #mega-members .cx-mega-item {
    flex: 0 0 auto;
    width: 260px;
    min-width: 260px;
    color: #111827;
    justify-content: space-between;
  }

  #mega-members .cx-mega-item > span {
    display: block;
    flex: 0 1 auto;
    width: auto;
    min-width: max-content;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    color: currentColor;
    opacity: 1;
    visibility: visible;
    font-size: 15px;
    line-height: 1.4;
  }

  /* Discard old group wrappers */
  .cx-mega-group {
    display: contents;
  }
  .cx-mega-group-label {
    display: none;
  }

  /* ── Flat link rows ─────────────────────────────────── */
  .cx-mega-menu a.cx-mega-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 68px;
    padding: 22px 8px;
    background: transparent;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(17, 24, 39, 0.12);
    color: #111827;
    font-family: 'Noto Sans JP', 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    text-align: left;
    box-sizing: border-box;
    transition: color 0.18s ease;
    transform: none;
    box-shadow: none;
  }

  .cx-mega-menu a.cx-mega-item:hover {
    color: #FF5C00;
    background: none;
    border-color: rgba(17, 24, 39, 0.12);
    transform: none;
    box-shadow: none;
  }

  .cx-mega-menu a.cx-mega-item span {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Arrow icon */
  .cx-mega-menu a.cx-mega-item .cx-mega-arrow {
    font-size: 13px;
    color: #FF5C00;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    margin-left: 14px;
    margin-bottom: 0;
  }

  .cx-mega-menu a.cx-mega-item:hover .cx-mega-arrow {
    transform: translateX(6px);
  }

  /* ── SERVICE mega menu inner layout ───────────────────── */
  .mega-service {
    width: 100%;
    padding: 8px 0 24px;
  }

  .mega-service__overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
  }

  .cx-mega-menu a.mega-service__overview-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: auto;
    padding: 12px 0;
    border: none;
    color: #0A1E3C;
    background: transparent;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
  }

  .cx-mega-menu a.mega-service__overview-link:hover {
    color: #FF5C00;
    background: transparent;
  }

  .mega-service__arrow {
    color: #FF5C00;
    font-size: 18px;
    line-height: 1;
  }

  .mega-service__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: 100%;
  }

  .cx-mega-menu a.mega-service__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 16px 24px;
    border: none;
    color: #0A1E3C;
    background: transparent;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
  }

  .cx-mega-menu a.mega-service__item:hover {
    color: #FF5C00;
    background: rgba(255, 92, 0, 0.04);
  }

  .mega-service__item-label {
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .mega-service__item-arrow {
    color: #FF5C00;
    font-size: 16px;
    flex-shrink: 0;
    margin-left: 12px;
    transition: transform 0.25s ease;
  }

  .cx-mega-menu a.mega-service__item:hover .mega-service__item-arrow {
    transform: translateX(6px);
  }

  /* Legacy sub-elements not used in new HTML */
  .cx-mega-item-body,
  .cx-mega-item-title,
  .cx-mega-item-desc {
    display: none;
  }

  .cx-mega-badge { display: none; }
  .cx-mega-item.cx-mega-disabled { display: none; }
}

/* ── Mega Menu: mobile/tablet never shows ─────────────── */
@media (max-width: 1023px) {
  .cx-mega-menu {
    display: none !important;
  }
}

/* ── Right side ───────────────────────────────────────── */
.cx-nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* Entry CTA button */
.cx-nav-entry-btn {
  display: none; /* mobile: hidden */
  align-items: center;
  background: #FF5C00;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.65rem 1.75rem;
  border-radius: 9999px;
  box-shadow: none;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.cx-nav-entry-btn:hover {
  background: #E65200;
  transform: translateY(-1px);
  box-shadow: none;
}
.cx-nav-entry-btn:active {
  transform: scale(0.97);
}
@media (min-width: 1024px) {
  .cx-nav-entry-btn { display: inline-flex; }
}

/* ── PC header sizing ─────────────────────────────────── */
@media (min-width: 1024px) {
  #cx-navbar {
    --cx-nav-logo-height: var(--cx-nav-logo-height-pc);
    --cx-mega-offset: 10px;
    height: 86px;
    min-height: 86px;
    padding: 0 1.5rem;
  }
  #cx-nav-logo {
    height: var(--cx-nav-logo-height);
    width: auto;
  }
  .cx-nav-center {
    height: 86px;
    gap: clamp(28px, 3vw, 48px);
  }
  .cx-nav-link {
    height: 86px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }
  .cx-nav-link.cx-active::after {
    bottom: 18px;
  }
  .cx-mega-trigger {
    height: 86px;
  }
  .cx-nav-entry-btn {
    font-size: 13px;
    padding: 13px 26px;
  }
}

@media (min-width: 1921px) {
  #cx-navbar {
    padding-left: calc((100vw - 1920px) / 2 + 1.5rem);
    padding-right: calc((100vw - 1920px) / 2 + 1.5rem);
  }
}

/* Hamburger button */
#cx-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  gap: 0;
}
@media (min-width: 1024px) {
  #cx-hamburger { display: none; }
}
.cx-ham-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 16px;
}
.cx-ham-lines span {
  display: block;
  height: 1.5px;
  background: white;
  border-radius: 2px;
  transition: all 0.4s cubic-bezier(0.76,0,0.24,1);
  transform-origin: center;
}
/* Open state */
.cx-ham-lines.cx-open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.cx-ham-lines.cx-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.cx-ham-lines.cx-open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Desktop: hide center nav items on mobile */
.cx-nav-center { display: none; }
@media (min-width: 1024px) {
  .cx-nav-center { display: flex; }
}

@media (max-width: 768px) {
  #cx-navbar {
    --cx-nav-logo-height: var(--cx-nav-logo-height-mobile);
    height: 64px;
    padding: 0 1rem;
  }

  #cx-nav-logo {
    height: var(--cx-nav-logo-height);
  }

  #cx-hamburger {
    width: 44px;
    height: 44px;
    padding: 10px;
  }

  .cx-ham-lines {
    width: 18px;
    gap: 5px;
  }

  /* Fullscreen Menu mobile adjustments */
  .fm-topbar {
    padding: 14px 24px;
  }
  .fm-logo {
    font-size: 1.6rem;
  }
  .fm-nav {
    padding: 30px 24px;
    gap: 16px;
  }
  .fm-footer {
    padding: 24px 24px 32px;
  }
}

/* ── Fullscreen Menu ──────────────────────────────────── */
#fullscreen-menu {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex !important;
  flex-direction: column !important;
  background: #1A2B4C !important;
  pointer-events: none !important;
  clip-path: inset(0 0 100% 0) !important;
  transition: clip-path 0.7s cubic-bezier(0.76,0,0.24,1) !important;
  overflow-y: auto !important;
}
#fullscreen-menu.cx-fm-open {
  pointer-events: all !important;
  clip-path: inset(0 0 0% 0) !important;
}

/* Topbar */
.fm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
}
.fm-logo {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  color: white;
  cursor: pointer;
}
.fm-close-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: white;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
}
.fm-close-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 24px;
}
.fm-close-icon i {
  display: block;
  height: 1.5px;
  background: white;
  border-radius: 2px;
}
.fm-close-icon i:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.fm-close-icon i:nth-child(2) { opacity: 0; }
.fm-close-icon i:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Nav container - vertical scrollable */
.fm-nav {
  flex: 1;
  display: flex !important;
  flex-direction: column !important;
  padding: 40px 2.5rem !important;
  gap: 20px !important;
  overflow-y: visible !important;
}

/* Nav groups - stagger delay */
.fm-nav-group {
  opacity: 0 !important;
  transform: translateY(20px) !important;
  transition: opacity 0.5s ease, transform 0.5s ease !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

/* Links inside groups */
.fm-nav-item {
  font-family: 'Poppins', 'Noto Sans JP', sans-serif;
  font-size: 16px !important;
  font-weight: 800;
  letter-spacing: 0.15em !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-decoration: none !important;
  text-transform: uppercase !important;
  display: block !important;
  line-height: 1.4 !important;
  padding: 14px 0 !important;
  transition: color 0.2s ease !important;
  opacity: 1 !important;
  transform: none !important;
}
.fm-nav-item:hover {
  color: #FF5C00;
}

/* Submenu */
.fm-nav-sub {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fm-nav-sub a {
  display: block;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  padding: 14px 0 14px 16px;
  position: relative;
  transition: color 0.2s ease;
}
.fm-nav-sub a::before {
  content: '·';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.3);
  font-size: 16px;
}
.fm-nav-sub a:hover {
  color: #FF5C00;
}

/* Stagger transition animations */
#fullscreen-menu.cx-fm-open .fm-nav-group {
  opacity: 1 !important;
  transform: translateY(0) !important;
}
#fullscreen-menu.cx-fm-open .fm-nav-group:nth-child(1) { transition-delay: 0.08s; }
#fullscreen-menu.cx-fm-open .fm-nav-group:nth-child(2) { transition-delay: 0.14s; }
#fullscreen-menu.cx-fm-open .fm-nav-group:nth-child(3) { transition-delay: 0.20s; }
#fullscreen-menu.cx-fm-open .fm-nav-group:nth-child(4) { transition-delay: 0.26s; }
#fullscreen-menu.cx-fm-open .fm-nav-group:nth-child(5) { transition-delay: 0.32s; }
#fullscreen-menu.cx-fm-open .fm-nav-group:nth-child(6) { transition-delay: 0.38s; }

/* Footer and CTA */
.fm-footer {
  padding: 30px 2.5rem 40px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 24px !important;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease 0.45s, transform 0.5s ease 0.45s;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#fullscreen-menu.cx-fm-open .fm-footer {
  opacity: 1 !important;
  transform: translateY(0) !important;
}
.fm-cta-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: #FF5C00;
  color: white;
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 13px !important;
  letter-spacing: 0.25em !important;
  text-transform: uppercase;
  height: 52px;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  width: 100% !important;
  opacity: 1 !important;
}
.fm-cta-btn:hover {
  background: #E65200;
  transform: translateY(-2px);
  box-shadow: none;
}
.fm-copy {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-align: center;
}
