/* ========================================
   リセット & 基本
======================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN",
               "Hiragino Sans", Meiryo, sans-serif;
  background: #f5f5f5;
  color: #222;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.85; }

/* ========================================
   レイアウト
======================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========================================
   ヘッダー
======================================== */
.site-header {
  background: #232f3e;
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.site-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ff9900;
  letter-spacing: .02em;
}

.site-title img {
  vertical-align: middle;
}

/* ========================================
   フッター
======================================== */
.site-footer {
  background: #232f3e;
  color: #aaa;
  font-size: .8rem;
  padding: 20px 0;
  text-align: center;
  margin-top: 48px;
}

/* ========================================
   セクション
======================================== */
.section { margin: 32px 0; }

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #232f3e;
  border-left: 5px solid #ff9900;
  padding-left: 12px;
  margin-bottom: 20px;
}

.empty-message {
  color: #888;
  padding: 32px 0;
  text-align: center;
}

/* ========================================
   キャンペーン一覧グリッド
======================================== */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ========================================
   キャンペーンカード
======================================== */
.campaign-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
  color: inherit;
}

.campaign-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  transform: translateY(-2px);
}

.campaign-card-upcoming {
  opacity: .75;
  cursor: default;
}

.campaign-card-upcoming:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transform: none;
}

/* サムネイルモザイク */
.thumbnail-mosaic {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  background: #eee;
  height: 150px;
}

.thumbnail-mosaic img {
  height: 75px;
  width: auto;
  display: block;
}

.thumbnail-mosaic-dim { filter: grayscale(.5) opacity(.7); }

.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #bbb;
  background: #f0f0f0;
}

/* カード本体 */
.campaign-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.campaign-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discount-highlight {
  color: #c0392b;
  font-size: .9rem;
  font-weight: 700;
}

.countdown {
  font-size: .95rem;
  font-weight: 700;
  color: #c0392b;
}

.countdown-urgent {
  font-size: 1rem;
  color: #e74c3c;
}

.countdown-open {
  font-size: .9rem;
  color: #27ae60;
  font-weight: 600;
}

.start-date {
  font-size: .85rem;
  color: #2980b9;
  font-weight: 600;
}

.asin-count {
  font-size: .85rem;
  color: #555;
}

.card-cta {
  margin-top: auto;
  padding-top: 8px;
  color: #ff9900;
  font-weight: 700;
  font-size: .9rem;
}

/* ========================================
   バッジ
======================================== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  width: fit-content;
}

.badge-urgent {
  background: #e74c3c;
  color: #fff;
}

.badge-pulse {
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; }
  to   { opacity: .65; }
}

.badge-soon {
  background: #e67e22;
  color: #fff;
}

.badge-upcoming {
  background: #2980b9;
  color: #fff;
}

.badge-expired {
  background: #aaa;
  color: #fff;
}

/* ========================================
   キャンペーン展開ボタン
======================================== */
.campaign-card--hidden {
  display: none;
}

.btn-show-all {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: #fff;
  border: 2px solid #ff9900;
  border-radius: 8px;
  color: #ff9900;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-show-all:hover {
  background: #ff9900;
  color: #111;
  opacity: 1;
}

.btn-show-all:focus-visible {
  outline: 2px solid #ff9900;
  outline-offset: 2px;
}

/* ========================================
   パンくずリスト
======================================== */
.breadcrumb {
  font-size: .85rem;
  color: #888;
  margin: 20px 0 8px;
}

