/*=================== 銘柄詳細(/brand/detail.html) =====================*/
/* theme.css の変数に追従させるためのローカルエイリアス */
:root {
  --detail-surface-1: var(--surface-1, #ffffff);
  --detail-surface-2: var(--surface-2, #f5f5f5);
  --detail-text: var(--text, #111827);
  --detail-muted: var(--muted, #6b7280);
  --detail-border: var(--border, #e5e7eb);
  --detail-accent: var(--accent, #2563eb);
  --detail-accent-soft: var(--accent-soft, rgba(37, 99, 235, 0.14));
  --detail-shadow: var(--shadow, rgba(17, 24, 39, 0.12));
  --detail-focus-ring: var(--focus-ring, rgba(37, 99, 235, 0.55));
}

/* モバイルファースト: 1カラムで縦に積む */
.brand-hero {
  display: grid;
  grid-template-columns: 1fr; /* モバイルは1カラム */
  grid-auto-rows: auto;
  gap: 0;
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--detail-surface-1);
  color: var(--detail-text);
  margin-top: 16px;
}
.brand-hero__name {
  grid-column: 1 / 2;
  padding: 12px 16px;
  border-bottom: 1px solid var(--detail-border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.brand-title {
  margin: 0;
  font-size: 22px;
}
.brand-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 8px 0;
}
.brand-actions form {
  display: inline-block;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--detail-border);
  background: var(--detail-surface-1);
  color: var(--detail-text);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--detail-surface-2);
}
.icon-btn i {
  font-size: 18px;
  line-height: 1;
}
.icon-btn--heart i {
  color: var(--detail-accent);
}
/* 比較アイコン: テキスト選択不可 */
.icon-btn--compare {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}
.icon-btn--compare.is-active {
  background: #fff;
  border-color: #e2e2e2;
  box-shadow: none;
  color: inherit;
}
.icon-btn--compare.is-active i {
  color: var(--detail-accent);
}
.brand-hero__photo {
  grid-column: 1 / 2;
  border-bottom: 1px solid var(--detail-border); /* モバイルは下線区切り */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
}

/* 写真枠（プレースホルダ用） */
.brand-hero__photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 写真右下の操作ボタン（比較/お気に入り） */
.brand-hero__photo-actions {
  position: absolute;
  right: 12px;
  bottom: 16px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 写真上でも視認できるように背景を少し付ける */
.brand-hero__photo-actions .icon-btn {
  width: 42px;
  height: 42px;
  background: var(--detail-surface-1);
  background: color-mix(in srgb, var(--detail-surface-1) 92%, transparent);
  box-shadow: 0 2px 10px var(--detail-shadow);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease,
    border-color 0.12s ease;
}

.brand-hero__photo-actions .icon-btn i {
  font-size: 20px;
}

/* ホバー/フォーカスで強調（アクセシビリティのためfocus-visibleも対応） */
.brand-hero__photo-actions .icon-btn:hover,
.brand-hero__photo-actions .icon-btn:focus-visible {
  background: var(--detail-surface-1);
  background: color-mix(in srgb, var(--detail-surface-1) 98%, transparent);
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 6px 18px var(--detail-shadow);
  border-color: color-mix(in srgb, var(--detail-accent) 35%, var(--detail-border));
}

.brand-hero__photo-actions .icon-btn:focus-visible {
  outline: none;
  box-shadow:
    0 6px 18px var(--detail-shadow),
    0 0 0 3px color-mix(in srgb, var(--detail-focus-ring) 35%, transparent);
}
.brand-hero__photo > img {
  max-width: 100%;
  height: auto;
  display: block;
}
.brand-hero__photo--placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--detail-muted);
  background: var(--detail-surface-2);
}

/* ===== 写真カルーセル（銘柄詳細） ===== */
.photo-carousel {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
}

.photo-carousel__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  user-select: none;
}

.photo-carousel__viewport {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.photo-carousel__viewport::-webkit-scrollbar {
  display: none;
}

.photo-carousel__track {
  display: flex;
  height: 100%;
}

.photo-carousel__slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--detail-surface-1);
}

.photo-carousel__img {
  /* 正方形領域内で写真全体が必ず見える（余白は許容） */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.photo-carousel__dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 15px 0;
  user-select: none;
}

.photo-carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--detail-muted) 35%, var(--detail-border));
}

.photo-carousel__dot.is-active {
  background: var(--detail-text);
}

