/* =========================================================
   OBSCURA — 共有スタイル（構造レイヤー）
   各ページは CSS 変数の上書きとテーマ CSS で差別化する
   ========================================================= */

:root {
  --bg: #ffffff;
  --ink: #17150f;
  --sub: #8a857c;
  --line: #e8e4dd;
  --accent: #cf2e21;          /* セール専用の赤 */
  --font-display: 'Shippori Mincho', serif;
  --font-body: 'Zen Kaku Gothic New', sans-serif;
  --card-gap: 20px;
  --sheet-radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: #edeae5;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
ul { list-style: none; }

/* ---- アプリシェル（モバイルファースト、PCでは中央480px） ---- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  box-shadow: 0 0 48px rgba(30, 25, 15, 0.1);
}

/* ---- カテゴリページャー（横スワイプでストアごと切替） ---- */
.pager {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.pager::-webkit-scrollbar { display: none; }
.panel {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-width: 0;
}

/* ---- カテゴリタブ ---- */
.tabs {
  display: flex;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 30;
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1;
  padding: 14px 0 12px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--sub);
  position: relative;
  transition: color 0.2s;
}
.tab.is-active { color: var(--ink); }
.tab.is-active::after {
  content: '';
  position: absolute;
  left: 26%;
  right: 26%;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
}

/* ---- ヒーロー ---- */
.hero { position: relative; display: block; overflow: hidden; }
.hero img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.hero-copy {
  position: absolute;
  inset: auto 0 0 0;
  padding: 88px 22px 26px;
  color: #fff;
  background: linear-gradient(to top, rgba(15, 12, 8, 0.72), transparent);
}
.hero-en {
  font-size: 11px;
  letter-spacing: 0.42em;
  opacity: 0.85;
  margin-bottom: 6px;
}
.hero-copy h2 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 4px;
}
.hero-sub { font-size: 12px; opacity: 0.85; }

/* ---- セクション見出し ---- */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 30px 20px 14px;
}
.sec-head h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.sec-head .sec-en { font-size: 10px; letter-spacing: 0.3em; color: var(--sub); }
.sec-head.is-sale h3 { color: var(--accent); }

/* ---- 商品グリッド ---- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--card-gap) 14px;
  padding: 0 20px 36px;
}

/* ---- 商品カード ---- */
.card { position: relative; }
.card-media {
  position: relative;
  overflow: hidden;
  background: #f4f1ec;
}
.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain; /* カテゴリスワイプと衝突させない */
  scrollbar-width: none;
  aspect-ratio: 3 / 4;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  user-select: none;
  -webkit-user-drag: none;
}

