/* TPFAI 書籍・著者ページ 共通スタイル */
.tpfai-content-wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.tpfai-archive-header { text-align: center; margin-bottom: 32px; }
.tpfai-archive-header h1 { font-size: 28px; margin-bottom: 8px; }

/* 書籍個別ヘッダ */
.tpfai-book-header { display: flex; gap: 28px; align-items: flex-start; margin-bottom: 32px; flex-wrap: wrap; }
.tpfai-book-cover {
  flex: 0 0 200px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,.08),
    0 10px 24px rgba(0,0,0,.12),
    inset 0 0 0 1px rgba(255,255,255,.4);
}
.tpfai-book-cover img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(.88) contrast(.95) brightness(1.02) blur(.4px);
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}
.tpfai-book-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 35%);
  pointer-events: none;
  mix-blend-mode: overlay;
}
.tpfai-book-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 15%, rgba(255,255,255,.22) 0%, transparent 55%),
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,.12) 100%);
  pointer-events: none;
}
.tpfai-book-meta { flex: 1 1 320px; }
.tpfai-book-title { font-size: 26px; line-height: 1.4; margin: 0 0 8px; }
.tpfai-book-subtitle { color: #666; margin: 0 0 8px; font-size: 14px; }
.tpfai-book-tagline { font-size: 16px; font-weight: 600; margin: 8px 0 16px; }
.tpfai-book-author { font-size: 14px; margin-bottom: 16px; }

/* CTA */
.tpfai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.tpfai-btn-primary {
  background: linear-gradient(180deg, #ffb347 0%, #ff9900 50%, #ff8800 100%);
  color: #fff !important;
  box-shadow: 0 2px 0 #c76a00, 0 6px 16px rgba(255,136,0,.35);
  border: 1px solid #e07c00;
}
.tpfai-btn-primary:hover {
  background: linear-gradient(180deg, #ffbf5a 0%, #ffa417 50%, #f08d00 100%);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #c76a00, 0 10px 22px rgba(255,136,0,.45);
}
.tpfai-btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #c76a00, 0 3px 10px rgba(255,136,0,.3);
}
.tpfai-btn-primary::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M18.42 14.61c-.22-.28-2.27-.27-3.47-.13-.58.07-.67-.44-.15-.81 1.64-1.16 4.33-.82 4.64-.43.32.39-.09 3.09-1.62 4.39-.24.2-.46.09-.36-.17.35-.86 1.17-2.77.96-2.85zM16.26 16.3c-2.06 1.52-5.05 2.33-7.63 2.33-3.61 0-6.87-1.34-9.33-3.56-.19-.17-.02-.41.21-.28 2.66 1.55 5.95 2.48 9.35 2.48 2.3 0 4.82-.48 7.14-1.47.35-.15.65.23.26.5z'/></svg>") center/contain no-repeat;
}
.tpfai-book-cta { text-align: center; margin: 40px 0; }
.tpfai-book-cta-top { margin: 16px 0 0; }
.tpfai-book-cta-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px 14px;
  background: #fff8e1;
  border: 1px solid #ffc107;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
  letter-spacing: .02em;
  box-shadow: 0 1px 3px rgba(255,193,7,.2);
}
.tpfai-book-cta-price::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #ffc107;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
}
.tpfai-book-cta-price strong {
  color: #d97706;
  font-weight: 900;
}

/* ヘッダ横CTAは縦並び（マイクロコピー上／ボタン下） */
.tpfai-book-cta-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 0;
}
.tpfai-book-cta-top .tpfai-book-cta-price {
  margin-bottom: 0;
  padding: 5px 12px;
  font-size: 12px;
}

/* CTAボックス内の注記は上に配置 */
.tpfai-book-cta-box .tpfai-book-cta-price {
  margin-bottom: 14px;
  font-size: 14px;
  padding: 7px 16px;
}
.tpfai-book-cta-box {
  background: linear-gradient(180deg, #fff9f0 0%, #fff3dd 100%);
  border: 1px solid #f5d9a6;
  border-radius: 12px;
  padding: 28px 24px;
  margin: 40px 0;
  text-align: center;
  box-shadow: 0 4px 12px rgba(255,153,0,.08);
}
.tpfai-book-cta-box .tpfai-book-cta-heading {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #333;
}
.tpfai-book-cta-box .tpfai-book-cta-sub {
  font-size: 14px;
  color: #666;
  margin: 0 0 20px;
  line-height: 1.6;
}

/* スティッキー下部CTA（モバイル） */
.tpfai-sticky-cta {
  display: none;
}
@media (max-width: 768px) {
  .tpfai-sticky-cta {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.97);
    border-top: 1px solid #eee;
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  }
  .tpfai-sticky-cta .tpfai-btn {
    display: flex;
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
  }
  .tpfai-single-book { padding-bottom: 80px; }
}

