/* =========================================================
   八代市人会 物販応援サイト
   モバイルファースト / 縦スクロール商品フィード
   ========================================================= */

:root {
  --color-bg: #ffffff;
  --color-text: #1b1b1b;
  --color-text-weak: #6a6a6a;
  --color-line: #e6e3dd;
  --color-surface: #f6f4ef;
  --color-accent: #2f5d62;      /* 落ち着いた藍緑（仮アクセント） */
  --color-accent-dark: #244a4e;

  --font-base: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "YuGothic",
    Meiryo, sans-serif;

  --space: 1rem;
  --radius: 4px;
  --header-h: 52px;
  --content-max: 1080px;
  --tap: 44px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--color-accent);
  color: #fff;
  padding: 0.6rem 1rem;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* =========================================================
   ヘッダー
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--color-line);
}

.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space);
}

.site-header__logo {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.menu-toggle {
  width: var(--tap);
  height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: 0;
  margin-right: -0.5rem;
}
.menu-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
}

.site-nav {
  display: none;
  border-top: 1px solid var(--color-line);
  background: #fff;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.site-nav.is-open { display: block; }

.site-nav__list {
  list-style: none;
  margin: 0 auto;
  padding: 0.5rem var(--space) 0.25rem;
  max-width: var(--content-max);
}
.site-nav__list li { border-bottom: 1px solid var(--color-line); }
.site-nav__list li:last-child { border-bottom: 0; }
.site-nav__list a {
  display: block;
  padding: 0.85rem 0.25rem;
  text-decoration: none;
  min-height: var(--tap);
}

/* --- 絞り込みメニュー --- */

.site-nav__filters {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.5rem var(--space) 1.25rem;
}

.filter-group + .filter-group { margin-top: 1rem; }

.filter-group__title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-weak);
  letter-spacing: 0.04em;
}

.filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-list__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--tap);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.3;
}
.filter-list__btn:hover { border-color: var(--color-accent); }
.filter-list__btn.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.filter-list__count {
  font-size: 0.78rem;
  color: var(--color-text-weak);
}
.filter-list__btn.is-active .filter-list__count { color: rgba(255, 255, 255, 0.85); }

/* --- 絞り込み状況バー --- */

.filter-bar[hidden] { display: none; }
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.75rem var(--space);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
  font-size: 0.9rem;
}
.filter-bar__label { font-weight: 600; }
.filter-bar__clear {
  min-height: 36px;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: #fff;
  color: var(--color-accent);
  font-size: 0.85rem;
  font-weight: 600;
}
.filter-bar__clear:hover { background: var(--color-accent); color: #fff; }

/* =========================================================
   商品フィード
   ========================================================= */

.feed {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem var(--space) 0;
}

.feed__loading,
.feed__empty {
  text-align: center;
  color: var(--color-text-weak);
  padding: 4rem 1rem;
}

.product {
  padding: 2.5rem 0 3rem;
  border-bottom: 1px solid var(--color-line);
}
.product:first-child { padding-top: 1rem; }

/* スクロール時の軽い表示（JS 有効時のみ隠す） */
.js .is-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .is-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --- 商品画像（カルーセル） --- */

.product__media { margin-bottom: 1.25rem; }

.carousel {
  position: relative;
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.carousel__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel__track::-webkit-scrollbar { display: none; }

.carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: block;
}

.carousel__img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--color-surface);
}

/* 画像が無い / 読み込み失敗時のプレースホルダー */
.carousel__img.is-placeholder,
img.is-placeholder {
  background:
    repeating-linear-gradient(
      45deg,
      #efece5,
      #efece5 12px,
      #e7e3da 12px,
      #e7e3da 24px
    );
}
.carousel__img.is-placeholder { min-height: 0; }

.carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: var(--color-text);
  font-size: 1.4rem;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.carousel__nav--prev { left: 0.5rem; }
.carousel__nav--next { right: 0.5rem; }

.carousel__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.6rem;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}
.carousel__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.carousel__dot.is-active {
  background: #fff;
  transform: scale(1.15);
}

