/* ============================================
   よりみちカフェ - Cafe Style CSS
   ============================================ */

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

body {
  background: #fffcf9;
  color: #4e3b2d;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 15px;
  line-height: 1.8;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* --- Header --- */
.site-header {
  background: linear-gradient(135deg, #f5efe6 0%, #ede4d8 100%);
  border-bottom: none;
  position: sticky; top: 0; z-index: 9000;
  box-shadow: 0 2px 16px rgba(78,59,45,0.08);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
}
.site-logo {
  font-family: "Noto Serif JP", Georgia, serif;
  font-weight: 700;
  font-size: 24px;
  color: #4e3b2d;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.site-logo .logo-icon { font-size: 24px; }
.site-logo span {
  background: linear-gradient(135deg, #c67a5c, #c9a96e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-test-badge {
  color: #c67a5c; font-size: 10px; margin-left: 8px;
  border: 1px solid #c67a5c; padding: 1px 6px; border-radius: 8px;
}

/* --- Header Nav --- */
.header-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.nav-format-group {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}
.nav-item {
  font-size: 13px;
  font-weight: 500;
  color: #6b5d50;
  padding: 7px 14px;
  border-radius: 20px;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-item:hover {
  background: #c67a5c;
  color: #fff;
}
.nav-ranking {
  background: rgba(198,122,92,0.1);
  color: #c67a5c;
  font-weight: 700;
}
.nav-ranking:hover {
  background: #c67a5c;
  color: #fff;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: #4e3b2d;
  cursor: pointer;
  padding: 4px 8px;
}
.nav-genre-section { display: none; }

/* --- Wave Decoration --- */
.wave-decoration {
  display: block;
  width: 100%;
  height: 30px;
  background: #f5efe6;
}
.wave-decoration svg {
  display: block;
  width: 100%;
  height: 30px;
}

/* --- Section Heading --- */
.section-heading {
  max-width: 1100px;
  margin: 36px auto 20px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-heading .emoji { font-size: 22px; }
.section-heading h2 {
  font-family: "Noto Serif JP", Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  color: #4e3b2d;
  white-space: nowrap;
}
}
.section-heading::after {
  content: ""; flex: 1; height: 0;
  border-bottom: 2px dashed #d4cbbe;
}

/* --- Pickup Grid (1 page only) --- */
.pickup-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.pickup-card {
  display: block;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(78,59,45,0.08);
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
}
.pickup-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 28px rgba(78,59,45,0.16);
}
.pickup-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f0e8dc;
}
.pickup-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.pickup-card:hover .pickup-thumb img {
  transform: scale(1.05);
}
.pickup-info {
  padding: 14px 16px;
}
.pickup-format {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #7a9a6d;
  background: rgba(122,154,109,0.1);
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.pickup-info h3 {
  font-family: "Noto Serif JP", serif;
  font-size: 15px;
  font-weight: 700;
  color: #4e3b2d;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pickup-circle {
  font-size: 12px;
  color: #8a7a6b;
  margin-bottom: 6px;
}
.pickup-rating {
  font-size: 14px;
  font-weight: 700;
  color: #c67a5c;
}

/* ===== MAIN + SIDEBAR LAYOUT ===== */
.page-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  gap: 28px;
}
.page-main {
  flex: 1;
  min-width: 0;
}
.page-sidebar {
  width: 240px;
  flex-shrink: 0;
}

/* --- Sidebar --- */
.sidebar-section {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(78,59,45,0.06);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #f0e8dc;
}
.sidebar-section-title {
  font-family: "Noto Serif JP", serif;
  font-size: 15px;
  font-weight: 700;
  color: #4e3b2d;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px dashed #e8ddd0;
}

/* --- Sidebar: Format (icon grid) --- */
.sidebar-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sidebar-format-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: 12px;
  background: #faf6f1;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.sidebar-format-item:hover {
  background: #f5efe6;
  border-color: #e0d5c7;
}
.sidebar-format-item.active {
  background: rgba(198,122,92,0.08);
  border-color: #c67a5c;
}
.sidebar-format-item .fmt-icon {
  font-size: 24px;
}
.sidebar-format-item .fmt-name {
  font-size: 11px;
  font-weight: 600;
  color: #6b5d50;
  text-align: center;
  line-height: 1.3;
}
.sidebar-format-item .fmt-count {
  font-size: 10px;
  color: #a89a8c;
}
.sidebar-format-item.active .fmt-name {
  color: #c67a5c;
}

/* --- Sidebar: Genre (tag cloud) --- */
.sidebar-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sidebar-genre-tag {
  font-size: 12px;
  color: #6b5d50;
  background: #faf6f1;
  padding: 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.sidebar-genre-tag:hover {
  background: #f0e8dc;
  border-color: #d4cbbe;
}
.sidebar-genre-tag.active {
  background: #c67a5c;
  color: #fff;
  border-color: #c67a5c;
}
.sidebar-genre-tag.large {
  font-size: 14px;
  font-weight: 700;
  padding: 5px 14px;
}
.sidebar-genre-tag.medium {
  font-size: 13px;
  font-weight: 500;
}

/* --- Sidebar: Ranking --- */
.sidebar-ranking-list {
  list-style: none;
}
.sidebar-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f5efe6;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-ranking-item:last-child { border-bottom: none; }
.sidebar-ranking-item:hover { background: #faf6f1; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.ranking-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.ranking-badge.r1 { background: linear-gradient(135deg, #c9a96e, #e8c547); }
.ranking-badge.r2 { background: linear-gradient(135deg, #a8a8a8, #c0c0c0); }
.ranking-badge.r3 { background: linear-gradient(135deg, #b87333, #cd8c52); }
.ranking-badge.r4, .ranking-badge.r5 { background: #d4cbbe; }
.ranking-info { flex: 1; min-width: 0; }
.ranking-title {
  font-size: 13px; font-weight: 600; color: #4e3b2d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ranking-sales {
  font-size: 11px; color: #c67a5c; font-weight: 600;
}

/* Legacy sidebar-tag (fallback) */
.sidebar-tag-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #4e3b2d;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}
.sidebar-tag:hover { background: #f5efe6; }
.sidebar-tag.active {
  color: #c67a5c;
  background: rgba(198,122,92,0.08);
  font-weight: 700;
}
.sidebar-tag .tag-count {
  font-size: 11px; color: #a89a8c;
  background: #f5efe6; padding: 1px 8px; border-radius: 10px;
}
.sidebar-tag.active .tag-count {
  color: #c67a5c;
  background: rgba(198,122,92,0.1);
}

/* --- Active Filter Display --- */
.active-filter-display {
  font-size: 13px;
  color: #6b5d50;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.active-filter-display .filter-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(198,122,92,0.1);
  color: #c67a5c;
  padding: 3px 12px;
  font-size: 12px;
  border-radius: 16px;
  cursor: pointer;
}
.active-filter-display .filter-tag.format {
  background: rgba(122,154,109,0.1);
  color: #7a9a6d;
}
.active-filter-display .filter-tag::after {
  content: '\00d7';
  margin-left: 6px;
  font-size: 14px;
}
.active-filter-display .filter-tag:hover { opacity: 0.7; }
.active-filter-display .clear-all {
  font-size: 12px;
  color: #8a7a6b;
  cursor: pointer;
  margin-left: 4px;
}
.active-filter-display .clear-all:hover { color: #c67a5c; }

/* --- Result Count --- */
.result-count {
  font-size: 13px;
  color: #8a7a6b;
  margin-bottom: 12px;
}

/* ===== GRID CARDS (top.html) ===== */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.work-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(78,59,45,0.08);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.work-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(78,59,45,0.14);
}
.work-card a { display: block; }
.work-card .card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.work-card .card-rating-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(198,122,92,0.92);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
}
.work-card .card-info {
  padding: 14px;
}
.work-card .card-title {
  font-family: "Noto Serif JP", serif;
  font-size: 14px;
  font-weight: 700;
  color: #4e3b2d;
  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: #8a7a6b;
  margin-bottom: 6px;
}
.work-card .card-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  margin-bottom: 6px;
}
.work-card .card-sales {
  color: #c67a5c;
  font-weight: 700;
}
.work-card .no-data {
  opacity: 0.35;
}
.work-card .card-date {
  color: #8a7a6b;
}
.work-card .card-rating {
  color: #fff;
  font-weight: 700;
}
.work-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.work-card .card-tag {
  font-size: 10px;
  font-weight: 600;
  color: #c67a5c;
  background: rgba(198,122,92,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.work-card .card-tag:hover {
  background: #c67a5c;
  color: #fff;
}
.work-card .card-format {
  font-size: 10px;
  font-weight: 600;
  color: #7a9a6d;
  background: rgba(122,154,109,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.work-card .card-format:hover {
  background: #7a9a6d;
  color: #fff;
}

/* --- Pagination --- */
#pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 32px;
}
#pagination button {
  font-size: 13px;
  font-weight: 700;
  color: #4e3b2d;
  background: #fff;
  border: 1px solid #e0d5c7;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
#pagination button:hover {
  background: #c67a5c;
  color: #fff;
  border-color: #c67a5c;
}
#pagination button.current {
  background: #c67a5c;
  color: #fff;
  border-color: #c67a5c;
}

/* --- Work Detail Page --- */
.container {
  max-width: 840px;
  margin: 32px auto;
  padding: 0 24px;
}
.work-detail {
  background: #fff;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(78,59,45,0.08);
}
.work-title {
  font-family: "Noto Serif JP", serif;
  font-size: 26px; font-weight: 700;
  line-height: 1.4; margin: 24px 0 16px;
}
.work-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 13px; color: #8a7a6b;
  padding-bottom: 16px;
  border-bottom: 2px dashed #e8ddd0;
  margin-bottom: 16px;
}
/* detail page tags */
.work-detail .card-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.work-detail .card-tag,
.work-detail .card-format {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid #e0d5c7;
  color: #6b5d50;
  transition: all 0.2s;
}
.work-detail .card-tag:hover {
  background: #c67a5c; color: #fff; border-color: #c67a5c;
}
.work-detail .card-format:hover {
  background: #7a9a6d; color: #fff; border-color: #7a9a6d;
}
.work-description {
  font-size: 15px; line-height: 2;
  color: #4e3b2d; margin: 24px 0;
}
.work-description p { margin-bottom: 16px; }
/* --- バージョン履歴 --- */
.version-history-toggle { font-size: 13px; color: #c67a5c; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 8px 14px; border: 1px solid rgba(198, 122, 92, 0.35); border-radius: 6px; background: rgba(198, 122, 92, 0.06); transition: background 0.2s; }
.version-history-toggle:hover { background: rgba(198, 122, 92, 0.12); }
.version-history-toggle .arrow { display: inline-block; transition: transform 0.2s; font-size: 10px; }
.version-history-toggle.open .arrow { transform: rotate(90deg); }
.version-history { display: none; margin-bottom: 24px; padding: 8px 0; }
.version-history.open { display: block; }
.version-entry { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(139, 115, 85, 0.2); font-size: 13px; }
.version-entry:last-child { border-bottom: none; }
.version-entry .ver-date { color: #d4c4b0; flex-shrink: 0; width: 90px; }
.version-entry .ver-label { color: #c67a5c; font-weight: 600; flex-shrink: 0; width: 70px; }
.version-entry .ver-note { color: #d4c4b0; flex: 1; }
.cta-area { text-align: center; margin: 32px 0 16px; }
.cta-button {
  display: inline-block;
  background: #c67a5c; color: #fff;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700; font-size: 14px;
  letter-spacing: 1px;
  padding: 14px 40px;
  border-radius: 30px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(198,122,92,0.3);
}
.cta-button:hover { opacity: 0.85; color: #fff; transform: translateY(-2px); }

/* --- Sidebar Backdrop --- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9499;
}
.sidebar-backdrop.open { display: block; }
.sidebar-close-btn { display: none; }

/* --- Gallery (work page) --- */
.work-gallery { display: flex; gap: 12px; margin-bottom: 24px; }
.gallery-main {
  flex: 1; height: 450px;
  display: flex; align-items: center; justify-content: center;
  background: #f5efe6; overflow: hidden;
  border-radius: 12px;
}
.gallery-main img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gallery-side { display: flex; flex-direction: column; gap: 4px; width: 80px; height: 450px; }
.gallery-thumbs {
  flex: 1;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: hidden; padding: 4px 0;
}
.gallery-thumb-wrap { position: relative; flex-shrink: 0; }
.gallery-thumb {
  width: 80px; height: 60px; object-fit: cover;
  cursor: pointer; opacity: 0.6;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: opacity 0.2s, border-color 0.2s;
  display: block;
}
.gallery-thumb:hover { opacity: 0.9; }
.gallery-thumb.active { opacity: 1; border-color: #c67a5c; }
.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;
}
.gallery-scroll-btn {
  width: 80px; height: 24px; flex-shrink: 0;
  background: #f5efe6; border: 1px solid #e0d5c7;
  border-radius: 4px;
  color: #8a7a6b; cursor: pointer; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.gallery-scroll-btn:hover { background: #e8ddd0; }

/* --- Age Gate --- */
.age-gate {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; text-align: center;
  padding: 20px;
}
.age-gate .age-icon { font-size: 56px; margin-bottom: 16px; }
.age-gate h1 {
  font-family: "Noto Serif JP", serif;
  font-weight: 700; font-size: 28px;
  color: #fffcf9;
  margin-bottom: 24px;
}
.age-gate h1 span { color: #c67a5c; }
.age-gate p {
  font-size: 14px; color: #c9b99a;
  margin-bottom: 32px; line-height: 1.8;
}
.btn-group { display: flex; gap: 16px; }
.btn-yes, .btn-no {
  padding: 14px 36px;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700; font-size: 14px;
  border: none; cursor: pointer;
  border-radius: 30px;
  transition: all 0.2s;
}
.btn-yes {
  background: #c67a5c; color: #fff;
  box-shadow: 0 4px 12px rgba(198,122,92,0.35);
}
.btn-no {
  background: #f5efe6; color: #4e3b2d;
  box-shadow: 0 2px 8px rgba(78,59,45,0.1);
}
.btn-yes:hover, .btn-no:hover { transform: translateY(-2px); }

/* --- Footer --- */
.site-footer {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 28px 24px;
  border-top: 2px dashed #e0d5c7;
  text-align: center;
}
.site-footer p {
  font-size: 12px; color: #8a7a6b; line-height: 1.8;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .works-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { position: relative; }
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #f5efe6;
    flex-direction: column;
    padding: 12px 24px;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(78,59,45,0.12);
    border-radius: 0 0 16px 16px;
  }
  .header-nav.open { display: flex; flex-wrap: wrap; flex-direction: row; justify-content: center; }
  .nav-toggle { display: block; }
  .nav-item { text-align: center; padding: 8px 12px; border-radius: 10px; font-size: 13px; }
  .nav-format-group {
    display: contents;
  }

  /* Mobile nav: ジャンルフィルタ */
  .nav-genre-section {
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid #e8ddd0;
    margin-top: 4px;
  }
  .nav-genre-title {
    font-size: 13px;
    font-weight: 700;
    color: #6b5d50;
    margin-bottom: 8px;
  }
  .nav-genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
  }

  /* サイドバーの作品形式・ジャンルをモバイル非表示 */
  .sidebar-format-section,
  .sidebar-genre-section { display: none; }

  .pickup-grid { grid-template-columns: 1fr; gap: 16px; }

  .page-layout { flex-direction: column; }
  .page-sidebar { width: 100%; order: -1; }
  .sidebar-format-grid { grid-template-columns: repeat(3, 1fr); }
  .sidebar-ranking-item { gap: 8px; }

  .works-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .work-card .card-info { padding: 10px; }
  .work-card .card-title { font-size: 13px; }

  .work-gallery { flex-direction: column; }
  .gallery-main { height: 300px; }
  .gallery-side { flex-direction: row; width: 100%; height: auto; }
  .gallery-thumbs { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 0 4px; }
  .gallery-thumb { width: 60px; height: 45px; }
  .gallery-scroll-btn { width: 24px; height: 45px; }

  .work-detail { padding: 20px 16px; }
  .work-title { font-size: 22px; }

  .cta-area {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(245, 239, 230, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #e0d5c7;
    padding: 12px 16px;
    margin: 0;
    text-align: center;
  }
  .cta-area .cta-button {
    width: 100%; max-width: 480px;
    padding: 12px 32px; font-size: 14px;
  }
  .site-footer { padding-bottom: 80px; }
}