/* ドット */
.dots {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}
.dots i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.25);
  transition: background 0.2s, transform 0.2s;
}
.dots i.is-on { background: #fff; transform: scale(1.25); }

/* PC ホバー時のみ出る画像送り矢印 */
.arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  place-items: center;
  font-size: 14px;
  z-index: 3;
}
.arrow.prev { left: 8px; }
.arrow.next { right: 8px; }
@media (hover: hover) {
  .card-media:hover .arrow { display: grid; }
  .arrow:hover { background: #fff; }
}

/* ハート */
.heart {
  position: absolute;
  top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  z-index: 3;
  transition: transform 0.15s;
}
.heart:active { transform: scale(0.85); }
.heart svg { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 1.6; transition: fill 0.2s, stroke 0.2s; }
.card.is-fav .heart svg,
.heart.is-fav svg { fill: var(--ink); stroke: var(--ink); }

/* ダブルタップ時のハートバースト */
.heart-burst {
  position: absolute;
  top: 50%; left: 50%;
  width: 64px; height: 64px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  animation: burst 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}
.heart-burst svg { width: 100%; height: 100%; fill: #fff; filter: drop-shadow(0 4px 14px rgba(0,0,0,0.35)); }
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

/* セールバッジ */
.badge-sale {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  z-index: 3;
}

/* カード情報 */
.card-info { display: block; padding: 9px 2px 0; }
.card-brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 2px;
}
.card-name {
  font-size: 12px;
  color: var(--sub);
  line-height: 1.45;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.price { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.price .was {
  font-weight: 400;
  color: var(--sub);
  text-decoration: line-through;
  font-size: 11px;
  margin-right: 6px;
}
.price.is-sale .now { color: var(--accent); }
.price .off {
  color: var(--accent);
  font-size: 10px;
  margin-left: 5px;
}

/* ---- SALE レール（横スクロール） ---- */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 0 20px 34px;
  scroll-snap-type: x proximity;
}
.rail::-webkit-scrollbar { display: none; }
.rail .card { flex: 0 0 44%; scroll-snap-align: start; }

/* ---- 下部タブバー ---- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  display: flex;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 40;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--sub);
  position: relative;
  transition: color 0.2s;
}
.tabbar button.is-active { color: var(--ink); }
.tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.tabbadge {
  position: absolute;
  top: -3px;
  left: calc(50% + 4px);
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  padding: 0 4px;
  text-align: center;
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.4, 1.9, 0.5, 1);
}
.tabbadge.show { transform: scale(1); }
.tabbadge.pop { animation: badge-pop 0.4s cubic-bezier(0.4, 1.9, 0.5, 1); }
@keyframes badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ---- ボトムシート ---- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 12, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 50;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 105%);
  width: min(100%, 480px);
  max-height: 76dvh;
  background: var(--bg);
  z-index: 60;
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0.24, 1);
  display: flex;
  flex-direction: column;
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.sheet-head .count { font-size: 11px; color: var(--sub); letter-spacing: 0.1em; }
.sheet-close { font-size: 12px; color: var(--sub); letter-spacing: 0.1em; }
.sheet-body { overflow-y: auto; padding: 6px 20px 34px; overscroll-behavior: contain; }
.sheet-empty {
  padding: 52px 0 40px;
  text-align: center;
  color: var(--sub);
  font-size: 13px;
  line-height: 2;
}
.sheet-empty .big { font-size: 30px; display: block; margin-bottom: 8px; }

/* シート内の商品行 */
.row {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.row img { width: 64px; height: 80px; object-fit: cover; flex-shrink: 0; background: #f4f1ec; }
.row-main { flex: 1; min-width: 0; }
.row-brand { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; }
.row-name { font-size: 12px; color: var(--sub); margin: 1px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 6px;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}
.row-remove { color: var(--sub); font-size: 18px; padding: 8px; flex-shrink: 0; }
.sheet-total {
  display: flex;
  justify-content: space-between;
  padding: 16px 2px;
  font-weight: 700;
  font-size: 14px;
}
.sheet-cta {
  display: block;
  width: 100%;
  background: var(--ink);
  color: var(--bg);
  text-align: center;
  padding: 15px;
  font-size: 13px;
  letter-spacing: 0.2em;
  font-weight: 700;
}

/* ---- トースト ---- */
.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: min(92%, 440px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1b1812;
  color: #fff;
  padding: 13px 16px;
  border-radius: 13px;
  display: flex;
  gap: 11px;
  align-items: center;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.4s cubic-bezier(0.25, 1.4, 0.45, 1);
  pointer-events: auto;
  cursor: pointer;
}
.toast.out { animation: toast-out 0.3s ease forwards; }
.toast .t-ico { font-size: 16px; flex-shrink: 0; }
.toast .t-ico.sale { color: #ff6a5c; }
.toast .t-go { margin-left: auto; font-size: 11px; color: #ffb0a8; flex-shrink: 0; letter-spacing: 0.06em; }
@keyframes toast-in {
  from { transform: translateY(24px) scale(0.95); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(12px); opacity: 0; }
}

/* ---- ページ読み込み時のふわっと表示 ---- */
.reveal { animation: reveal 0.7s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.reveal.d1 { animation-delay: 0.08s; }
.reveal.d2 { animation-delay: 0.16s; }
.reveal.d3 { animation-delay: 0.24s; }
@keyframes reveal {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
