/*
 * tp-header.css
 * Turning Point Today — 共通LPヘッダー スタイルシート
 *
 * 格納場所: /wp-content/themes/cocoon-child-master/tp-header/tp-header.css
 *
 * 設計方針:
 *   - すべてのクラスは .tph- プレフィックスで名前空間を確保
 *   - 既存テンプレートの CSS 変数（--c-*）に依存しない独立した変数体系
 *   - PC（1160px+）/ タブレット（768px〜）/ スマホ（〜767px）の3段階レスポンシブ
 *   - ヒーロー大画像の美しさを損なわないよう、初期は完全透明
 *   - スクロール後は高級感のあるフロストグラス（backdrop-filter）
 */

/* ══════════════════════════════════════════════════
   CSS VARIABLES（既存テンプレートの --c-* とは独立）
══════════════════════════════════════════════════ */
:root {
  /* ── ブランドカラー ── */
  --tph-olive-900:   #0d1209;
  --tph-olive-800:   #141a0c;
  --tph-olive-700:   #1e2b13;
  --tph-olive-600:   #2a3a1a;
  --tph-olive-500:   #3d5429;
  --tph-olive-400:   #5a7a3e;
  --tph-olive-300:   #8aad6a;
  --tph-gold-600:    #a07a22;
  --tph-gold-500:    #c8a44a;
  --tph-gold-400:    #e2c872;
  --tph-gold-100:    #f0e4b8;
  --tph-cream:       #f5f1e8;
  --tph-white:       #fefdf9;
  --tph-border:      rgba(200, 164, 74, 0.18);
  --tph-border-mob:  rgba(200, 164, 74, 0.12);

  /* ── タイポグラフィ ── */
  --tph-font-display: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
  --tph-font-jp:      'M PLUS Rounded 1c', 'Hiragino Maru Gothic Pro', 'Noto Sans JP', sans-serif;

  /* ── サイズ ── */
  --tph-header-h:     70px;
  --tph-container:    1160px;
  --tph-gutter:       24px;
  --tph-drawer-w:     320px;
  --tph-radius:       8px;
  --tph-radius-pill:  100px;

  /* ── モーション ── */
  --tph-ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --tph-ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --tph-ease-in:      cubic-bezier(0.7, 0, 0.84, 0);

  /* ── Z-index ── */
  --tph-z-progress: 2000;
  --tph-z-overlay:   900;
  --tph-z-drawer:    901;
  --tph-z-header:    800;
}

/* ══════════════════════════════════════════════════
   SCROLL PROGRESS BAR
══════════════════════════════════════════════════ */
.tph-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: var(--tph-z-progress);
  pointer-events: none;
  background: rgba(200, 164, 74, 0.08);
}

.tph-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--tph-gold-600), var(--tph-gold-400), var(--tph-gold-100));
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--tph-gold-500);
}

/* ══════════════════════════════════════════════════
   MOBILE OVERLAY（暗幕）
══════════════════════════════════════════════════ */
.tph-mob-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 3, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: var(--tph-z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--tph-ease-out);
}

.tph-mob-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ══════════════════════════════════════════════════
   MOBILE DRAWER
══════════════════════════════════════════════════ */
.tph-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(var(--tph-drawer-w), 90vw);
  height: 100%;
  height: 100dvh;
  z-index: var(--tph-z-drawer);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  /* 高級感のあるオリーブグリーン背景 */
  background:
    /* 薄い斜めラインテクスチャ */
    repeating-linear-gradient(
      135deg,
      transparent,
      transparent 28px,
      rgba(200, 164, 74, 0.025) 28px,
      rgba(200, 164, 74, 0.025) 29px
    ),
    /* ベースグラデーション */
    linear-gradient(
      160deg,
      #0f1609 0%,
      #1a2510 25%,
      #1e2b13 50%,
      #243318 75%,
      #1a2510 100%
    );

  /* 左端の金のラインで高級感を演出 */
  border-left: 1px solid transparent;
  box-shadow:
    -4px 0 48px rgba(0, 0, 0, 0.6),
    inset 1px 0 0 rgba(200, 164, 74, 0.3),
    inset 2px 0 0 rgba(200, 164, 74, 0.06);

  /* スライドイン・アニメーション */
  transform: translateX(100%);
  transition: transform 0.48s var(--tph-ease-out);

  /* レイアウト */
  display: flex;
  flex-direction: column;
  padding: 0;
}