/* 本文セクション */
.tpfai-book-body h2 { font-size: 22px; border-left: 4px solid #ff9900; padding-left: 12px; margin-top: 32px; }
.tpfai-book-synopsis, .tpfai-book-target, .tpfai-book-preview { margin: 24px 0; }
.tpfai-table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.tpfai-table th, .tpfai-table td { border: 1px solid #e0e0e0; padding: 8px 12px; text-align: left; }
.tpfai-table th { background: #f6f6f6; }

/* A+ コンテンツ */
.tpfai-aplus { display: flex; flex-direction: column; gap: 16px; margin: 32px 0; }
.tpfai-aplus img { width: 100%; max-width: 970px; height: auto; margin: 0 auto; display: block; }

/* 漫画プレビュー */
.tpfai-manga-preview { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }
.tpfai-manga-preview img { width: 100%; max-width: 720px; height: auto; margin: 0 auto; display: block; border: 1px solid #eee; }

/* 書籍グリッド */
.tpfai-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin: 32px 0;
}
.tpfai-book-grid-2col {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}
.tpfai-book-grid-1col {
  grid-template-columns: 1fr;
  max-width: 220px;
  gap: 16px;
}
.tpfai-book-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 14px 14px 16px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.tpfai-book-card::after {
  content: "詳細を見る →";
  display: block;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #ff9900;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed #ffd699;
  letter-spacing: .02em;
  transition: color .18s ease;
}
.tpfai-book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(255,153,0,.15), 0 4px 8px rgba(0,0,0,.06);
  border-color: #ffc107;
  color: inherit;
}
.tpfai-book-card:hover::after {
  color: #e07c00;
}
.tpfai-book-card-cover {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #f5f5f5 0%, #ebebeb 100%);
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 1px 2px rgba(0,0,0,.08),
    0 8px 20px rgba(0,0,0,.10),
    inset 0 0 0 1px rgba(255,255,255,.4);
}
.tpfai-book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 粗さを目立たなくするフィルタ */
  filter: saturate(.88) contrast(.95) brightness(1.02) blur(.4px);
  transition: transform .4s ease, filter .4s ease;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}
.tpfai-book-card:hover .tpfai-book-card-cover img {
  transform: scale(1.04);
  filter: saturate(.95) contrast(.97) brightness(1.02) blur(.2px);
}
/* 表面の光沢グラデで粗さをさらに隠す */
.tpfai-book-card-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 35%),
    linear-gradient(180deg, rgba(255,255,255,.05) 0%, rgba(0,0,0,.05) 100%);
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}
.tpfai-book-card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 15%, rgba(255,255,255,.22) 0%, transparent 55%),
    linear-gradient(180deg, transparent 55%, rgba(0,0,0,.12) 100%);
  pointer-events: none;
  z-index: 2;
}
.tpfai-book-card-cover-placeholder {
  font-size: 36px;
  color: #ccc;
}
.tpfai-book-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: #222;
  margin-top: 2px;
}
.tpfai-book-card-tagline {
  font-size: 11px;
  color: #666;
  line-height: 1.5;
}
/* 著者一覧ページのカード内ではtagline非表示 */
.tpfai-author-card .tpfai-book-card-tagline {
  display: none;
}

/* 関連書籍 */
.tpfai-related-books {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid #eee;
}
.tpfai-related-books h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

/* アーカイブヘッダ強化 */
.tpfai-archive-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 32px 16px;
  background: linear-gradient(180deg, #fff9f0 0%, #fff3dd 100%);
  border-radius: 16px;
  border: 1px solid #f5d9a6;
}
.tpfai-archive-header h1 {
  font-size: 32px;
  margin: 0 0 8px;
  color: #333;
}
.tpfai-archive-header p {
  color: #666;
  margin: 0;
  font-size: 15px;
}
.tpfai-archive-header .tpfai-archive-badge {
  display: inline-block;
  background: #ff9900;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  letter-spacing: .05em;
}

