/* 創環境Design - 共通スタイル */

/* ヒーローセクション背景画像 */
@keyframes heroZoom {
  0% {
    opacity: 0;
    transform: scale(1.12);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1.0);
  }
}

.hero-section {
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/hero.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: heroZoom 5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 0;
}

/* スムーズスクロール */
html {
  scroll-behavior: smooth;
}

/* 日本語テキストの改行ルール */
body {
  overflow-wrap: break-word;
  line-break: strict;
  word-break: auto-phrase; /* 単語・文節の途中で改行しない（対応ブラウザのみ） */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 見出し：文節単位で自然に改行（対応ブラウザのみ）＋行のバランスを整える */
h1, h2, h3, h4 {
  word-break: auto-phrase;
  text-wrap: balance;
}

/* 本文：行末の1文字だけの孤立を防ぐ */
p {
  text-wrap: pretty;
}

/* スマホでの読みやすさ調整 */
@media (max-width: 767px) {
  p {
    line-height: 1.8;
  }
  h1, h2 {
    letter-spacing: 0.02em;
  }
}

/* PC：ヒーローを短くしたので、背景の地図が上下で切れないよう
   「高さに合わせて全体を収める」表示にする（余白は紺のグラデーションが埋める） */
@media (min-width: 768px) {
  .hero-section {
    min-height: 72vh;
  }
  .hero-section::before {
    /* 高さの125%に拡大し、右寄せにしてSDGsのマーク（11・4）が文字に重ならず見えるようにする */
    background-size: auto 125%;
    background-position: right 70%;
  }
}

/* スマホ：下部固定ボタンにヒーローの文字が隠れないよう余白を確保 */
@media (max-width: 767px) {
  .hero-section {
    padding-bottom: 96px;
  }
}

/* 画面の短い端末（iPhone SE 等）では、ヒーローの余白と文字を詰めて
   キャッチコピーからボタンまでが1画面に収まるようにする */
@media (max-width: 767px) and (max-height: 750px) {
  .hero-section .hero-anim-1 { display: none; }          /* 英字ラベルを省略 */
  .hero-section h1 { font-size: 1.375rem; margin-bottom: 0.5rem; }
  .hero-section .hero-mission { font-size: 0.9375rem; margin-bottom: 0.75rem; }
  .hero-section .hero-anim-5 { margin-bottom: 1rem; }
  .hero-section .hero-anim-6.mb-8 { margin-bottom: 1rem; }
  .hero-section .hero-anim-6.mb-8 > div { padding: 0.75rem 1rem; }
  .hero-section { padding-bottom: 88px; }
}

/* スマホ：ヒーロー文字のアニメーションを短縮（4秒→2秒で全表示） */
@media (max-width: 767px) {
  .hero-anim { animation-duration: 1.1s; }
  .hero-anim-1 { animation-delay: 0.2s; }
  .hero-anim-2 { animation-delay: 0.5s; }
  .hero-anim-3 { animation-delay: 0.8s; }
  .hero-anim-4 { animation-delay: 1.1s; }
  .hero-anim-5 { animation-delay: 1.5s; }
  .hero-anim-6 { animation-delay: 1.9s; }
}

/* 「視差効果を減らす」設定のユーザーにはアニメーションなしで即表示 */
@media (prefers-reduced-motion: reduce) {
  .hero-anim,
  .scroll-anim,
  .hero-section::before {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* フォーカスリング（アクセシビリティ） */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #E8A020;
  outline-offset: 2px;
}

/* テーブルのスクロール対応（スマホ） */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* FAQアコーディオン */
.faq-answer {
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-btn i.fa-chevron-down {
  transition: transform 0.3s ease;
}

.faq-btn.open i.fa-chevron-down {
  transform: rotate(180deg);
}

/* モバイルフッター余白 */
@media (max-width: 767px) {
  body {
    padding-bottom: 72px;
  }
}

/* アニメーション */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

/* ヒーロー テキストアニメーション（ラグジュアリー・GPU最適化） */
@keyframes heroFadeUp {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-anim {
  opacity: 0;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  animation: heroFadeUp 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-anim-1 { animation-delay: 0.4s; }
.hero-anim-2 { animation-delay: 1.1s; }
.hero-anim-3 { animation-delay: 1.8s; }
.hero-anim-4 { animation-delay: 2.5s; }
.hero-anim-5 { animation-delay: 3.3s; }
.hero-anim-6 { animation-delay: 4.0s; }

/* スクロールアニメーション */
.scroll-anim {
  opacity: 0;
  transform: translateY(32px);
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

@keyframes scrollFadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-anim.scroll-visible {
  animation: scrollFadeUp 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ヘッダー下のコンテンツずれ防止 */
main, section:first-of-type {
  scroll-margin-top: 64px;
}

/* ===== デザインリファイン ===== */

/* セクション見出し：ゴールドのアクセントライン */
.section-title {
  position: relative;
  padding-bottom: 16px;
}
.section-title::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, #E8A020, #F0BC5E);
  border-radius: 2px;
}

/* カード：ホバーでふわっと浮く */
.hover\:shadow-md {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}
.hover\:shadow-md:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px -10px rgba(26, 58, 92, 0.18);
}

/* ゴールドボタン：グラデーション＋ホバー演出 */
a.bg-gold, button.bg-gold {
  background-image: linear-gradient(135deg, #E8A020 0%, #D98C12 100%);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
a.bg-gold:hover, button.bg-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -6px rgba(232, 160, 32, 0.5);
  filter: brightness(1.05);
}

/* インフォグラフィック画像：ホバーでわずかに拡大 */
img[src*="-merit"], img[src*="gift-tax"], img[src*="design-record"] {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
img[src*="-merit"]:hover, img[src*="gift-tax"]:hover, img[src*="design-record"]:hover {
  transform: scale(1.01);
}

/* フッター：ゴールドのトップボーダー */
footer {
  border-top: 3px solid #E8A020;
}

/* テーブルの行ホバー */
tbody tr {
  transition: background-color 0.2s ease;
}


/* ===== 画像の拡大表示（クリックで全画面） ===== */
.zoomable {
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}
.zoomable:hover { opacity: 0.9; }

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(10, 24, 40, 0.94);
  overscroll-behavior: contain;
}
.img-lightbox.is-open { display: block; }

/* 画面に収める表示 */
.img-lightbox__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 0.75rem 3.25rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.img-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  background: #fff;
  cursor: zoom-in;
}
/* 実寸表示（細かい文字を読むとき） */
.img-lightbox.is-actual .img-lightbox__stage {
  align-items: flex-start;
  justify-content: flex-start;
}
.img-lightbox.is-actual .img-lightbox__img {
  max-width: none;
  max-height: none;
  width: auto;
  cursor: zoom-out;
}

.img-lightbox__close,
.img-lightbox__toggle {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 9999px;
  padding: 0.55rem 1rem;
  min-height: 44px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.img-lightbox__close:hover,
.img-lightbox__toggle:hover { background: rgba(255, 255, 255, 0.25); }
.img-lightbox__close { top: 0.75rem; right: 0.75rem; }
.img-lightbox__toggle { bottom: 0.75rem; left: 50%; transform: translateX(-50%); white-space: nowrap; }

body.lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .zoomable, .img-lightbox__close, .img-lightbox__toggle { transition: none; }
}
