/**
 * ヘッダー・ナビ・ティッカー — DESIGN.md v3 §6-2
 * 共通シェル（全ページ）+ 現在地表示・3CTA
 * 参照: 02_デザイン方向性/cta-sticky-nav-mockup.html
 */

:root {
  --site-cta-bar-btn-h: 48px;
  --site-cta-bar-pad-y: 6px;
  --site-cta-bar-pad-x: 8px;
  --site-cta-bar-h: calc(
    var(--site-cta-bar-pad-y) * 2 + var(--site-cta-bar-btn-h) +
      env(safe-area-inset-bottom, 0px)
  );
  --anchor-scroll-pad: calc(
    var(--site-header-h) + var(--location-line-h) + 16px
  );
}

/* ── ヘッダー・ナビ・ティッカー（共通シェル） ── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--site-header-h);
  padding: 8px var(--section-pad-x);
  border-bottom: 1px solid var(--bh-border);
}

.site-top .site-header {
  border-bottom: none;
}

.site-header__logo img {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.site-nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--bh-border);
  border-radius: var(--radius-sm);
  background: var(--bh-white);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.site-nav-toggle:hover {
  border-color: var(--bh-logo-blue);
  background: var(--bh-pale-blue-2);
}

.site-nav-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--bh-charcoal);
  border-radius: 1px;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.site-nav-toggle[aria-expanded="true"] .site-nav-toggle__bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.site-nav-toggle[aria-expanded="true"] .site-nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.site-nav-toggle[aria-expanded="true"] .site-nav-toggle__bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.site-nav {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  visibility: hidden;
}

.site-nav.is-open {
  pointer-events: auto;
  visibility: visible;
}

.site-nav__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 45, 49, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.site-nav.is-open .site-nav__backdrop {
  opacity: 1;
}

.site-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(300px, 88vw);
  height: 100%;
  background: var(--bh-white);
  box-shadow: -8px 0 32px rgba(47, 127, 163, 0.15);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.site-nav.is-open .site-nav__panel {
  transform: translateX(0);
}

.site-nav__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--bh-border);
  background: var(--bh-pale-blue-2);
}

.site-nav__title {
  font-size: 14px;
  font-weight: 800;
  color: var(--bh-charcoal);
  letter-spacing: 0.06em;
}

.site-nav__close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--bh-border);
  border-radius: var(--radius-sm);
  background: var(--bh-white);
  color: var(--bh-charcoal);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  overflow-y: auto;
  flex: 1;
}

.site-nav__list a {
  display: block;
  padding: 14px 20px;
  color: var(--bh-text);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--bh-border);
  transition:
    background 0.15s ease,
    color 0.15s ease;
  text-decoration: none;
}

.site-nav__list a:hover {
  background: var(--bh-pale-blue);
  color: var(--bh-logo-blue-dark);
}

.site-nav__list a.nav-link--buy,
.site-nav__list a.nav-link--sell {
  font-weight: 800;
  padding-left: 17px;
}

.site-nav__list a.nav-link--buy {
  color: var(--bh-orange-dark);
  background: linear-gradient(90deg, rgba(232, 135, 26, 0.12), transparent);
  box-shadow: inset 3px 0 0 var(--bh-orange);
}

.site-nav__list a.nav-link--buy:hover {
  background: rgba(232, 135, 26, 0.18);
  color: var(--bh-orange-dark);
}

.site-nav__list a.nav-link--sell {
  color: var(--bh-wine);
  background: linear-gradient(90deg, rgba(158, 43, 56, 0.1), transparent);
  box-shadow: inset 3px 0 0 var(--bh-wine);
}

.site-nav__list a.nav-link--sell:hover {
  background: rgba(158, 43, 56, 0.16);
  color: var(--bh-wine-dark);
}

.site-nav__list li:last-child a {
  border-bottom: none;
}

body.site-nav-open {
  overflow: hidden;
}

/* ティッカー */

.ticker {
  height: 32px;
  overflow: hidden;
  background: var(--bh-pale-blue);
  border-bottom: 1px solid var(--bh-border);
}

.ticker__viewport {
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 8%,
    #000 92%,
    transparent
  );
}

.ticker__track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: ticker-scroll 28s linear infinite;
}

.ticker__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-right: 48px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.ticker__area {
  color: var(--bh-muted);
}
.ticker__sep {
  color: var(--bh-logo-blue);
  font-weight: 400;
}
.ticker__hook {
  color: var(--bh-logo-blue-dark);
}

.trust-ticker {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--bh-pale-blue);
  border-bottom: 1px solid rgba(143, 184, 193, 0.45);
}

@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__viewport {
    mask-image: none;
    justify-content: center;
  }
  .ticker__track {
    animation: none;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 12px;
  }
  .ticker__item[aria-hidden="true"] {
    display: none;
  }
  .ticker {
    height: auto;
    min-height: 32px;
    padding: 6px 0;
  }
  .ticker__item {
    white-space: normal;
    text-align: center;
    padding-right: 0;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 8px;
  }
}

/* ── ロゴ＋カテゴリバッジ ── */
.site-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.site-header__badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
}

.site-header__badge-divider {
  display: block;
  width: 1px;
  height: 16px;
  background: var(--bh-charcoal);
  opacity: 0.45;
}

.site-header__badge-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--bh-charcoal);
  white-space: nowrap;
}

