/*
 * Header responsive styles
 * - ヘッダーを常時固定表示
 * - 半透明背景を復元
 * - ロゴ画像の二重描画を防止
 * - タブレットはPCと同じ横一列レイアウト
 * - スマートフォンのみ縦型の開閉メニュー
 */

html,
body {
  overflow-x: hidden !important;
}

body {
  padding-top: 91px !important;
}

body .site-header {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 10000 !important;
  padding: 15px 40px !important;
  background: rgba(0, 0, 0, 0.68) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
  transform: none !important;
}

.admin-bar .site-header {
  top: 32px !important;
}

body .site-header .nav-bar {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  gap: 40px !important;
}

body .site-header .logo {
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: auto !important;
  min-width: 0 !important;
}

body .site-header .logo-link {
  display: block !important;
  width: 240px !important;
  height: 60px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  line-height: 0 !important;
  background: none !important;
  background-image: none !important;
}

body .site-header .site-logo-image {
  display: block !important;
  width: 240px !important;
  height: 60px !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: left center !important;
}

body .site-header .menu-toggle-checkbox {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body .site-header .menu-toggle {
  display: none !important;
}

body .site-header .nav-panel {
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  min-width: 0 !important;
  gap: 32px !important;
}

body .site-header .primary-menu {
  display: flex !important;
  flex: 0 1 auto !important;
  align-items: center !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  white-space: nowrap !important;
}

body .site-header .primary-menu > .menu-item {
  position: relative !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 24px !important;
  border-top: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-left: 1px solid rgba(170, 170, 170, 0.6) !important;
}

body .site-header .primary-menu > .menu-item:last-child {
  border-right: 1px solid rgba(170, 170, 170, 0.6) !important;
}

body .site-header .submenu-details {
  position: relative !important;
}

body .site-header .submenu-details > summary {
  list-style: none !important;
}

body .site-header .submenu-details > summary::-webkit-details-marker {
  display: none !important;
}

body .site-header .primary-menu > .menu-item > a,
body .site-header .submenu-toggle {
  display: flex !important;
  align-items: center !important;
  width: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 6px 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #fff !important;
  font: inherit !important;
  font-weight: 700 !important;
  line-height: 1.5 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

body .site-header .submenu-icon {
  display: inline-block !important;
  margin-left: 6px !important;
  font-size: 0.7em !important;
  transition: transform 0.2s ease !important;
}

body .site-header .submenu-details[open] > .submenu-toggle .submenu-icon {
  transform: rotate(180deg) !important;
}

body .site-header .dropdown-menu {
  display: none !important;
  position: absolute !important;
  top: calc(100% + 8px) !important;
  left: 0 !important;
  width: max-content !important;
  min-width: 190px !important;
  margin: 0 !important;
  padding: 10px 0 !important;
  list-style: none !important;
  white-space: nowrap !important;
  background: rgba(0, 0, 0, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
  z-index: 10001 !important;
}

body .site-header .primary-menu > .menu-item:last-child .dropdown-menu {
  right: 0 !important;
  left: auto !important;
}

body .site-header .submenu-details[open] > .dropdown-menu,
body .site-header .menu-item-has-children:hover .dropdown-menu,
body .site-header .menu-item-has-children:focus-within .dropdown-menu {
  display: block !important;
}

body .site-header .dropdown-menu a {
  display: block !important;
  min-height: 0 !important;
  padding: 8px 20px !important;
  color: #fff !important;
  font-weight: 400 !important;
  text-decoration: none !important;
}

body .site-header .primary-menu a:hover,
body .site-header .primary-menu a:focus-visible,
body .site-header .submenu-toggle:hover,
body .site-header .submenu-toggle:focus-visible,
body .site-header .dropdown-menu a:hover,
body .site-header .dropdown-menu a:focus-visible {
  color: #66ccff !important;
}

body .site-header .header-search {
  flex: 1 1 240px !important;
  width: auto !important;
  min-width: 180px !important;
  max-width: 360px !important;
  margin: 0 0 0 auto !important;
}

body .site-header .header-search .search-form {
  display: flex !important;
  width: 100% !important;
  margin: 0 !important;
}

body .site-header .header-search .search-field {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
}

body .site-header .header-search .search-submit {
  flex: 0 0 auto !important;
}

/*
 * タブレット
 * PCと同じ横一列を維持し、各要素の幅と余白だけを圧縮する。
 */
@media (min-width: 769px) and (max-width: 1100px) {
  body {
    padding-top: 72px !important;
  }

  body .site-header {
    padding: 8px 14px !important;
  }

  body .site-header .nav-bar {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }

  body .site-header .logo {
    justify-content: flex-start !important;
    width: auto !important;
  }

  body .site-header .logo-link,
  body .site-header .site-logo-image {
    width: 150px !important;
    height: 54px !important;
  }

  body .site-header .site-logo-image {
    object-position: left center !important;
  }

  body .site-header .nav-panel {
    flex: 1 1 0 !important;
    flex-direction: row !important;
    align-items: center !important;
    width: auto !important;
    min-width: 0 !important;
    gap: 12px !important;
  }

  body .site-header .primary-menu {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    white-space: nowrap !important;
  }

  body .site-header .primary-menu > .menu-item {
    padding: 0 10px !important;
  }

  body .site-header .primary-menu > .menu-item > a,
  body .site-header .submenu-toggle {
    font-size: 0.92rem !important;
  }

  body .site-header .submenu-icon {
    margin-left: 4px !important;
  }

  body .site-header .header-search {
    flex: 1 1 150px !important;
    width: auto !important;
    min-width: 140px !important;
    max-width: 220px !important;
    margin-left: auto !important;
  }

  body .site-header .header-search .search-field {
    padding: 7px 8px !important;
    font-size: 0.88rem !important;
  }

  body .site-header .header-search .search-submit {
    padding: 7px 10px !important;
    font-size: 0.88rem !important;
  }
}

@media (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px !important;
  }
}

/* ===== スマートフォン ===== */
@media (max-width: 768px) {
  body {
    padding-top: 118px !important;
  }

  body .site-header {
    height: auto !important;
    min-height: 0 !important;
    max-height: 100dvh !important;
    padding: 8px 12px 10px !important;
    overflow-y: auto !important;
    background: rgba(0, 0, 0, 0.82) !important;
  }

  body .site-header .nav-bar {
    height: auto !important;
    min-height: 0 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  body .site-header .logo {
    justify-content: center !important;
    width: 100% !important;
  }

  body .site-header .logo-link,
  body .site-header .site-logo-image {
    width: 196px !important;
    height: 48px !important;
  }

  body .site-header .site-logo-image {
    object-position: center !important;
  }

  body .site-header .menu-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 9px 14px !important;
    gap: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: #fff !important;
    font: inherit !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
  }

  body .site-header .menu-toggle-checkbox:focus-visible + .menu-toggle,
  body .site-header .menu-toggle:hover {
    color: #66ccff !important;
    border-color: #66ccff !important;
  }

  body .site-header .menu-toggle-icon {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 24px !important;
    height: 18px !important;
  }

  body .site-header .menu-toggle-line {
    display: block !important;
    width: 24px !important;
    height: 2px !important;
    background: currentColor !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
  }

  body .site-header .menu-toggle-checkbox:checked + .menu-toggle .menu-toggle-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg) !important;
  }

  body .site-header .menu-toggle-checkbox:checked + .menu-toggle .menu-toggle-line:nth-child(2) {
    opacity: 0 !important;
  }

  body .site-header .menu-toggle-checkbox:checked + .menu-toggle .menu-toggle-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg) !important;
  }

  body .site-header .nav-panel {
    display: none !important;
    flex: 0 0 auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 118px) !important;
    overflow-y: auto !important;
    padding: 2px 0 4px !important;
    gap: 8px !important;
  }

  body .site-header .menu-toggle-checkbox:checked ~ .nav-panel {
    display: flex !important;
  }

  body .site-header .primary-menu {
    flex: 0 0 auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  body .site-header .primary-menu > .menu-item,
  body .site-header .primary-menu > .menu-item:last-child {
    width: 100% !important;
    padding: 0 !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-left: 0 !important;
  }

  body .site-header .primary-menu > .menu-item:first-child {
    border-top: 1px solid rgba(255, 255, 255, 0.16) !important;
  }

  body .site-header .primary-menu > .menu-item > a,
  body .site-header .submenu-toggle {
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 46px !important;
    padding: 11px 4px !important;
    text-align: left !important;
  }

  body .site-header .dropdown-menu,
  body .site-header .primary-menu > .menu-item:last-child .dropdown-menu {
    position: static !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 0 8px 14px !important;
    white-space: normal !important;
    background: transparent !important;
    border: 0 !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  body .site-header .menu-item-has-children:hover .dropdown-menu,
  body .site-header .menu-item-has-children:focus-within .dropdown-menu {
    display: none !important;
  }

  body .site-header .submenu-details[open] > .dropdown-menu {
    display: block !important;
  }

  body .site-header .dropdown-menu a {
    min-height: 42px !important;
    padding: 10px 12px !important;
  }

  body .site-header .header-search {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body .content-area {
    margin-top: 20px !important;
  }
}