/* ----------------------------------------------------------------------
  ヘッダー
---------------------------------------------------------------------- */

.sy-header {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 100;
  width: 100%;
  font-family: var(--sy-font-sans);
  background: var(--sy-navy);
}

.sy-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 96px;
  padding-left: 40px;
}

.sy-header__logo {
  flex-shrink: 0;
}

.sy-header__right {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

/* 検索 */
.sy-header__search {
  display: flex;
  align-items: center;
  width: 320px;
  height: 40px;
  padding: 0 8px 0 16px;
  background: #fff;
  border-radius: 20px;
}

.sy-header__search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  color: var(--sy-text);
  font-family: inherit;
  font-size: 14px;
  background: transparent;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.sy-header__search-input::placeholder {
  color: #999;
}

.sy-header__search-input::-webkit-search-cancel-button {
  display: none;
}

.sy-header__search-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.sy-header__search--sp {
  display: none;
}

/* お気に入り・アカウント・カート */
.sy-header__icons {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0 24px 0 0;
  list-style: none;
  border-right: 1px solid var(--sy-line);
}

.sy-header__icon>a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 70px;
  color: #fff !important;
  text-decoration: none !important;
}

.sy-header__icon-label {
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.sy-header__badge {
  position: absolute;
  top: -6px;
  left: calc(50% + 8px);
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: #fff;
  font-family: var(--sy-font-en);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  background: var(--sy-brown);
  border-radius: 9px;
}

.sy-header__badge:empty {
  display: none;
}

/* 電話 */
.sy-header__tel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sy-header__tel-number {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff !important;
  font-family: var(--sy-font-en);
  font-size: 26px;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
}

.sy-header__tel-hours {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 0;
  color: var(--sy-pale);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.sy-header__tel-time {
  font-family: var(--sy-font-en);
}

/* お問い合わせ */
.sy-header__contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 120px;
  height: 100%;
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none !important;
  background: var(--sy-brown);
  transition: opacity 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .sy-header__contact:hover {
    opacity: 0.85;
  }
}

/* ハンバーガー */
.sy-header .sy-header__menu-button {
  display: none;
  position: relative;
  width: 64px;
  height: 100%;
  background: none;
}

.sy-header .sy-header__menu-button span {
  position: absolute;
  left: 50%;
  width: 24px;
  height: 2px;
  margin-left: -12px;
  background: #fff;
}

.sy-header .sy-header__menu-button span:nth-child(1) {
  top: calc(50% - 8px);
}

.sy-header .sy-header__menu-button span:nth-child(2) {
  top: calc(50% - 1px);
}

.sy-header .sy-header__menu-button span:nth-child(3) {
  top: calc(50% + 6px);
}

/* ログイン・カートのドロップダウン位置 */
.sy-header .p-header-memberbox,
.sy-header .p-header-view-cart {
  top: 96px;
  right: 120px;
}

/* ----------------------------------------------------------------------
  グローバルナビ（Max Mega Menu の見た目を上書き）
---------------------------------------------------------------------- */

.sy-gnav {
  position: relative;
  z-index: 99;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.sy-gnav #mega-menu-wrap-global-menu,
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu {
  padding: 0;
  background: transparent;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu {
  display: flex;
  justify-content: center;
  gap: 56px;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item {
  margin: 0;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item>a.mega-menu-link {
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0;
  color: var(--sy-text);
  font-family: var(--sy-font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  border: none;
  background: transparent;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item.mega-current-menu-item>a.mega-menu-link,
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item>a.mega-menu-link:hover,
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item.mega-toggle-on>a.mega-menu-link {
  color: var(--sy-gold);
  font-weight: 700;
  background: transparent;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item.mega-current-menu-item>a.mega-menu-link::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--sy-gold);
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu a.mega-menu-link .mega-description-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu a.mega-menu-link .mega-description-group .mega-menu-description {
  color: #666;
  font-size: 12px;
  font-style: normal;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item-has-children>a.mega-menu-link>span.mega-indicator {
  margin-left: 16px;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item-has-children>a.mega-menu-link>span.mega-indicator::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

/* デザインにないグローバルナビ項目（お問い合わせなど） */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.sy-gnav-hide {
  display: none !important;
}

/* カテゴリーのメガメニュー（一目で収まるよう余白を詰める） */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-item>ul.mega-sub-menu {
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 12px max(32px, calc((100vw - 1280px) / 2)) 16px !important;
  background: #fff !important;
  border-top: 1px solid #eee;
  box-shadow: 0 20px 40px rgba(21, 54, 73, 0.12);
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-megamenu>ul.mega-sub-menu>li.mega-menu-row {
  max-width: 1280px;
  margin: 0 auto 20px;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-megamenu>ul.mega-sub-menu>li.mega-menu-row:last-child {
  margin-bottom: 0;
}

/* グリッド未配置の余り行（デザイン外の項目）は非表示 */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-megamenu>ul.mega-sub-menu>li.mega-menu-row[id$="-999"] {
  display: none !important;
}

/* 列間 */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column {
  padding: 0 32px 0 0 !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column:last-child {
  padding-right: 0 !important;
}

/* 同一列内のカテゴリブロック間（Mega Menu 既定の padding:15px を打ち消す） */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item,
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu>li.mega-menu-megamenu>ul.mega-sub-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item {
  margin: 0 0 24px !important;
  padding: 0 !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item:last-child {
  margin-bottom: 0 !important;
}

/*
 * ランバーコア列 / トラックフローリング列：
 * 先頭グループ高さを揃え、ツーバイ材と古材を水平に揃える
 */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu:has(> li.mega-menu-item:nth-child(3))>li.mega-menu-item:first-child {
  box-sizing: border-box;
  min-height: 112px;
}

/* カテゴリ見出し */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100% !important;
  max-width: 100%;
  margin: 0 !important;
  padding: 0 0 6px !important;
  color: #333 !important;
  font-family: var(--sy-font-sans);
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid #ccc !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item-has-children>a.mega-menu-link {
  margin-bottom: 8px !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link:hover {
  color: var(--sy-brown) !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link>span.mega-indicator {
  display: inline-block !important;
  flex: 0 0 auto;
  width: 7px !important;
  height: 10px !important;
  margin: 0 !important;
  border: none !important;
  background: url("../img/icon/mega-arrow.svg") center / contain no-repeat !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link>span.mega-indicator::after {
  content: none !important;
  display: none !important;
}

/* 子なし見出し（ツーバイ材など）も右矢印 */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column>ul.mega-sub-menu>li.mega-menu-item:not(.mega-menu-item-has-children)>a.mega-menu-link::after {
  content: "" !important;
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 10px;
  background: url("../img/icon/mega-arrow.svg") center / contain no-repeat;
}

/* 下位項目: 詰めつつ可読な行間 */
.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column ul.mega-sub-menu ul.mega-sub-menu {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column ul.mega-sub-menu ul.mega-sub-menu>li.mega-menu-item {
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column ul.mega-sub-menu ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #333 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  background: transparent !important;
  border: none !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column ul.mega-sub-menu ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link::before {
  content: "" !important;
  display: inline-block;
  flex: 0 0 auto;
  width: 6px;
  height: 8px;
  background: url("../img/icon/mega-arrow-sm.svg") center / contain no-repeat;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column ul.mega-sub-menu ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link::after {
  content: none !important;
  display: none !important;
}

.sy-gnav #mega-menu-wrap-global-menu #mega-menu-global-menu li.mega-menu-column ul.mega-sub-menu ul.mega-sub-menu>li.mega-menu-item>a.mega-menu-link:hover {
  color: var(--sy-brown) !important;
}

/* ----------------------------------------------------------------------
  レスポンシブ
---------------------------------------------------------------------- */

@media (max-width: 1439px) {
  .sy-header__right {
    gap: 16px;
  }

  .sy-header__search {
    width: 240px;
  }
}

@media (max-width: 1279px) {
  .sy-header__tel {
    display: none;
  }

  .sy-header__icons {
    padding-right: 0;
    border-right: none;
  }
}

@media (max-width: 1199px) {
  .sy-header__bar>.sy-header__right>.sy-header__search {
    display: none;
  }

  .sy-header__search--sp {
    display: flex;
    width: auto;
    margin: 0 20px 12px;
  }

  .sy-header .sy-header__menu-button {
    display: block;
  }

  .sy-gnav {
    display: none;
  }
}

@media (max-width: 767px) {
  .sy-header__bar {
    height: 64px;
    padding-left: 16px;
    gap: 8px;
  }

  .sy-header__logo .sy-logo__name {
    font-size: 20px;
  }

  .sy-header__logo .sy-logo__sub {
    margin-top: 0;
    font-size: 11px;
  }

  .sy-header__right {
    gap: 0;
  }

  .sy-header__icons {
    gap: 0;
  }

  .sy-header__icon>a {
    min-width: 48px;
  }

  .sy-header__icon .sy-icon {
    width: 26px;
    height: 26px;
  }

  .sy-header__icon-label,
  .sy-header__contact {
    display: none;
  }

  .sy-header__icon:not(.sy-header__icon--cart) {
    display: none;
  }

  .sy-header .sy-header__menu-button {
    width: 56px;
  }

  .sy-header__search--sp {
    margin: 0 16px 12px;
  }

  .sy-header .p-header-memberbox,
  .sy-header .p-header-view-cart {
    top: 64px;
    right: 0;
  }
}