.site-top--other .site-header__badge {
  display: none;
}

/* ── 現在地ライン（2px） ── */
.site-location-line {
  height: var(--location-line-h);
  width: 100%;
  flex-shrink: 0;
}

.site-top--buy .site-location-line {
  background: var(--bh-orange);
}

.site-top--sell .site-location-line {
  background: var(--bh-wine);
}

.site-top--other .site-location-line {
  background: var(--bh-logo-blue);
}

/* ── ヘッダー3CTA（PC） ── */
.site-header__cta-group {
  display: none;
  align-items: center;
  gap: 8px;
}

.site-header .btn--header-cta {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

.header-cta__label {
  font-weight: 700;
}

.site-header .btn--header-cta.btn--buy:hover {
  filter: brightness(0.94);
  background: var(--bh-orange);
}

.site-header .btn--header-cta.btn--sell:hover {
  filter: none;
  background: var(--bh-wine-dark);
}

.site-header .btn--header-cta.btn--line:hover {
  filter: brightness(0.95);
  background: var(--bh-line-green);
}

/* 現在地CTAの強調（白リング）— ドロップシャドウと併用 */
.site-top--buy .btn--header-cta[data-cta-kind="buy"] {
  box-shadow:
    0 0 0 2px var(--bh-white),
    0 0 0 3px var(--bh-orange);
}

.site-top--buy .site-cta-bar__btn[data-cta-kind="buy"] {
  box-shadow:
    var(--shadow-cta),
    0 0 0 2px var(--bh-white),
    0 0 0 4px var(--bh-orange);
}

.site-top--sell .btn--header-cta[data-cta-kind="sell"] {
  box-shadow:
    0 0 0 2px var(--bh-white),
    0 0 0 3px var(--bh-wine);
}

.site-top--sell .site-cta-bar__btn[data-cta-kind="sell"] {
  box-shadow:
    var(--shadow-cta-wine),
    0 0 0 2px var(--bh-white),
    0 0 0 4px var(--bh-wine);
}

/* ── SP下部3CTAバー（M2: 左kw＋右sub2行・ピル型） ── */
.site-cta-bar {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  transform: none;
  bottom: 0;
  z-index: 190;
  gap: 6px;
  padding: var(--site-cta-bar-pad-y) var(--site-cta-bar-pad-x)
    calc(var(--site-cta-bar-pad-y) + env(safe-area-inset-bottom, 0px));
  background: var(--bh-white);
  border-top: 1px solid var(--bh-border);
  box-shadow: 0 -8px 24px rgba(43, 45, 49, 0.08);
  box-sizing: border-box;
}

.site-cta-bar a.site-cta-bar__btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
  min-height: var(--site-cta-bar-btn-h);
  padding: 5px 4px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  border: none;
  color: #fff;
  overflow: hidden;
  transition:
    transform 0.12s,
    filter 0.15s,
    background-color 0.15s;
}

.site-cta-bar a.site-cta-bar__btn:active {
  transform: scale(0.97);
}

.site-cta-bar .site-cta-bar__kw {
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.site-cta-bar .site-cta-bar__sub-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  line-height: 1.1;
}

.site-cta-bar .site-cta-bar__sub-line {
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.94;
}

.site-cta-bar .site-cta-bar__line-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: block;
}

.site-cta-bar a.site-cta-bar__btn.btn--buy {
  background: var(--bh-orange);
  box-shadow: var(--shadow-cta);
}
.site-cta-bar a.site-cta-bar__btn.btn--buy:hover {
  filter: brightness(0.94);
  text-decoration: none;
}
.site-cta-bar a.site-cta-bar__btn.btn--sell {
  background: var(--bh-wine);
  box-shadow: var(--shadow-cta-wine);
}
.site-cta-bar a.site-cta-bar__btn.btn--sell:hover {
  filter: brightness(0.94);
  text-decoration: none;
}
.site-cta-bar a.site-cta-bar__btn.btn--line {
  background: var(--bh-line-green);
  box-shadow: var(--shadow-line);
}
.site-cta-bar a.site-cta-bar__btn.btn--line:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

.site-cta-bar a.site-cta-bar__btn:hover {
  text-decoration: none;
}

@media (max-width: 767px) {
  .site-cta-bar {
    gap: 5px;
    --site-cta-bar-pad-x: 6px;
  }
}

/* 旧シングルCTAバー（非推奨） */
.sub-sticky-cta {
  display: none !important;
}

@media (min-width: 768px) {
  .site-header__cta-group {
    display: flex;
  }

  .site-cta-bar {
    display: none;
  }

  body:not(.page-top) {
    padding-bottom: 0;
  }

  body.page-top {
    padding-bottom: 0;
  }

  body.page-top.chat-shell-minimized {
    padding-bottom: calc(var(--minibar-h) + 12px);
  }
}

@media (max-width: 767px) {
  body:not(.page-top) {
    padding-bottom: var(--site-cta-bar-h);
  }

  body.page-top {
    padding-bottom: var(--site-cta-bar-h);
  }

  body.page-top.chat-shell-minimized {
    padding-bottom: calc(var(--site-cta-bar-h) + var(--minibar-h));
  }

  body.page-top .chat-shell__minibar {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    transform: none;
    bottom: var(--site-cta-bar-h);
  }
}

@media (min-width: 768px) {
  body.page-top .chat-shell__minibar {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: none;
  }
}