.tph-drawer.is-open {
  transform: translateX(0);
}

/* 閉じるボタン */
.tph-drawer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--tph-border);
  background: rgba(200, 164, 74, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--tph-ease-spring);
  z-index: 1;
  flex-shrink: 0;
}

.tph-drawer-close:hover {
  background: rgba(200, 164, 74, 0.14);
  border-color: var(--tph-gold-500);
  transform: rotate(90deg);
}

/* × マーク（CSS で描画） */
.tph-drawer-close-inner {
  display: block;
  width: 16px;
  height: 16px;
  position: relative;
}

.tph-drawer-close-inner::before,
.tph-drawer-close-inner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--tph-gold-500);
  border-radius: 2px;
}

.tph-drawer-close-inner::before { transform: translateY(-50%) rotate(45deg); }
.tph-drawer-close-inner::after  { transform: translateY(-50%) rotate(-45deg); }

/* ドロワー内ブランドロゴ */
.tph-drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.6rem 1.8rem 1.4rem;
  border-bottom: 1px solid var(--tph-border-mob);
  text-decoration: none;
  transition: opacity 0.2s;
}

.tph-drawer-brand:hover { opacity: 0.8; }

.tph-drawer-brand-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--tph-gold-500);
  box-shadow: 0 0 12px rgba(200, 164, 74, 0.25);
  flex-shrink: 0;
}

.tph-drawer-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.tph-drawer-brand-ja {
  font-family: var(--tph-font-jp);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tph-cream);
  letter-spacing: 0.04em;
}

.tph-drawer-brand-en {
  font-family: var(--tph-font-display);
  font-size: 0.6rem;
  font-weight: 400;
  font-style: italic;
  color: var(--tph-gold-500);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ドロワー ナビゲーション */
.tph-drawer-nav {
  list-style: none;
  padding: 0.8rem 0;
  margin: 0;
  flex: 1;
}

.tph-drawer-item {
  border-bottom: 1px solid var(--tph-border-mob);
}

.tph-drawer-item:first-child {
  border-top: none;
}

.tph-drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem 1.8rem;
  font-family: var(--tph-font-jp);
  font-size: 1rem;
  font-weight: 500;
  color: rgba(245, 241, 232, 0.82);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.2s, padding-left 0.25s var(--tph-ease-out), background 0.2s;
  position: relative;
}

/* 右端の小さな矢印（→） */
.tph-drawer-link::after {
  content: '›';
  font-size: 1.2rem;
  color: var(--tph-gold-500);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s, transform 0.25s var(--tph-ease-out);
}

.tph-drawer-link:hover {
  color: var(--tph-cream);
  padding-left: 2.2rem;
  background: rgba(200, 164, 74, 0.05);
}

.tph-drawer-link:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* ドロワー CTA ボタン */
.tph-drawer-cta {
  display: block;
  margin: 1.4rem 1.8rem 2rem;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, var(--tph-gold-600) 0%, var(--tph-gold-500) 50%, var(--tph-gold-400) 100%);
  color: var(--tph-olive-900);
  font-family: var(--tph-font-jp);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  border-radius: var(--tph-radius);
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s var(--tph-ease-spring), box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(200, 164, 74, 0.28);
}

.tph-drawer-cta:hover {
  opacity: 0.92;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(200, 164, 74, 0.4);
}

