/**
 * 固定ページヘッダースタイル（上いっぱい表示版）
 * riff_display_page_header()（inc/page-header.php）が出力するマークアップでのみ
 * 使用するクラスのため、is_page() && !is_front_page() の時だけ読み込む
 * （style.cssから分離。パンくずリストの共通スタイルはstyle.css側に残している）
 *
 * @package RIFF
 */

/* ページヘッダーメイン */
.page-header {
  position: relative;
  height: 60vh;
  min-height: 400px;
  max-height: 600px;
  margin-top: -70px; /* 固定ヘッダーの高さ分を上に移動 */
  padding-top: 70px; /* 固定ヘッダー分のパディングを追加 */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
  z-index: 1; /* 固定ヘッダーより下に配置 */
}

/* 背景画像コンテナ */
.page-header-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.page-header-image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 背景画像のパララックス効果 */
.page-header-image-container::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  transform: translateZ(0);
  will-change: transform;
  transition: transform 0.3s ease-out;
}

/* スクロール時のパララックス効果を無効化（モバイル対応） */
@media (max-width: 767px) {
  .page-header-image-container::before {
    background-attachment: scroll;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

.page-header-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 8s ease-out;
  transform: scale(1);
}

/* ホバー時のズーム効果 */
.page-header:hover .page-header-image {
  transform: scale(1.05);
}

/* オーバーレイ */
.page-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(26, 53, 83, 0.7) 0%,
    rgba(26, 53, 83, 0.5) 50%,
    rgba(26, 53, 83, 0.3) 100%
  );
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* コンテンツエリア */
.page-header-content {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding-top: 70px; /* 固定ヘッダー分のスペースを確保 */
}

.page-header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ページタイトル */
.page-title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 15px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

/* ページサブタイトル */
.page-subtitle {
  font-size: 1.2rem;
  line-height: 1.6;
  margin: 0;
  opacity: 0.9;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  font-weight: 300;
  animation: fadeInUp 0.8s ease-out 0.5s both;
}

/* アニメーション */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* パーティクルエフェクト（オプション） */
.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(
      circle at 20% 80%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    );
  z-index: 2;
  pointer-events: none;
}

/* レスポンシブデザイン */
@media (max-width: 1199px) {
  .page-header {
    height: 55vh;
    min-height: 350px;
    max-height: 550px;
    margin-top: -70px;
    padding-top: 70px;
  }

  .page-header-content {
    padding-top: 70px;
  }

  .page-title {
    font-size: 2.5rem;
  }

  .page-subtitle {
    font-size: 1.1rem;
  }
}

@media (max-width: 991px) {
  .page-header {
    height: 50vh;
    min-height: 320px;
    max-height: 500px;
    margin-top: -70px;
    padding-top: 70px;
  }

  .page-header-content {
    padding-top: 70px;
  }

  .page-title {
    font-size: 2.2rem;
    margin-bottom: 12px;
  }

  .page-subtitle {
    font-size: 1rem;
  }
}

@media (max-width: 767px) {
  .page-header {
    height: 45vh;
    min-height: 280px;
    max-height: 400px;
    margin-top: -60px; /* モバイル用ヘッダー高さに調整 */
    padding-top: 60px;
  }

  .page-header-content {
    padding-top: 60px;
  }

  .page-header-inner {
    padding: 0 15px;
  }

  .page-title {
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 10px;
  }

  .page-subtitle {
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

@media (max-width: 480px) {
  .page-header {
    height: 40vh;
    min-height: 250px;
    max-height: 350px;
    margin-top: -60px;
    padding-top: 60px;
  }

  .page-header-content {
    padding-top: 60px;
  }

  .page-title {
    font-size: 1.6rem;
    margin-bottom: 8px;
  }

  .page-subtitle {
    font-size: 0.85rem;
  }

  .page-header-inner {
    padding: 0 12px;
  }
}

/* 特別な画面サイズでの調整 */
@media (max-width: 375px) {
  .page-title {
    font-size: 1.4rem;
  }

  .page-subtitle {
    font-size: 0.8rem;
  }
}

/* 横向き表示時の調整 */
@media (max-height: 500px) and (orientation: landscape) {
  .page-header {
    height: 80vh;
    min-height: 250px;
    margin-top: -70px;
    padding-top: 70px;
  }

  .page-header-content {
    padding-top: 70px;
  }

  .page-title {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }
}

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .page-header-image,
  .page-header-image-container::before {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* アクセシビリティ配慮 */
@media (prefers-reduced-motion: reduce) {
  .page-header-image,
  .page-header-overlay,
  .page-title,
  .page-subtitle {
    transition: none;
    animation: none;
  }

  .page-header-image-container::before {
    transition: none;
  }

  .page-header:hover .page-header-image {
    transform: none;
  }
}

/* ハイコントラスト対応 */
@media (prefers-contrast: high) {
  .page-header-overlay {
    background: rgba(0, 0, 0, 0.8);
  }

  .page-title,
  .page-subtitle {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  }
}

/* ダークモード対応（プリファレンス） */
@media (prefers-color-scheme: dark) {
  .page-header {
    background-color: #1a1a1a;
  }

  .page-header-overlay {
    background: linear-gradient(
      135deg,
      rgba(0, 0, 0, 0.6) 0%,
      rgba(0, 0, 0, 0.4) 50%,
      rgba(0, 0, 0, 0.2) 100%
    );
  }
}

/* 印刷時の調整 */
@media print {
  .page-header {
    height: auto;
    min-height: auto;
    max-height: none;
    margin-top: 0;
    padding-top: 0;
    page-break-inside: avoid;
  }

  .page-header-background,
  .page-header-overlay {
    display: none;
  }

  .page-header-content {
    position: static;
    color: #000;
    background: #fff;
    padding: 20px 0;
  }

  .page-title,
  .page-subtitle {
    color: #000;
    text-shadow: none;
  }
}

/* タッチデバイス対応 */
@media (hover: none) and (pointer: coarse) {
  .page-header:hover .page-header-image {
    transform: scale(1);
  }
}

/* 画像がない場合のスタイル */
.page-header:not([data-has-image]) {
  background: linear-gradient(135deg, #1a3553 0%, #2c5282 50%, #3182ce 100%);
}

.page-header:not([data-has-image]) .page-header-overlay {
  background: rgba(0, 0, 0, 0.2);
}

/* ローディング状態 */
.page-header-image {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.page-header-image.loaded {
  opacity: 1;
}

/* カスタマイザー用CSS変数 */
.page-header {
  --page-header-height: 60vh;
  --page-header-min-height: 400px;
  --page-header-max-height: 600px;
  --page-header-overlay-opacity: 0.5;
}

.page-header {
  height: var(--page-header-height, 60vh);
  min-height: var(--page-header-min-height, 400px);
  max-height: var(--page-header-max-height, 600px);
}

/* パフォーマンス最適化 */
.page-header-image-container,
.page-header-image {
  will-change: transform;
  transform: translateZ(0);
}

/* GPU加速の有効化 */
.page-header-overlay,
.page-title,
.page-subtitle {
  will-change: auto;
  transform: translateZ(0);
}
