/*
 * トップページ (index.html) 専用スタイル。
 * デザイントークン、リセット、ヘッダー、モバイル用ヘッダー調整は common.css にある。
 */

/* common.css の基本値の上書き: トップはヘッダーを固定表示にする（hero 側で 140px 分の余白を確保している） */
.header {
  position: fixed;
  left: 0;
  right: 0;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 140px 0 80px;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
}

.hero .container {
  display: flex;
  align-items: center;
  gap: 60px;
  position: relative;
  z-index: 1;
}

.hero-content {
  flex: 1;
}

.hero-tagline {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.3;
  text-wrap: balance;
}

.hero-description {
  font-size: 1.15rem;
  opacity: 0.95;
  margin-bottom: 32px;
  max-width: 500px;
  text-wrap: pretty;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: var(--primary);
  padding: 16px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hero-image {
  flex: 0 0 320px;
}

/* Image Placeholder */
.image-placeholder {
  background: rgba(255, 255, 255, 0.1);
  border: 3px dashed rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

.image-placeholder.phone {
  width: 280px;
  height: 560px;
}

/* iPhone Frame */
.iphone-frame {
  position: relative;
  margin: auto;
  width: 290px;
  max-width: 100%;
  padding: 12px;
  background: #1a1a1a;
  border-radius: 44px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px #333;
}

.iphone-frame::after {
  content: "";
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 5px;
  background: #444;
  border-radius: 3px;
}

.iphone-screen {
  position: relative;
  border-radius: 32px;
  overflow: hidden;
  background: #000;
}

.iphone-screen img {
  display: block;
  width: 100%;
  height: auto;
}

.iphone-frame-small {
  position: relative;
  width: 200px;
  padding: 8px;
  background: #1a1a1a;
  border-radius: 32px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.15),
    inset 0 0 0 2px #333;
  margin: 0 auto;
}

.iphone-frame-small::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: #444;
  border-radius: 2px;
}

.iphone-frame-small .iphone-screen {
  border-radius: 24px;
}

.image-placeholder.screenshot {
  width: 100%;
  height: 400px;
  background: var(--background);
  border-color: var(--border);
  color: var(--text-secondary);
}

/* iPhoneフレーム内にはめる撮影待ちの枠。スクショ差し替え時にこの div ごと img に置き換える。
   aspect-ratio は既存スクショの実寸 1206x2622 と一致させ、差し替え時に高さが変わらないようにする */