/* ドロワー 装飾リング */
.tph-drawer-deco {
  position: absolute;
  bottom: -60px;
  right: -60px;
  pointer-events: none;
  overflow: hidden;
}

.tph-drawer-deco-ring {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid rgba(200, 164, 74, 0.08);
  position: absolute;
}

.tph-drawer-deco-ring--2 {
  width: 280px;
  height: 280px;
  top: -40px;
  left: -40px;
  border-color: rgba(200, 164, 74, 0.04);
}

/* ══════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════ */
.tph-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--tph-header-h);
  z-index: var(--tph-z-header);

  /* 初期: 完全透明（ヒーロー大画像を邪魔しない） */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition:
    background 0.5s var(--tph-ease-out),
    backdrop-filter 0.5s var(--tph-ease-out),
    -webkit-backdrop-filter 0.5s var(--tph-ease-out),
    box-shadow 0.5s var(--tph-ease-out);
}

/* スクロール後: フロストグラス */
.tph-header.is-scrolled {
  background: rgba(12, 17, 8, 0.88);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 1px 0 var(--tph-border), 0 4px 32px rgba(0, 0, 0, 0.24);
}

/* スクロール後に現れる底辺のゴールドライン */
.tph-header-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tph-gold-500) 30%, var(--tph-gold-400) 70%, transparent);
  transition: width 0.6s var(--tph-ease-out);
}

.tph-header.is-scrolled .tph-header-line {
  width: 100%;
}

/* ヘッダー内部レイアウト */
.tph-header-inner {
  max-width: var(--tph-container);
  margin: 0 auto;
  padding: 0 var(--tph-gutter);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0;
}

/* ══════════════════════════════════════════════════
   LOGO
══════════════════════════════════════════════════ */
.tph-logo {
  display: flex;
  align-items: center;
  gap: 0.82rem;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;
  transition: opacity 0.2s;
}

.tph-logo:hover { opacity: 0.85; }

/* ロゴマーク（画像＋ゴールドリング） */
.tph-logo-mark {
  position: relative;
  flex-shrink: 0;
}

.tph-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

/* 外側のゴールドリング */
.tph-logo-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    var(--tph-gold-500) 60deg,
    var(--tph-gold-400) 120deg,
    transparent 180deg,
    transparent 240deg,
    var(--tph-gold-600) 300deg,
    transparent 360deg
  );
  opacity: 0;
  transition: opacity 0.4s;
  animation: tph-ring-spin 8s linear infinite;
}

@keyframes tph-ring-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.tph-logo:hover .tph-logo-ring {
  opacity: 1;
}

/* ゴールドリングの内側マスク（円形をくり抜く） */
.tph-logo-ring::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--tph-olive-800);
}

/* ロゴテキスト */
.tph-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  gap: 0.1em;
}

.tph-logo-ja {
  font-family: var(--tph-font-jp);
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--tph-white);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.tph-logo-en {
  font-family: var(--tph-font-display);
  font-size: 0.6rem;
  font-weight: 400;
  font-style: italic;
  color: var(--tph-gold-500);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════
   DESKTOP NAVIGATION
══════════════════════════════════════════════════ */
.tph-nav {
  display: flex;
  align-items: center;
  gap: 0;
  margin-right: 1rem;
}

.tph-nav-link {
  font-family: var(--tph-font-jp);
  font-size: 0.76rem;
  font-weight: 500;
  color: rgba(254, 253, 249, 0.70);
  letter-spacing: 0.06em;
  padding: 0.5em 0.85em;
  text-decoration: none;
  position: relative;
  transition: color 0.25s;
  white-space: nowrap;
}

/* ゴールドのアンダーライン（左から右へスライド） */
.tph-nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0.85em;
  right: 0.85em;
  height: 1px;
  background: var(--tph-gold-500);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s var(--tph-ease-out);
}

.tph-nav-link:hover {
  color: var(--tph-cream);
}

.tph-nav-link:hover::after {
  transform: scaleX(1);
}

