/* Shared header: normal flow until the hero has scrolled above the viewport. */
.site-header {
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10001;
  position: relative;
  background: #fff;
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}

.site-header .header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px;
  margin: auto;
  padding: 25px 4%;
  gap: 28px;
  font-size: 12px;
}

.site-header .logo {
  flex-shrink: 0;
}

.site-header .logo-mark {
  width: 44px;
  aspect-ratio: 1/1;
  background: url("../img/logo-mark.svg") no-repeat center / contain;
}

.site-header .logo-name {
  display: none;
}

.site-header nav ul {
  gap: clamp(12px, 1.7vw, 28px);
  align-items: center;
}

.site-header a {
  color: var(--ink);
  opacity: 1;
}

.site-header a:hover {
  color: var(--color-accent-text);
}

.site-header a[aria-current="page"] {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color1);
}

.site-header li:last-child a {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
}

#global-nav {
  position: absolute;
  top: 0;
  right: 4%;
  z-index: 10002;
  height: var(--site-header-height, 94px);
  display: flex;
  align-items: center;
}

body.header-is-fixed #global-nav {
  position: fixed;
}

#global-nav ul {
  display: flex;
  gap: clamp(12px, 1.7vw, 28px);
  align-items: center;
}

#global-nav>ul a {
  color: var(--ink);
  opacity: 1;
}

#global-nav>ul a:hover {
  color: var(--color-accent-text);
}

#global-nav>ul a[aria-current="page"] {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color1);
}

#global-nav li:last-child a {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
}

#global-nav li:last-child a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--color1);
  transform: scaleY(0);
  transform-origin: center bottom;
  transition: transform .3s ease;
  pointer-events: none;
}

#global-nav li:last-child a:is(:hover, :focus-visible)::before {
  transform: scaleY(1);
}

.mobile-nav-contact {
  display: none;
}

@media (min-width: 1001px) {
  #global-nav>ul {
    font-size: 13px;
  }

  #global-nav li:last-child a>span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  #global-nav li:last-child a>span::before {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url("../img/icon/icon-contract-edit.svg") no-repeat center / contain;
    mask: url("../img/icon/icon-contract-edit.svg") no-repeat center / contain;
  }
}

.menu-toggle {
  display: none;
}

.site-header li:last-child a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--color1);
  transform: scaleY(0);
  transform-origin: center bottom;
  transition: transform .3s ease;
  pointer-events: none;
}

.site-header li:last-child a:is(:hover, :focus-visible)::before {
  transform: scaleY(1);
}

@media (prefers-reduced-motion: reduce) {
  .site-header li:last-child a::before {
    transition: none;
  }
}

.site-header.is-fixed {
  position: fixed;
  background: rgb(255 255 255 / 96%);
  border-bottom-color: rgb(220 229 228 / 65%);
  box-shadow: 0 2px 12px rgb(36 59 62 / 8%);
}

@supports ((backdrop-filter: blur(14px)) or (-webkit-backdrop-filter: blur(14px))) {
  .site-header.is-fixed {
    background: rgb(255 255 255 / 82%);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}

#header-trigger {
  height: 0;
}

.site-header.is-fixed~#header-trigger {
  height: var(--site-header-height, 0px);
}

html {
  scroll-padding-top: calc(var(--site-header-height, 0px) + 24px);
}

@media (max-width: 1000px) {
  .site-header .header-inner {
    padding: 18px 5%;
    align-items: center;
  }

  .menu-toggle {
    position: relative;
    z-index: 10001;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px;
    background: white;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
  }

  .menu-toggle-label {
    font-size: 11px;
    letter-spacing: .08em;
  }

  .menu-toggle-icon {
    display: grid;
    gap: 5px;
    width: 22px;
  }

  .menu-toggle-icon i {
    display: block;
    height: 1px;
    background: var(--color1);
    transition: transform .3s ease;
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon i:first-child {
    transform: translateY(3px) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-icon i:last-child {
    transform: translateY(-3px) rotate(-45deg);
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-label {
    font-size: 0;
  }

  .menu-toggle[aria-expanded="true"] .menu-toggle-label::after {
    content: "閉じる";
    font-size: 11px;
  }

  #global-nav {
    position: fixed;
    top: var(--site-header-height, 0px);
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--site-header-height, 0px));
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 40px 8%;
    background: rgb(255 255 255 / 98%);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity .3s ease, transform .3s ease, visibility .3s;
  }

  #global-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    background: var(--color1);
  }

  /* Keep overflowing rows at their natural height and reachable from the top. */
  #global-nav {
    height: calc(100vh - var(--site-header-height, 0px));
    height: calc(100dvh - var(--site-header-height, 0px));
    align-content: start;
    grid-auto-rows: max-content;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding-top: clamp(16px, 4dvh, 40px);
    padding-bottom: calc(clamp(16px, 4dvh, 40px) + env(safe-area-inset-bottom, 0px));
    scroll-padding-block: 16px;
  }

  #global-nav ul {
    display: grid;
    gap: 0;
    width: min(480px, 100%);
    padding: 20px;
    border-radius: 6px;
    background: white;
  }

  #global-nav li {
    border-bottom: 1px solid var(--line);
  }

  #global-nav>ul a {
    display: block;
    padding: 17px 4px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
  }

  #global-nav li:last-child a {
    padding: 17px 4px;
    background: transparent;
    color: var(--ink);
  }

  #global-nav>ul a[aria-current="page"] {
    padding-bottom: 17px;
    border-bottom: 0;
    color: var(--color-accent-text);
  }

  #global-nav li:last-child a::before {
    display: none;
  }

  #global-nav>ul>li>a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  #global-nav>ul>li>a::after {
    content: "";
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background-color: var(--color1);
    -webkit-mask: url("../img/icon/arrow_forward.svg") no-repeat center / contain;
    mask: url("../img/icon/arrow_forward.svg") no-repeat center / contain;
  }

  .mobile-nav-contact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: min(480px, 100%);
    background: white;
    border-radius: 6px;
    padding: 20px;
  }

  body.menu-open {
    overflow: hidden;
  }
}

@media (max-width: 768px) {
  .site-header .header-inner {
    gap: 18px;
  }

  .site-header .logo-mark {
    width: 36px;
  }

  #global-nav>ul a {
    font-size: 13px;
  }

  .mobile-nav-contact {
    grid-template-columns: 1fr;
    margin-top: 18px;
  }
}

@media (max-width: 1000px) and (max-height: 700px) {

  #global-nav>ul a,
  #global-nav li:last-child a,
  #global-nav>ul a[aria-current="page"] {
    padding-block: 12px;
    min-height: 44px;
  }

  .mobile-nav-contact {
    margin-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {

  #global-nav,
  .menu-toggle-icon i {
    transition: none;
  }
}

@media (min-width: 1280px) {
  .site-header .logo-name {
    display: inherit;
  }
}