/* 著者 */
.tpfai-author-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid #fff3dd;
}
.tpfai-author-header h1 {
  font-size: 28px;
  margin: 0 0 16px;
  position: relative;
  padding-left: 16px;
}
.tpfai-author-header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 5px;
  background: linear-gradient(180deg, #ffc107 0%, #ff9900 100%);
  border-radius: 3px;
}
.tpfai-author-bio {
  color: #444;
  line-height: 1.8;
}
.tpfai-author-card {
  padding: 28px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  margin-bottom: 24px;
  transition: box-shadow .18s ease;
}
.tpfai-author-card:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
.tpfai-author-card h2 {
  font-size: 20px;
  margin: 0 0 8px;
}
.tpfai-author-card h2 a {
  color: #222;
  text-decoration: none;
  transition: color .15s ease;
}
.tpfai-author-card h2 a:hover {
  color: #ff9900;
}
.tpfai-author-excerpt {
  color: #666;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.7;
}
.tpfai-author-grid { display: flex; flex-direction: column; gap: 20px; }
.tpfai-author-all-books {
  text-align: right;
  margin-top: 20px;
}
.tpfai-author-all-books a {
  display: inline-block;
  padding: 8px 16px;
  background: #fff3dd;
  color: #b45309;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: background .15s ease;
}
.tpfai-author-all-books a:hover {
  background: #ffe4b5;
}

@media (max-width: 640px) {
  .tpfai-book-header { flex-direction: column; }
  .tpfai-book-cover { flex: 0 0 auto; max-width: 240px; margin: 0 auto; }
}

/* ===== カードカルーセル（横スライド可能な書籍/関連コンテンツ用） ===== */
.tpfai-card-carousel {
  position: relative;
  margin: 32px 0;
}
.tpfai-card-carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 200px);
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 8px;
  padding: 8px 8px 18px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #ffc107 #fff3dd;
}
.tpfai-card-carousel-track::-webkit-scrollbar {
  height: 8px;
}
.tpfai-card-carousel-track::-webkit-scrollbar-track {
  background: #fff3dd;
  border-radius: 4px;
}
.tpfai-card-carousel-track::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ffc107 0%, #ff9900 100%);
  border-radius: 4px;
}
.tpfai-card-carousel-track > .tpfai-book-card {
  scroll-snap-align: start;
  min-width: 0;
}
.tpfai-card-carousel::before,
.tpfai-card-carousel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 18px;
  width: 32px;
  pointer-events: none;
  z-index: 2;
}
.tpfai-card-carousel::before {
  left: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 100%);
}
.tpfai-card-carousel::after {
  right: 0;
  background: linear-gradient(270deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 100%);
}
.tpfai-card-carousel-hint {
  display: none;
  text-align: center;
  font-size: 11px;
  color: #b45309;
  margin-top: -6px;
  letter-spacing: .04em;
}
.tpfai-card-carousel-hint::before { content: "← "; }
.tpfai-card-carousel-hint::after { content: " →"; }
@media (max-width: 768px) {
  .tpfai-card-carousel-track {
    grid-auto-columns: 64%;
    gap: 14px;
  }
  .tpfai-card-carousel-hint { display: block; }
}
@media (max-width: 480px) {
  .tpfai-card-carousel-track {
    grid-auto-columns: 78%;
  }
}

/* 関連書籍ブロックをカルーセル化したときの調整 */
.tpfai-related-books .tpfai-card-carousel {
  margin-top: 8px;
}

/* ===== .tpfai-book-grid を狭い画面で自動的に横スライド化 ===== */
@media (max-width: 768px) {
  .tpfai-book-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 62%;
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding: 6px 6px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ffc107 #fff3dd;
  }
  .tpfai-book-grid::-webkit-scrollbar { height: 8px; }
  .tpfai-book-grid::-webkit-scrollbar-track { background: #fff3dd; border-radius: 4px; }
  .tpfai-book-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffc107 0%, #ff9900 100%);
    border-radius: 4px;
  }
  .tpfai-book-grid > .tpfai-book-card {
    scroll-snap-align: start;
    min-width: 0;
  }
}
@media (max-width: 480px) {
  .tpfai-book-grid {
    grid-auto-columns: 74%;
  }
}