/* --- 商品情報 --- */

.product__info { }

.product__maker {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-weak);
}
.product__area {
  margin: 0.1rem 0 0.6rem;
  font-size: 0.85rem;
  color: var(--color-text-weak);
}
.product__name {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  line-height: 1.45;
  font-weight: 700;
}
.product__name a { text-decoration: none; }
.product__catch {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  color: #333;
}
.product__price {
  margin: 0 0 1.1rem;
  font-size: 1.15rem;
  font-weight: 700;
}
.product__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: var(--tap);
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
.product__link:hover {
  background: var(--color-accent);
  color: #fff;
}

/* =========================================================
   このサイトについて / フッター
   ========================================================= */

.about {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3rem var(--space);
  background: var(--color-surface);
}
.about__title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}
.about p { margin: 0 0 1rem; font-size: 0.95rem; }
.about p:last-child { margin-bottom: 0; }

.site-footer {
  text-align: center;
  padding: 2.5rem var(--space) 3rem;
  color: var(--color-text-weak);
  font-size: 0.85rem;
}
.site-footer__name { margin: 0 0 0.3rem; }
.site-footer__note { margin: 0; }

/* =========================================================
   商品詳細ページ
   ========================================================= */

.detail {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem var(--space) 3rem;
}

.detail__back {
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.detail__back a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  text-decoration: none;
  color: var(--color-accent);
}
.detail__back--bottom { margin-top: 2.5rem; }

.detail__hero {
  margin: 0 0 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.detail__hero-img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.detail__name {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  line-height: 1.45;
}
.detail__maker { margin: 0; color: var(--color-text-weak); font-size: 0.95rem; }
.detail__area { margin: 0.1rem 0 0.75rem; color: var(--color-text-weak); font-size: 0.9rem; }
.detail__price {
  margin: 0.5rem 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.detail__catch {
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.detail__description {
  margin: 0 0 2rem;
  color: #333;
}

.detail__gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0 0 2rem;
}
.detail__gallery-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-surface);
  border-radius: var(--radius);
}

/* 販売先 */
.detail__sales {
  margin: 0 0 2rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius);
}
.detail__sales-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}
.detail__sales-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.detail__sales-note {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-weak);
}
.detail__sales--none p { margin: 0 0 0.75rem; }
.detail__sales--none p:last-child { margin-bottom: 0; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--tap);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  text-align: center;
}
.btn--sale {
  background: var(--color-accent);
  color: #fff;
}
.btn--sale:hover { background: var(--color-accent-dark); }
.btn__ext { font-weight: 400; }

.detail__maker-box {
  margin: 0 0 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-line);
}
.detail__maker-box-title { margin: 0 0 0.5rem; font-size: 1.05rem; }
.detail__maker-box-name { margin: 0 0 0.4rem; font-weight: 700; }
.detail__maker-link { color: var(--color-accent); }

.detail__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}
.detail__cat {
  font-size: 0.8rem;
  color: var(--color-text-weak);
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

/* =========================================================
   PC / タブレット
   ========================================================= */

@media (min-width: 768px) {
  .feed { padding-top: 2.5rem; }

  .product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
    padding: 3.5rem 0;
  }

  .product__media { margin-bottom: 0; }

  /* 左右交互配置 */
  .product--media-right .product__media { order: 2; }
  .product--media-right .product__info { order: 1; }

  .product__name { font-size: 1.75rem; }

  /* ポインタ操作時はナビ矢印を表示 */
  .carousel:hover .carousel__nav { display: flex; }

  .detail { max-width: 860px; padding-top: 2rem; }
  .detail__hero-img { aspect-ratio: 3 / 2; }
  .detail__gallery { grid-template-columns: repeat(3, 1fr); }

  .detail__sales-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .btn--sale { flex: 1 1 240px; }
}

@media (min-width: 1024px) {
  .product { gap: 3.5rem; }
}

/* =========================================================
   モーションを控えめに
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .js .is-reveal { opacity: 1; transform: none; }
}