.image-placeholder.phone-shot {
  width: 100%;
  aspect-ratio: 1206 / 2622;
  background: var(--background);
  border-color: var(--border);
  color: var(--text-secondary);
  border-width: 2px;
  border-radius: 26px;
  padding: 20px;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.image-placeholder.phone-shot .image-placeholder-icon {
  font-size: inherit;
  margin-bottom: 0;
  line-height: 0;
}

.image-placeholder.phone-shot svg {
  width: 40px;
  height: 40px;
  stroke: currentColor;
}

.image-placeholder.phone-shot .image-placeholder-hint {
  font-size: 0.75rem;
  margin-top: 0;
  word-break: break-all;
}

.image-placeholder-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.image-placeholder-text {
  font-weight: 500;
}

.image-placeholder-hint {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 8px;
}

/* Features Section */
.features {
  padding: 100px 0;
  background: var(--surface);
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-tag {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  /* 見出しの行長を揃え、最終行に数文字だけ残る折り返しを防ぐ */
  text-wrap: balance;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  /* 見出しと違い、行長の均等さより文節の切れ目を優先する */
  text-wrap: pretty;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.feature-card {
  background: var(--background);
  border-radius: 8px;
  padding: 32px;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.feature-icon svg {
  width: 28px;
  height: 28px;
  stroke: white;
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.feature-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* How It Works */
.how-it-works {
  padding: 100px 0;
  background: var(--background);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 40px;
}

.step {
  /* 番号から説明文まで行頭を揃える（下部の機能カードと同じ組み方） */
  text-align: left;
}

.step-number {
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 20px;
}

.step-image {
  margin-bottom: 24px;
}

/* フレーム自体は中央寄せの指定を持つため、番号と見出しの左端に合わせ直す */
.step-image .iphone-frame,
.step-image .iphone-frame-small {
  margin-left: 0;
}

.step-image .image-placeholder {
  height: 320px;
  border-radius: 6px;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.step-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-wrap: pretty;
}

/* Highlights Section */
.highlights {
  padding: 100px 0;
  background: var(--surface);
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.highlight-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  background: var(--background);
  border-radius: 8px;
  transition: transform 0.2s;
}

.highlight-card:hover {
  transform: translateX(4px);
}

.highlight-icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.highlight-icon svg {
  width: 22px;
  height: 22px;
  stroke: white;
}

.highlight-content {
  flex: 1;
}

.highlight-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.highlight-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Target Users Section */
.target-users {
  padding: 100px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.target-users .section-tag {
  background: rgba(255, 255, 255, 0.2);
}

.target-users .section-title {
  color: white;
}

.target-users .section-subtitle {
  color: rgba(255, 255, 255, 0.9);
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 50px;
}

.user-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 32px 24px;
  /* アイコンから説明文まで行頭を揃える（下部の機能カードと同じ組み方） */
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition:
    transform 0.2s,
    background 0.2s;
}

.user-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.15);
}

.user-icon {
  margin-bottom: 16px;
}

.user-icon svg {
  width: 40px;
  height: 40px;
  stroke: white;
}

.user-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.user-description {
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.6;
}

/* Scoring Section */
.scoring {
  padding: 100px 0;
  background: var(--surface);
}

.scoring-content {
  display: flex;
  align-items: center;
  gap: 60px;
}

.feedback-block {
  margin-top: 100px;
}

.feedback-block .section-header {
  margin-bottom: 40px;
}

.feedback-block .steps {
  margin-top: 0;
}

.scoring-text {
  flex: 1;
}

/* 2カラムのテキスト側は左揃え。中央寄せセクション用の auto マージンを打ち消す */
.scoring-text .section-subtitle {
  margin-left: 0;
}

.scoring-image {
  flex: 0 0 400px;
}

.scoring-items {
  margin-top: 32px;
}

.scoring-item {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.scoring-item-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.scoring-item-icon svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

.scoring-item-text {
  flex: 1;
}

.scoring-item-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.scoring-item-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Topics Preview Section */
.topics-preview {
  padding: 100px 0;
  background: var(--background);
}

.topics-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.topic-preview-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

/* 画像はカードの上端いっぱい。Topic.imageUrl は 16:9 で生成されている */
.topic-preview-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--border);
}

.topic-preview-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.topic-preview-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.topic-preview-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.topic-preview-badge {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--background);
  color: var(--text-secondary);
  line-height: 1.6;
}

.topic-preview-badge.type {
  background: var(--primary);
  color: white;
}

/* 難易度の色はアプリ (src/contexts/ThemeContext.tsx の difficulty1〜5) と揃える */
.topic-preview-badge.difficulty {
  color: white;
}

.topic-preview-badge.difficulty-1 {
  background: #06b6d4;
}

.topic-preview-badge.difficulty-2 {
  background: #84cc16;
}

.topic-preview-badge.difficulty-3 {
  background: #f59e0b;
}

.topic-preview-badge.difficulty-4 {
  background: #f97316;
}

.topic-preview-badge.difficulty-5 {
  background: #ef4444;
}

.topic-preview-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 12px;
}

.topic-preview-excerpt {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 20px;
  flex: 1;
}

.topic-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.topic-preview-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.topic-preview-card:hover .topic-preview-link svg {
  transform: translateX(3px);
}

.topics-preview-more {
  text-align: center;
  margin-top: 40px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  background: transparent;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition:
    background 0.2s,
    color 0.2s;
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

/* CTA Section */
.cta {
  padding: 100px 0;
  background: var(--surface);
  text-align: center;
}

.cta-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  /* 説明文を挟まず直下にボタンが来るため、間隔を広めに取る */
  margin-bottom: 32px;
  text-wrap: balance;
}

.cta-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  text-wrap: pretty;
}

.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s;
}

.store-badge:hover {
  transform: translateY(-2px);
}

.store-badge img {
  height: 40px;
  width: auto;
}

/* Footer */
.footer {
  background: var(--text);
  color: white;
  padding: 60px 0 30px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  margin-bottom: 12px;
}

.footer-tagline {
  font-size: 0.9rem;
  opacity: 0.7;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  gap: 60px;
}

.footer-column h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  opacity: 0.9;
}

.footer-column ul {
  list-style: none;
}

.footer-column li {
  margin-bottom: 10px;
}

.footer-column a {
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.footer-column a:hover {
  opacity: 1;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Scroll Reveal */
/* ヒーローはLCP要素を含むため対象外。初期非表示にすると描画完了が遅延する */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s ease-out,
    transform 0.6s ease-out;
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .hero .container {
    flex-direction: column;
    text-align: center;
  }

  .hero-content {
    order: 1;
  }

  .hero-image {
    order: 2;
    flex: none;
  }

  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-buttons {
    justify-content: center;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .highlights-grid {
    grid-template-columns: 1fr;
  }

  .topics-preview-grid {
    grid-template-columns: 1fr;
  }

  .users-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .scoring-content {
    flex-direction: column;
  }

  .feedback-block {
    margin-top: 80px;
  }

  .scoring-image {
    flex: none;
    width: 100%;
    max-width: 400px;
  }

  .footer-content {
    flex-direction: column;
    gap: 40px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 40px;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 120px 0 60px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .users-grid {
    grid-template-columns: 1fr;
  }

  .image-placeholder.phone {
    width: 240px;
    height: 480px;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .store-badge img {
    height: 50px;
  }

  .store-badge-apple img {
    height: 34px;
  }
}
