@layer base, layout, components, utilities, pages;

/**
 * Page Hero — 固定ページ共通ヒーロー
 *
 * archive-hero と統一されたデザイン。
 * EN タイトル（大）+ JP タイトル（小）の 2 段構成。
 * ドットグリッド + グロー + ゴーストテキスト。
 *
 * Typography: Outfit (EN) + Zen Kaku Gothic New (JP)
 */

@layer components {

  /* ────────────────────────────────────────────────────────────────
     Design Tokens
     ──────────────────────────────────────────────────────────────── */
  .page-hero {
    --ph-font-en: 'Outfit', system-ui, sans-serif;
    --ph-font-jp: 'Zen Kaku Gothic New', system-ui, sans-serif;
    --ph-bg: #1e2d42;
    --ph-text: #f8fafc;
    --ph-text-sub: rgba(255, 255, 255, 0.8);
    --ph-text-muted: rgba(255, 255, 255, 0.4);
    --ph-accent: var(--color-primary, #0b5fff);
    --ph-accent-soft: rgba(11, 95, 255, 0.12);
    --ph-glass: rgba(255, 255, 255, 0.04);
    --ph-glass-border: rgba(255, 255, 255, 0.08);
    --ph-ease: cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* ────────────────────────────────────────────────────────────────
     Keyframes
     ──────────────────────────────────────────────────────────────── */
  @keyframes ph-grid-drift {
    0%, 100% { opacity: 0.04; }
    50% { opacity: 0.07; }
  }

  @keyframes ph-glow-shift {
    0% { transform: translate(0, 0) scale(1); opacity: 0.12; }
    50% { transform: translate(-4%, 4%) scale(1.06); opacity: 0.18; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.12; }
  }

  /* ────────────────────────────────────────────────────────────────
     Container
     ──────────────────────────────────────────────────────────────── */
  .page-hero {
    position: relative;
    min-height: 380px;
    display: flex;
    align-items: center;
    background: var(--ph-bg);
    overflow: hidden;
  }

  /* ────────────────────────────────────────────────────────────────
     背景レイヤー（グリッド + グロー）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  /* ドットグリッドパターン */
  .page-hero__grid {
    position: absolute;
    inset: 0;
    background-image:
      radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 32px 32px;
    animation: ph-grid-drift 10s ease-in-out infinite;
  }

  /* アクセントグロー */
  .page-hero__glow {
    position: absolute;
    top: -40%;
    right: -15%;
    width: 70%;
    height: 140%;
    background: radial-gradient(ellipse at center, rgba(11, 95, 255, 0.22) 0%, transparent 65%);
    animation: ph-glow-shift 14s ease-in-out infinite;
  }

  /* ────────────────────────────────────────────────────────────────
     ゴーストテキスト（右下に大きな薄い英字）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__ghost {
    position: absolute;
    bottom: -0.06em;
    right: 32px;
    z-index: 0;
    font-family: var(--ph-font-en);
    font-size: clamp(100px, 18vw, 240px);
    font-weight: 800;
    line-height: 0.85;
    color: rgba(255, 255, 255, 0.07);
    text-transform: uppercase;
    letter-spacing: -0.04em;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
  }

  /* ────────────────────────────────────────────────────────────────
     Inner Container
     ──────────────────────────────────────────────────────────────── */
  .page-hero__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--container-max, 1400px);
    margin: 0 auto;
    padding: 72px var(--gutter, 48px);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
  }

  /* ────────────────────────────────────────────────────────────────
     Body（テキストコンテンツ）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__body {
    max-width: 700px;
  }

  /* ────────────────────────────────────────────────────────────────
     Eyebrow（ラベルバッジ）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__eyebrow {
    display: inline-block;
    font-family: var(--ph-font-en);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ph-accent);
    background: var(--ph-accent-soft);
    padding: 5px 14px;
    border-radius: var(--radius-pill, 999px);
    margin-bottom: 20px;
  }

  /* ────────────────────────────────────────────────────────────────
     Title EN（英語大見出し = h1）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__title-en {
    font-family: var(--ph-font-en);
    font-size: clamp(44px, 7vw, 68px);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--ph-text);
    margin: 0 0 6px;
  }

  /* title_en に日本語が入る場合（EN タイトル未指定時のフォールバック） */
  .page-hero__title-en--jp {
    font-family: var(--ph-font-jp);
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    margin-bottom: 16px;
  }

  /* ────────────────────────────────────────────────────────────────
     Title JP（日本語サブタイトル）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__title-jp {
    font-family: var(--ph-font-jp);
    font-size: clamp(16px, 2.5vw, 22px);
    font-weight: 500;
    color: var(--ph-text-sub);
    margin: 0 0 24px;
    letter-spacing: 0.04em;
  }

  /* ────────────────────────────────────────────────────────────────
     Subtitle（追加サブテキスト、WISページ等）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__subtitle {
    font-family: var(--ph-font-jp);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 12px;
  }

  /* ────────────────────────────────────────────────────────────────
     Lead（リードテキスト）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__lead {
    font-family: var(--ph-font-jp);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.85);
    max-width: 540px;
    margin: 0;
  }

  /* ────────────────────────────────────────────────────────────────
     Meta（更新日など）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--ph-text-muted);
    margin: 16px 0 0;
    padding: 0;
  }

  .page-hero__meta dt {
    font-weight: 600;
    margin: 0;
  }

  .page-hero__meta dd {
    margin: 0;
  }

  .page-hero__meta time {
    font-family: var(--ph-font-en);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  /* ────────────────────────────────────────────────────────────────
     Actions（CTAボタン）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
  }

  /* ダーク面でのゴーストボタン対応 */
  .page-hero .btn--ghost {
    border-color: rgba(103, 168, 255, 0.45);
    color: rgba(103, 168, 255, 0.9);
    background: transparent;
  }

  .page-hero .btn--ghost:hover,
  .page-hero .btn--ghost:focus-visible {
    border-color: var(--color-accent, #67a8ff);
    background: rgba(103, 168, 255, 0.1);
    color: #fff;
  }

  /* ────────────────────────────────────────────────────────────────
     Nav（ページ内ナビゲーション）
     ──────────────────────────────────────────────────────────────── */
  .page-hero__nav {
    flex-shrink: 0;
  }

  .page-hero__nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-hero__nav-link {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 20px;
    font-family: var(--ph-font-jp);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--ph-glass);
    border: 1px solid var(--ph-glass-border);
    border-radius: var(--radius-pill, 999px);
    text-decoration: none;
    transition:
      background var(--transition-fast, 0.2s ease),
      border-color var(--transition-fast, 0.2s ease);
  }

  .page-hero__nav-link:hover,
  .page-hero__nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
  }

  /* ────────────────────────────────────────────────────────────────
     Responsive: Tablet (1024px)
     ──────────────────────────────────────────────────────────────── */
  @media (max-width: 1024px) {
    .page-hero__inner {
      flex-direction: column;
      align-items: flex-start;
      gap: 32px;
    }

    .page-hero__nav {
      width: 100%;
    }

    .page-hero__nav-list {
      flex-wrap: wrap;
    }
  }

  /* ────────────────────────────────────────────────────────────────
     Responsive: Mobile (768px)
     ──────────────────────────────────────────────────────────────── */
  @media (max-width: 768px) {
    .page-hero {
      min-height: 300px;
    }

    .page-hero__inner {
      padding: 56px 20px;
      gap: 24px;
    }

    .page-hero__ghost {
      font-size: clamp(72px, 16vw, 120px);
      right: 16px;
    }

    .page-hero__eyebrow {
      font-size: 10px;
      padding: 4px 12px;
    }

    .page-hero__title-en {
      font-size: 36px;
    }

    .page-hero__title-en--jp {
      font-size: clamp(22px, 5vw, 30px);
    }

    .page-hero__title-jp {
      font-size: 15px;
      margin-bottom: 16px;
    }

    .page-hero__lead {
      font-size: 14px;
    }

    .page-hero__nav-link {
      height: 36px;
      padding: 0 16px;
      font-size: 13px;
    }
  }

  /* ────────────────────────────────────────────────────────────────
     Responsive: Small Mobile (600px)
     ──────────────────────────────────────────────────────────────── */
  @media (max-width: 600px) {
    .page-hero__title-en {
      font-size: 30px;
    }

    .page-hero__title-en--jp {
      font-size: 22px;
      line-height: 1.4;
    }

    .page-hero__lead {
      font-size: 13px;
      line-height: 1.75;
    }

    .page-hero__meta {
      font-size: 11px;
    }

    .page-hero__actions {
      flex-direction: column;
    }

    .page-hero__actions .btn {
      width: 100%;
      justify-content: center;
    }
  }

  /* ────────────────────────────────────────────────────────────────
     Reduced Motion
     ──────────────────────────────────────────────────────────────── */
  @media (prefers-reduced-motion: reduce) {
    .page-hero__grid {
      animation: none;
    }

    .page-hero__glow {
      animation: none;
    }

    .page-hero__ghost {
      display: none;
    }
  }
}