.breadcrumb a { color: #2980b9; }
.breadcrumb a:hover { text-decoration: underline; }

/* ========================================
   詳細ページ ヘッダー
======================================== */
.detail-header {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  color: #232f3e;
}

.detail-countdown {
  font-size: 1.4rem;
  font-weight: 700;
  color: #555;
}

.detail-countdown-urgent {
  color: #e74c3c;
}

.detail-countdown-soon {
  color: #e67e22;
}

.detail-countdown-open {
  font-size: 1.1rem;
  font-weight: 600;
  color: #27ae60;
}

.detail-period {
  font-size: .9rem;
  color: #555;
}

.detail-description {
  font-size: .9rem;
  color: #444;
  background: #f9f9f9;
  border-left: 4px solid #ff9900;
  padding: 10px 14px;
  border-radius: 4px;
  white-space: pre-wrap;
}

/* ========================================
   ジャンルフィルター
======================================== */
.genre-filter-wrap { margin-bottom: 24px; }

.genre-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.genre-tab {
  padding: 10px 16px;
  min-height: 44px;
  border: 2px solid #ddd;
  border-radius: 20px;
  font-size: .85rem;
  cursor: pointer;
  background: #fff;
  transition: background .15s, color .15s;
}

.genre-tab:hover { background: #f0f0f0; }

/* ========================================
   ソートボタン
======================================== */
.sort-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.sort-btn {
  padding: 8px 12px;
  min-height: 44px;
  border: 2px solid #ddd;
  border-radius: 20px;
  font-size: .8rem;
  cursor: pointer;
  background: #fff;
  color: #444;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}

.sort-btn:hover:not(:disabled) { background: #f0f0f0; }

.sort-btn-active {
  background: #2980b9;
  color: #fff;
  border-color: #2980b9;
}

.sort-btn-disabled {
  opacity: .4;
  cursor: default;
}

/* ========================================
   書籍グリッド
======================================== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* ========================================
   書籍カード
======================================== */
.book-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
  transition: box-shadow .2s, transform .2s;
}

.book-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  transform: translateY(-2px);
}

/* 書影 */
.book-cover-link { display: block; }

.book-cover-wrap {
  position: relative;
  background: #f0f0f0;
  aspect-ratio: 1 / 1.4;
  overflow: hidden;
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #e74c3c;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.book-cover-placeholder {
  aspect-ratio: 1 / 1.4;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #bbb;
}

/* 書籍情報 */
.book-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.book-title {
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #222;
}

.book-author {
  font-size: .8rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.book-price {
  font-size: 1rem;
  font-weight: 700;
  color: #c0392b;
}

.book-price-basis {
  font-size: .78rem;
  color: #aaa;
  text-decoration: line-through;
}

.book-discount-badge {
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  background: #e74c3c;
  padding: 1px 5px;
  border-radius: 3px;
}

.cover-badge-series {
  background: #2980b9;
}

.cover-badge-free {
  background: #27ae60;
  font-size: .68rem;
  padding: 2px 5px;
}

.badge-new {
  display: inline-block;
  background: #e67e22;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 3px;
}

/* ライトアダルト プレースホルダー */
.book-cover-adult {
  flex-direction: column;
  gap: 4px;
  font-size: 1.8rem;
}

.book-cover-adult-label {
  font-size: .75rem;
  color: #888;
}

/* セールスランク */
.book-sales-rank {
  font-size: .75rem;
  color: #888;
}

/* 付与ポイント */
.book-loyalty-points {
  font-size: .78rem;
  color: #888;
}

/* 無料価格 */
.book-price-free {
  color: #27ae60;
}

.book-series-note {
  font-size: .75rem;
  color: #2980b9;
}

/* 購入ボタン */
.btn-buy {
  display: block;
  background: #ff9900;
  color: #111;
  font-size: .8rem;
  font-weight: 700;
  text-align: center;
  padding: 8px 12px;
  min-height: 44px;
  border-radius: 5px;
  margin-top: 8px;
  transition: background .15s;
}

.btn-buy:hover {
  background: #e68a00;
  opacity: 1;
}

/* ========================================
   価格注記
======================================== */
.price-note {
  font-size: .78rem;
  color: #888;
  margin-top: 20px;
  text-align: center;
}

/* ========================================
   レスポンシブ
======================================== */
@media (max-width: 600px) {
  .campaign-grid {
    grid-template-columns: 1fr;
  }

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

  .detail-title {
    font-size: 1.2rem;
  }

  .detail-countdown {
    font-size: 1.1rem;
  }

  .genre-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .genre-tabs::-webkit-scrollbar { display: none; }

  .sort-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .sort-buttons::-webkit-scrollbar { display: none; }
}