/* ══════════════════════════════════════════════════
   DESKTOP CTA BUTTON
══════════════════════════════════════════════════ */
.tph-nav-cta {
  font-family: var(--tph-font-jp);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tph-olive-900);
  background: linear-gradient(135deg, var(--tph-gold-600) 0%, var(--tph-gold-500) 60%, var(--tph-gold-400) 100%);
  padding: 0.5em 1.4em;
  border-radius: var(--tph-radius-pill);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--tph-ease-spring), box-shadow 0.2s;
  box-shadow: 0 2px 12px rgba(200, 164, 74, 0.3);
  flex-shrink: 0;
}

/* シマーエフェクト */
.tph-nav-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s var(--tph-ease-out);
}

.tph-nav-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(200, 164, 74, 0.45);
}

.tph-nav-cta:hover::before {
  transform: translateX(100%);
}

/* ══════════════════════════════════════════════════
   HAMBURGER BUTTON
══════════════════════════════════════════════════ */
.tph-hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5.5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: var(--tph-radius);
  border: 1px solid var(--tph-border);
  background: rgba(200, 164, 74, 0.04);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

.tph-hamburger:hover {
  background: rgba(200, 164, 74, 0.1);
  border-color: rgba(200, 164, 74, 0.35);
}

.tph-hamburger-bar {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--tph-cream);
  border-radius: 2px;
  transition: transform 0.35s var(--tph-ease-spring), opacity 0.25s, width 0.3s;
  transform-origin: center;
}

/* ハンバーガー → X 変換 */
.tph-hamburger.is-open .tph-hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.tph-hamburger.is-open .tph-hamburger-bar:nth-child(2) {
  opacity: 0;
  width: 0;
}

.tph-hamburger.is-open .tph-hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — TABLET（768px〜1023px）
══════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  /* ナビリンクを少し詰める */
  .tph-nav-link {
    font-size: 0.72rem;
    padding: 0.5em 0.6em;
  }

  .tph-nav-link::after {
    left: 0.6em;
    right: 0.6em;
  }

  .tph-nav-cta {
    font-size: 0.72rem;
    padding: 0.5em 1.1em;
  }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — MOBILE（〜767px）
══════════════════════════════════════════════════ */
@media (max-width: 767px) {
  :root {
    --tph-header-h: 60px;
  }

  /* デスクトップナビ・CTAを非表示 */
  .tph-nav     { display: none; }
  .tph-nav-cta { display: none; }

  /* ハンバーガー表示 */
  .tph-hamburger { display: flex; }

  /* ロゴテキスト調整（英語サブタイトルは非表示） */
  .tph-logo-en { display: none; }

  .tph-logo-ja {
    font-size: 0.87rem;
  }

  .tph-logo-img {
    width: 36px;
    height: 36px;
  }

  /* ドロワー: スマホ幅いっぱい（最大320px） */
  .tph-drawer {
    width: min(var(--tph-drawer-w), 88vw);
  }
}

/* ══════════════════════════════════════════════════
   PRINT
══════════════════════════════════════════════════ */
@media print {
  .tph-header,
  .tph-progress,
  .tph-mob-overlay,
  .tph-drawer {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════
   ACCESSIBILITY — フォーカス可視化
══════════════════════════════════════════════════ */
.tph-nav-link:focus-visible,
.tph-nav-cta:focus-visible,
.tph-logo:focus-visible,
.tph-hamburger:focus-visible,
.tph-drawer-close:focus-visible,
.tph-drawer-link:focus-visible,
.tph-drawer-cta:focus-visible {
  outline: 2px solid var(--tph-gold-500);
  outline-offset: 3px;
}

/* ══════════════════════════════════════════════════
   BODY PADDING（ヘッダー分の余白は各テンプレートで制御）
   ヒーロー全画面のページは padding-top: 0 のまま
══════════════════════════════════════════════════ */