.photo-carousel__nav {
  display: inline-flex;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--detail-border);
  background: var(--detail-surface-1);
  background: color-mix(in srgb, var(--detail-surface-1) 92%, transparent);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--detail-text);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* マウスカーソルが写真領域にある時だけ前後ボタンを表示（キーボード操作も考慮） */
.photo-carousel__frame:hover .photo-carousel__nav,
.photo-carousel__frame:focus-within .photo-carousel__nav {
  opacity: 1;
  pointer-events: auto;
}

.photo-carousel__nav:hover {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--detail-focus-ring) 20%, transparent);
}

.photo-carousel__nav--prev {
  left: 8px;
}

.photo-carousel__nav--next {
  right: 8px;
}
.brand-hero__right {
  grid-column: 1 / 2; /* モバイルは写真の下に配置 */
  display: grid;
  grid-template-rows: 1fr auto;
}
.brand-hero__taste {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.taste-placeholder {
  width: 100%;
  height: 100%;
  border-left: 0;
  color: var(--detail-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-hero__meta {
  display: grid;
  grid-template-columns: 1fr; /* モバイルは縦並び */
  border-top: 1px solid var(--detail-border);
}
.brand-hero__review {
  padding: 12px 16px;
  border-right: 0; /* モバイルは右線なし */
  text-align: center;
}
.brand-hero__lowest {
  padding: 12px 16px;
  text-align: center;
  font-weight: 700;
}

/* アクセシビリティ補助 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.brand-spec {
  margin-top: 16px;
  background: var(--detail-surface-1);
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr; /* モバイルは1カラム */
  color: var(--detail-text);
}
.brand-spec__title {
  grid-column: 1 / 2; /* 1カラムの幅いっぱい */
  text-align: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--detail-border);
  font-weight: 700;
}
.brand-spec__cell {
  padding: 14px 12px;
  border-top: 1px solid var(--detail-border);
  border-right: 0;
}
.brand-spec .brand-spec__cell:nth-of-type(2n) {
  border-right: 1px solid var(--detail-border);
}
.tab-area {
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 16px;
  background: var(--detail-surface-1);
  color: var(--detail-text);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.tab-btn {
  padding: 12px 8px;
  border: 0;
  border-right: 1px solid var(--detail-border);
  background: var(--detail-surface-1);
  color: var(--detail-text);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px; /* モバイルでも読みやすい */
}
.tab-btn:last-child {
  border-right: 0;
}
.tab-btn.is-active {
  background: var(--detail-surface-2);
  background: color-mix(in srgb, var(--detail-accent-soft) 70%, var(--detail-surface-1));
}
.tab-panels {
  border-top: 1px solid var(--detail-border);
  padding: 20px;
  text-align: center;
}
.tab-panel {
  display: none;
}
.tab-panel.is-active {
  display: block;
}

/* 価格表 */
.table-scroll {
  overflow-x: auto;
}
.table-scroll table {
  width: 100%;
  border-collapse: collapse;
}
.table-scroll th,
.table-scroll td {
  padding: 8px;
  border-bottom: 1px solid var(--detail-border);
  white-space: nowrap;
}
/* 味と特徴 */
.tags-layout {
  display: grid;
  gap: 16px;
  text-align: left;
}
.tags-block {
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--detail-surface-2);
}
.tags-block h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--detail-text);
}
.tags-desc {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--detail-muted);
}
.tags-empty {
  margin: 0;
  color: var(--detail-muted);
}
.tag-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--detail-accent-soft);
  background: color-mix(in srgb, var(--detail-accent-soft) 85%, var(--detail-surface-1));
  color: var(--detail-accent);
  font-size: 12px;
  border: 1px solid color-mix(in srgb, var(--detail-accent) 25%, var(--detail-border));
}
.tag-chip--aroma {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #9d174d;
  background: color-mix(in srgb, #ec4899 16%, var(--detail-surface-1));
  border-color: color-mix(in srgb, #ec4899 32%, var(--detail-border));
  color: color-mix(in srgb, #ec4899 70%, var(--detail-text));
}
.tag-chip--drink {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #155e75;
  background: color-mix(in srgb, #06b6d4 14%, var(--detail-surface-1));
  border-color: color-mix(in srgb, #06b6d4 28%, var(--detail-border));
  color: color-mix(in srgb, #06b6d4 65%, var(--detail-text));
}
.tag-chip--taste {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: color-mix(in srgb, #3b82f6 14%, var(--detail-surface-1));
  border-color: color-mix(in srgb, #3b82f6 28%, var(--detail-border));
  color: color-mix(in srgb, #3b82f6 70%, var(--detail-text));
}
.tag-chip--feature {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
  background: color-mix(in srgb, #f59e0b 16%, var(--detail-surface-1));
  border-color: color-mix(in srgb, #f59e0b 30%, var(--detail-border));
  color: color-mix(in srgb, #f59e0b 70%, var(--detail-text));
}
.tag-chip--secondary {
  background: var(--detail-surface-2);
  border-color: var(--detail-border);
  color: var(--detail-muted);
}

/* レビュー */
.review-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.review-item {
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--detail-surface-1);
}
.review-meta {
  font-size: 12px;
  color: var(--detail-muted);
  display: flex;
  gap: 8px;
}
.badge {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--detail-border);
  border-radius: 10px;
  font-size: 11px;
  background: var(--detail-surface-2);
  color: var(--detail-text);
}

/* 解説レイアウト */
.about {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.about__toc {
  border: 1px solid var(--detail-border);
  padding: 12px;
  border-radius: 6px;
  background: var(--detail-surface-2);
  position: static;
  height: fit-content;
  text-align: left;
}
.about__toc-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.about__toc-list {
  margin: 0;
  padding-left: 18px;
}
.about__toc-list li {
  margin: 6px 0;
}
.about__toc-list a {
  color: var(--detail-accent);
  text-decoration: none;
}
.about__toc-list a:hover {
  text-decoration: underline;
}
.about__sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
  text-align: left;
}
.about-section h2 {
  font-size: 18px;
  border-bottom: 2px solid var(--detail-border);
  padding: 8px 0;
  margin: 0 0 8px;
}
.about-section__body {
  padding: 8px 0;
  color: var(--detail-text);
}

/* 1カラム表示のためブレークポイント調整は不要 */
/* ↑ モバイルは1カラム。以下でタブレット以上のレイアウトを復元 */

/* ===================- タブレット用（768px以上）======================== */
@media screen and (min-width: 768px) {
  .brand-title {
    font-size: 24px; /* タブレットで少し大きく */
  }
  .brand-hero {
    grid-template-columns: 1fr 1fr; /* 2カラムに戻す */
    grid-template-rows: auto 1fr;
  }
  .brand-hero__name {
    grid-column: 1 / 3;
  }
  .brand-hero__photo {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    border-bottom: 0;
    border-right: 1px solid var(--detail-border);
    min-height: 280px;
  }
  .brand-hero__right {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
  }
  .brand-hero__meta {
    grid-template-columns: 1fr 1fr; /* 横2分割 */
  }
  .brand-hero__review {
    border-right: 1px solid var(--detail-border); /* 右線復活 */
  }
  .brand-spec {
    grid-template-columns: 1fr 1fr; /* 2カラムに戻す */
  }
  .brand-spec__title {
    grid-column: 1 / 3; /* タイトルは横断 */
  }
  .tab-btn {
    font-size: 15px;
  }

  .tags-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ======================= PC用（1024px以上）======================== */
@media screen and (min-width: 1024px) {
  .brand-title {
    font-size: 28px; /* PCではさらに大きく */
  }
  .tab-btn {
    font-size: 16px;
  }

  /* PCはボタン操作前提：位置ズレを避けるため横スクロールは隠す */
  .photo-carousel__viewport {
    overflow-x: hidden;
  }
}

/*=================== 下部スライダー共通 =====================*/
.slider-section {
  margin-top: 24px;
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  background: var(--detail-surface-1);
  overflow: hidden;
  color: var(--detail-text);
}
.slider-header {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--detail-border);
  font-weight: 700;
}
.slider-body {
  position: relative;
  padding: 16px 56px 16px 16px;
}
.slider-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.slider-track::-webkit-scrollbar {
  display: none;
}
.item-card {
  display: block;
  text-decoration: none;
  color: var(--detail-text);
  border: 1px solid var(--detail-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--detail-surface-1);
}
.item-card .thumb {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--detail-muted);
  background: var(--detail-surface-2);
  border-bottom: 1px solid var(--detail-border);
}
.item-card .title {
  padding: 8px;
  font-weight: 700;
  text-align: center;
}
.slider-next {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid var(--detail-border);
  background: var(--detail-surface-1);
  color: var(--detail-text);
  cursor: pointer;
}
.slider-next:hover {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--detail-focus-ring) 20%, transparent);
}
