/*
 * 共通ヘッダー CSS (Phase B)
 *
 * 設計:
 *   - DESIGN.md / global-design.css の token (--gold / --bg / --border) を継承
 *   - 各ツール側で上書き可能なトークンは 3 つに限定:
 *       --header-bg       : ヘッダー背景
 *       --header-border   : ヘッダー下境界
 *       --header-accent   : ハンバーガー bar / アクティブ表示 / hover
 *   - data-tool="<id>" 属性で scope override 可能 (basicloop / phonics 等)
 *
 * 例 (basicloop で warm 系を retain):
 *   .site-header[data-tool="basicloop"] {
 *     --header-bg: #FFF8EE;
 *     --header-border: #F1E5CC;
 *     --header-accent: #E07A1F;
 *   }
 *
 * z-index 規定:
 *   .site-header        : 300
 *   .site-mobile-nav    : 301
 *   .site-hamburger     : 302
 *   .nav-dd-menu        : 310 (header 内 dropdown)
 *   .mobile-nav-close   : 303
 *   ツール固有の sticky CTA は 200 以下で揃える
 */

.site-header {
  --header-bg: rgba(248, 246, 241, 0.92);
  --header-border: #E8E4DC;
  --header-accent: #F5A623;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--header-border);
  padding: 10px 0;
  transition: padding 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  padding: 6px 0;
  box-shadow: 0 1px 12px rgba(26, 26, 26, 0.08);
}

.site-header-spacer {
  height: var(--header-h, 54px);
}

.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header-logo {
  font-size: 15px;
  font-weight: 800;
  color: rgba(26, 26, 26, 0.88);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}

.site-header-logo svg {
  width: 18px;
  height: 18px;
  color: var(--header-accent);
}

.site-header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-header-nav > a {
  font-size: 13px;
  font-weight: 500;
  color: rgba(26, 26, 26, 0.55);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.site-header-nav > a:hover {
  color: rgba(26, 26, 26, 0.88);
  background: rgba(26, 26, 26, 0.04);
}

.site-header-nav > a.active {
  color: var(--header-accent);
  font-weight: 700;
}

/* CTA: 🏆 スクール比較 */
.nav-cta-ranking {
  background: linear-gradient(135deg, #F5A623, #E09520) !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 6px 14px !important;
  border-radius: 9999px !important;
  font-size: 12.5px !important;
}

.nav-cta-ranking:hover {
  filter: brightness(1.05);
  background: linear-gradient(135deg, #F5A623, #E09520) !important;
}

.lang-toggle {
  font-size: 12px !important;
  color: rgba(26, 26, 26, 0.55) !important;
}

/* Dropdown */
.nav-dd {
  position: relative;
}

.nav-dd-trigger {
  font-size: 13px;
  font-weight: 500;
  color: rgba(26, 26, 26, 0.55);
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: inherit;
}

.nav-dd-trigger:hover {
  color: rgba(26, 26, 26, 0.88);
  background: rgba(26, 26, 26, 0.04);
}

.nav-dd-trigger.active {
  color: var(--header-accent);
  font-weight: 700;
}

.dd-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-dd:hover .dd-chevron,
.nav-dd.open .dd-chevron {
  transform: rotate(180deg);
}

.nav-dd-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  background: #FDFCF9;
  border-radius: 12px;
  border: 1px solid var(--header-border);
  box-shadow: 0 8px 32px rgba(26, 26, 26, 0.10), 0 2px 8px rgba(26, 26, 26, 0.04);
  padding: 6px;
  margin-top: 4px;
  z-index: 310;
}

.nav-dd:hover .nav-dd-menu,
.nav-dd.open .nav-dd-menu {
  display: block;
}

.nav-dd-menu a {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(26, 26, 26, 0.62);
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-dd-menu a:hover {
  color: rgba(26, 26, 26, 0.88);
  background: rgba(26, 26, 26, 0.04);
}

.nav-dd-menu a.active {
  color: var(--header-accent);
  font-weight: 700;
}

/* Hamburger */
.site-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  position: relative;
  z-index: 302;
}

.site-hamburger:hover {
  background: rgba(26, 26, 26, 0.04);
}

.site-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(26, 26, 26, 0.88);
  margin: 4px auto;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.site-hamburger.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.site-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.site-hamburger.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile drawer */
.site-mobile-nav {
  display: flex;
  visibility: hidden;
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.96);
  z-index: 301;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
  overflow-y: auto;
  padding: 60px 0 40px;
}

.site-mobile-nav.active {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

.site-mobile-nav a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  padding: 14px 40px;
  border-radius: 14px;
  width: 260px;
  text-align: center;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-mobile-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.site-mobile-nav a.active {
  color: var(--header-accent);
}

.mobile-cta-ranking {
  background: linear-gradient(135deg, #F5A623, #E09520) !important;
  color: #fff !important;
  font-weight: 700 !important;
  border-radius: 9999px !important;
}

.lang-toggle-mobile {
  font-size: 14px !important;
  color: rgba(255, 255, 255, 0.5) !important;
}

.mobile-nav-label {
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 0 2px;
  width: 260px;
  text-align: center;
}

.mobile-nav-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 303;
}

.mobile-nav-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
  .site-header-nav {
    display: none;
  }
  .site-hamburger {
    display: block;
  }
}
