/*
 * Shared desktop navigation for HANDA and Otemachi.
 * Interaction state is owned by desktop-navigation.js; mobile remains owned
 * by the shared mobile-navigation module.
 */
.header_nav {
  position: absolute;
  top: calc(var(--hd) * 65);
  right: 0;
  z-index: 1;
  padding-right: calc(var(--hd) * 40);
  padding-left: calc(var(--hd) * 40);
  background: rgba(255, 255, 255, .88);
  box-shadow: -4px 5px 10px 0 rgba(0, 0, 0, .15);
}

body:not(.home):not(.front-page) .header_nav {
  box-shadow: none;
}

.header_nav ul.flex {
  align-items: center;
  justify-content: flex-end;
  gap: calc(var(--hd) * 20);
  flex-wrap: nowrap;
}

.header_nav ul.flex > li.has-child {
  position: static;
}

.header_nav ul.flex > li > a {
  display: block;
  position: relative;
  padding: calc(var(--hd) * 15.5) 0;
  font-size: calc(var(--hd) * 16);
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.header_nav ul.flex > li:last-of-type > a {
  padding-right: calc(var(--hd) * 22);
}

.header_nav ul.flex > li > a span {
  display: block;
  margin-top: calc(var(--hd) * 8);
  font-size: calc(var(--hd) * 11);
  font-weight: 400;
  letter-spacing: .04em;
  color: rgba(var(--hamille-blue-rgb), .5);
}

/* A single left-to-right bar is the hover/focus/open affordance. */
.header_nav ul.flex > li > a:not(.sns_icon)::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: calc(var(--hd) * 5);
  left: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 240ms cubic-bezier(.22, 1, .36, 1);
}

.header_nav ul.flex > li:hover > a:not(.sns_icon)::before,
.header_nav ul.flex > li:focus-within > a:not(.sns_icon)::before,
.header_nav ul.flex > li.is-menu-open > a::before,
.header_nav ul.flex > li.is-menu-pinned > a::before {
  transform: scaleX(1);
}

.header_nav ul.flex > li.has-child > a {
  padding-right: calc(var(--hd) * 15);
}

.header_nav ul.flex > li.has-child > a > .desktop-nav-chevron {
  display: block;
  position: absolute;
  top: calc(var(--hd) * 16);
  right: 0;
  width: calc(var(--hd) * 7);
  height: calc(var(--hd) * 7);
  margin: 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 240ms cubic-bezier(.22, 1, .36, 1);
  pointer-events: none;
}

.header_nav li.has-child.is-menu-open > a .desktop-nav-chevron,
.header_nav li.has-child.is-menu-pinned > a .desktop-nav-chevron {
  transform: translateY(calc(var(--hd) * 3)) rotate(225deg);
}

.header_nav ul.flex > li.has-child > ul.mega {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--hd) * 15) calc(var(--hd) * 20);
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 100;
  min-width: calc(var(--hd) * 800);
  max-width: 100%;
  padding: calc(var(--hd) * 30) calc(var(--hd) * 30) calc(var(--hd) * 15);
  background: #fff;
  box-shadow: -4px 5px 10px 0 rgba(0, 0, 0, .15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 180ms ease,
    visibility 180ms ease,
    transform 240ms cubic-bezier(.22, 1, .36, 1);
}

/* The bridge and delayed close prevent pointer loss between link and panel. */
.header_nav ul.flex > li.has-child > ul.mega::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 10px;
}

.header_nav ul.flex > li.has-child > ul.mega::after {
  content: "";
  display: block;
  clear: both;
}

.header_nav ul.flex > li.has-child.is-menu-open > ul.mega,
.header_nav ul.flex > li.has-child.is-menu-pinned > ul.mega {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.header_nav ul.flex > li.has-child > ul.mega > li.mega_title {
  display: none;
}

.header_nav ul.flex > li.has-child > ul.mega > li.mega_title h3 {
  font-size: calc(var(--hd) * 20);
  font-weight: 500;
  line-height: 1;
}

.header_nav ul.flex > li.has-child > ul.mega > li.mega_title h3 span {
  display: inline-block;
  margin-left: calc(var(--hd) * 8);
  font-size: calc(var(--hd) * 14);
  font-weight: 400;
  letter-spacing: .04em;
  color: rgba(var(--hamille-blue-rgb), .5);
}

.header_nav ul.flex > li.has-child > ul.mega > li.mega_title > a {
  display: none;
}

.header_nav ul.flex > li.has-child > ul.mega > li {
  width: calc(33.333% - var(--hd) * 13.4);
  margin-bottom: 0;
}

.header_nav ul.flex > li.has-child > ul.mega > li > a {
  position: relative;
  padding: 0 calc(var(--hd) * 10) 0 calc(var(--hd) * 15);
  font-family: inherit;
  font-size: calc(var(--hd) * 14.5);
  font-weight: 700;
  letter-spacing: .01em;
  color: rgb(8, 115, 201);
  line-height: 1.75;
  text-align: left;
}

.header_nav ul.flex > li.has-child > ul.mega > li > a::before {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  left: 0;
  width: 9px;
  height: 15px;
  background: url("../img/common/mega_arrow.svg") no-repeat center center;
  background-size: cover;
  transform: translateY(-50%);
}

@media screen and (max-width: 639px) {
  .header_nav ul.flex > li.has-child > a > .desktop-nav-chevron {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header_nav ul.flex > li > a:not(.sns_icon)::before,
  .desktop-nav-chevron,
  .header_nav ul.flex > li.has-child > ul.mega {
    transition: none;
  }
}
