/* ============================================
   DojinDB - 共通CSS
   データベース×Webアプリ型 / フィルター+グリッド
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Noto Sans JP', 'Segoe UI', sans-serif;
  background: #f6f8fa;
  color: #24292f;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #4f46e5;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #3730a3;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #d0d7de;
  padding: 0 20px;
  height: 56px;
}

.site-header .header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 16px;
}

.site-header .site-logo {
  font-size: 20px;
  font-weight: 800;
  color: #4f46e5;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.site-header .site-tagline {
  font-size: 11px;
  color: #4b5563;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.site-header .site-tagline em {
  font-style: normal;
  color: #4f46e5;
  font-weight: 600;
}

.site-header .header-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.site-header .header-search input {
  width: 100%;
  padding: 7px 12px 7px 36px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 14px;
  color: #24292f;
  background: #f6f8fa;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.site-header .header-search input:focus {
  border-color: #4f46e5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.site-header .header-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 14px;
  pointer-events: none;
}

.site-header .header-nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.site-header .nav-link {
  font-size: 13px;
  color: #57606a;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.site-header .nav-link:hover {
  color: #24292f;
  background: #f6f8fa;
}

.site-header .nav-link.active {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
}

/* --- ページレイアウト (左フィルター + メイン) --- */
.page-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  gap: 20px;
}

/* --- 左サイドバー (フィルターパネル) --- */
.filter-sidebar {
  width: 240px;
  flex-shrink: 0;
}

.filter-section {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.filter-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #24292f;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eaeef2;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: #57606a;
  cursor: pointer;
  transition: color 0.15s;
}

.filter-option:hover {
  color: #24292f;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
  accent-color: #4f46e5;
}

.filter-option .count {
  margin-left: auto;
  font-size: 11px;
  color: #8b949e;
  background: #f6f8fa;
  padding: 1px 6px;
  border-radius: 10px;
}

.filter-reset {
  display: block;
  width: 100%;
  padding: 8px;
  font-size: 13px;
  color: #57606a;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  margin-top: 8px;
}

.filter-reset:hover {
  color: #24292f;
  background: #eaeef2;
}

/* --- メインエリア --- */
.page-main {
  flex: 1;
  min-width: 0;
}

/* --- ソートバー --- */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.sort-bar .result-count {
  font-size: 13px;
  color: #57606a;
}

.sort-bar .result-count strong {
  color: #24292f;
}

.sort-tabs {
  display: flex;
  gap: 2px;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 2px;
}

.sort-tab {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 4px;
  color: #57606a;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s;
  font-weight: 500;
}

.sort-tab:hover {
  color: #24292f;
}

.sort-tab.active {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  font-weight: 600;
}

.view-toggle {
  display: flex;
  gap: 2px;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 2px;
}

.view-btn {
  padding: 5px 10px;
  border: none;
  background: transparent;
  color: #57606a;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.15s;
}

.view-btn.active {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* --- カードグリッド --- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.works-grid.list-view {
  grid-template-columns: 1fr;
}

/* --- カード（グリッド表示） --- */
.work-card {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}

.work-card:hover {
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.work-card .card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.work-card .card-body {
  padding: 12px;
}

.work-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: #24292f;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.work-card .card-circle {
  font-size: 12px;
  color: #57606a;
  margin-bottom: 6px;
}

.work-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.work-card .card-price {
  font-size: 14px;
  font-weight: 700;
  color: #24292f;
}

.work-card .card-dates {
  font-size: 11px;
  color: #8b949e;
}

.work-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.work-card .card-tag {
  font-size: 11px;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.work-card .card-tag:hover {
  background: rgba(79, 70, 229, 0.15);
}

.work-card .card-format {
  font-size: 11px;
  color: #057a55;
  background: rgba(5, 122, 85, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.work-card .card-format:hover {
  background: rgba(5, 122, 85, 0.15);
}

/* --- 評価バッジ --- */
.score-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 38px;
  padding: 3px 6px 3px 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  z-index: 2;
}

.score-badge.score-high {
  background: #22c55e;
}

.score-badge.score-mid {
  background: #eab308;
}

.score-badge.score-low {
  background: #ef4444;
}

.score-badge.score-na {
  background: #8b949e;
}

/* --- カード（リスト表示） --- */
.works-grid.list-view .work-card {
  display: flex;
  flex-direction: row;
}

.works-grid.list-view .work-card .card-thumb {
  width: 180px;
  aspect-ratio: auto;
  height: 120px;
  flex-shrink: 0;
}

.works-grid.list-view .work-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.works-grid.list-view .score-badge {
  position: static;
  flex-shrink: 0;
  margin: auto 12px;
  width: 40px;
  height: 40px;
  font-size: 14px;
}

/* --- 個別作品ページ --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.work-detail {
  max-width: 800px;
  margin: 0 auto;
}

.work-detail .work-title {
  font-size: 22px;
  font-weight: 700;
  color: #24292f;
  margin-bottom: 8px;
}

.work-detail .work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: #57606a;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eaeef2;
}

.work-detail .work-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.work-detail .work-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.work-detail .info-card {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.work-detail .info-card .info-label {
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.work-detail .info-card .info-value {
  font-size: 20px;
  font-weight: 800;
  color: #24292f;
}

.work-detail .info-card .info-value.price {
  color: #4f46e5;
}

.work-detail .info-card .info-value.score-high { color: #22c55e; }
.work-detail .info-card .info-value.score-mid { color: #eab308; }
.work-detail .info-card .info-value.score-low { color: #ef4444; }

.work-detail .work-description {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 32px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 20px;
}

/* --- 画像ギャラリー（詳細ページ） --- */
.work-gallery {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.work-gallery .gallery-main {
  flex: 1;
  min-width: 0;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #d0d7de;
  overflow: hidden;
}

.work-gallery .gallery-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.work-gallery .gallery-side {
  width: 80px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 480px;
}

.gallery-scroll-btn {
  width: 80px;
  height: 24px;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  color: #57606a;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.gallery-scroll-btn:hover {
  background: #eaeef2;
  color: #24292f;
}

.work-gallery .gallery-thumbs {
  flex: 1;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}

.work-gallery .gallery-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
  display: block;
  flex-shrink: 0;
}

.work-gallery .gallery-thumb:hover {
  opacity: 0.85;
}

.work-gallery .gallery-thumb.active {
  border-color: #4f46e5;
  opacity: 1;
}

.work-gallery .gallery-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}

.work-gallery .gallery-thumb-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding-left: 2px;
}

/* --- CTAボタン --- */
.cta-button {
  display: inline-block;
  background: #4f46e5;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 40px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
  width: 100%;
  max-width: 400px;
}

.cta-button:hover {
  background: #4338ca;
  color: #fff;
}

.cta-button:active {
  transform: scale(0.98);
}

.cta-area {
  text-align: center;
  margin: 32px 0;
}

/* --- 年齢確認ゲート --- */
.age-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 24px;
  background: #fff;
}

.age-gate h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
  color: #4f46e5;
}

.age-gate p {
  font-size: 15px;
  color: #57606a;
  margin-bottom: 32px;
  max-width: 400px;
}

.age-gate .btn-group {
  display: flex;
  gap: 16px;
}

.age-gate .btn-yes {
  background: #4f46e5;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 48px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.age-gate .btn-yes:hover {
  background: #4338ca;
}

.age-gate .btn-no {
  background: #f6f8fa;
  color: #57606a;
  font-size: 16px;
  padding: 14px 48px;
  border-radius: 8px;
  border: 1px solid #d0d7de;
  cursor: pointer;
  transition: all 0.2s;
}

.age-gate .btn-no:hover {
  background: #eaeef2;
  color: #24292f;
}

/* --- ページネーション --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination button {
  font-size: 13px;
  color: #57606a;
  background: #fff;
  border: 1px solid #d0d7de;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover {
  color: #24292f;
  background: #f6f8fa;
  border-color: #8b949e;
}

.pagination button.current {
  color: #fff;
  background: #4f46e5;
  border-color: #4f46e5;
  font-weight: 700;
}

/* --- フッター --- */
.site-footer {
  text-align: center;
  padding: 40px 16px;
  font-size: 12px;
  color: #8b949e;
  border-top: 1px solid #d0d7de;
  margin-top: 60px;
  background: #fff;
}

.site-footer a {
  color: #57606a;
  margin: 0 8px;
}

.site-footer a:hover {
  color: #4f46e5;
}

/* --- ハンバーガー（モバイル用フィルター開閉） --- */
.filter-toggle {
  display: none;
  padding: 8px 16px;
  font-size: 14px;
  color: #57606a;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 12px;
  width: 100%;
  text-align: left;
}

.filter-toggle:hover {
  background: #f6f8fa;
}

/* --- レスポンシブ --- */
@media (max-width: 1024px) {
  .works-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .filter-sidebar {
    display: none;
  }

  .filter-sidebar.open {
    display: block;
    width: 100%;
  }

  .filter-toggle {
    display: block;
  }

  .page-layout {
    flex-direction: column;
  }

  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .works-grid.list-view .work-card .card-thumb {
    width: 120px;
    height: 90px;
  }

  .site-header .header-nav {
    display: none;
  }

  .site-header .site-tagline {
    display: none;
  }

  .site-header .header-search {
    max-width: none;
  }

  .work-gallery {
    flex-direction: column-reverse;
  }

  .work-gallery .gallery-main {
    height: 280px;
  }

  .work-gallery .gallery-side {
    width: 100%;
    height: auto;
    flex-direction: row;
  }

  .gallery-scroll-btn {
    width: 24px;
    height: 45px;
  }

  .work-gallery .gallery-thumbs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 6px;
  }

  .work-gallery .gallery-thumb {
    width: 60px;
    height: 45px;
  }

  .work-detail .work-info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .works-grid {
    grid-template-columns: 1fr;
  }

  .work-detail .work-title {
    font-size: 18px;
  }

  .age-gate .btn-group {
    flex-direction: column;
  }

  .sort-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
