/* ===========================================
   css/style.css（フル）
   - 1段目ヘッダー固定（fixed）＋本文オフセット
   - スマホ横はみ出し防止・検索サイズ縮小
   - 2段目ティッカー：黒帯強制（z-index前面）
   - 3段目カテゴリ：折り返し禁止・横スクロール復活
   - ヒーロー動画：原寸基準（拡大しない）
   - 商品グリッド：列幅167px固定・gap=10px
   - 商品カード：外枠なし／画像167×200／文字領域も167幅
   - オーバーレイ対策：z-index/ポインター調整
   - ハンバーガー三本線⇄×（同位置同サイズ）
=========================================== */

/* ==== Base ==== */
:root{
  --bg: #f4f5f7;
  --fg: #2e2f33;
  --muted: #6a6d75;
  --white: #fff;
  --line: #e5e6ea;
  --brand: #111;
  --accent: #1a73e8;

  --topbar-h: 64px;     /* スマホのヘッダー高さ */
}

@media (min-width: 700px){
  :root{ --topbar-h: 72px; }   /* タブレット以上 */
}

*{ box-sizing: border-box; }
html, body{
  margin:0; padding:0;
  background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Arial, sans-serif;
  width: 100%;
  overflow-x: hidden;                /* 横スクロール禁止 */
}

/* 1段目をfixedにするので本文をオフセット */
body{ padding-top: var(--topbar-h); }

img{ display:block; max-width:100%; height:auto; }
a{ color:inherit; text-decoration:none; }
button{ cursor:pointer; border:0; background:none; color:inherit; font: inherit; }
input, button{ outline-offset: 2px; }
.visually-hidden{ position:absolute; clip:rect(0 0 0 0); clip-path: inset(50%); width:1px; height:1px; overflow:hidden; white-space:nowrap; }

/* ==== Topbar（1段目 / 固定） ==== */
.topbar{
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000; background: var(--white); border-bottom: 1px solid var(--line);
}
.topbar__inner{
  height: var(--topbar-h);
  display:flex; align-items:center; justify-content:flex-start;
  gap: 10px; padding: 0 10px; min-width: 0;
}

.brand{ display:flex; align-items:center; gap: 8px; min-width: 0; }
.brand__name{ font-weight: 700; letter-spacing: .02em; white-space: nowrap; }

/* 検索（小さめ＆約30%短く） */
.search{
  flex: 0 1 auto; display:flex; align-items:center; gap:8px; min-width:0;
  margin-left: auto;
}
.search input{
  height: 34px;
  border:1px solid var(--line); background: var(--white);
  border-radius: 999px; padding: 0 12px;
  font-size: 14px; width: clamp(180px, 40vw, 420px);
}
.search button{
  height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--fg); color: var(--white); font-size: 13px;
}

/* 右上アクション */
.actions{
  position: relative; display:flex; align-items:center; gap: 8px;
  flex: 0 0 auto; margin-left: 8px;
}

/* ハンバーガー ⇄ ×（同位置同サイズ） */
.hamburger{
  position: relative;
  width: 28px; height: 28px;
  display: inline-block; padding: 0; border: 0; background: transparent; color: var(--fg);
  vertical-align: middle;
}
.hamburger .icon{
  position: absolute; top: 50%; left: 50%;
  width: 24px; height: 24px; transform: translate(-50%, -50%); display: block;
}
.hamburger .icon-menu { display: block; }
.hamburger .icon-close{ display: none; }
.hamburger.is-open .icon-menu { display: none !important; }
.hamburger.is-open .icon-close{ display: block !important; }
.hamburger:focus-visible{ outline: 2px solid var(--accent); }

/* プルダウン（ハンバーガー直下・右揃え） */
.menu-dropdown{
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 1060;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 24px rgba(0,0,0,.12);
  overflow: hidden; min-width: 220px;
}
.menu-dropdown[hidden]{ display:none !important; }
.menu-dropdown ul{ list-style: none; padding: 6px; margin: 0; }
.menu-dropdown li a{
  display: block; padding: 10px 12px; border-radius: 8px; white-space: nowrap;
}
.menu-dropdown li a:hover{ background: #fafafa; }

/* ==== 2段目：黒帯ティッカー（黒固定・前面） ==== */
.notice-ticker{
  background: #000 !important; color: #fff !important;   /* ← 黒を強制 */
  height: 32px; line-height: 32px; overflow:hidden;
  position: relative; z-index: 900;                       /* ← 前面に */
}
.notice-track{
  display:flex; gap: 28px; align-items:center; white-space: nowrap; height: 32px;
  will-change: transform;
}
.notice{ padding: 0 12px; display:inline-flex; align-items:center; height: 32px; }

/* ==== 3段目：カテゴリ横スクロール（折り返し禁止・前面） ==== */
.category-strip{
  background: var(--white); border-bottom: 1px solid var(--line);
  position: relative; z-index: 850;                       /* ← 前面に */
}
.category-scroll{
  padding: 12px 10px; display:flex; gap: 14px;
  overflow-x: auto !important;
  overflow-y: hidden;
  flex-wrap: nowrap !important;                            /* ← 折り返し禁止 */
  white-space: nowrap;                                     /* ← 折り返し禁止 */
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  touch-action: pan-x !important;
  cursor: grab;
}
.category-scroll.dragging{ cursor: grabbing; }

.cat{
  width: 78px; flex: 0 0 auto; display:grid; justify-items:center; gap: 6px;
  scroll-snap-align: start;
}
.cat img{
  --inner: 70px;    /* 中の画像サイズ（据え置き） */
  --pad:   4px;     /* 枠だけ細く */
  --border:1px;

  width:  var(--inner);
  height: var(--inner);
  padding: var(--pad);
  border: var(--border) solid var(--line);
  border-radius: 999px;       /* 正円固定 */
  aspect-ratio: 1 / 1;
  background: #fafafa;
}
.cat span{ font-size: 12px; text-align:center; color: var(--fg); }
.cat.is-active span{ font-weight: 700; }

@media (max-width: 640px){
  .cat{ width: 72px; }
  .cat img{
    --inner: 52px;
    --pad:   4px;
    --border:1px;
  }
}

/* ==== ヒーロー動画：原寸基準（拡大しない） ==== */
.hero{
  position: relative; z-index: 700;            /* ← 前面に（下のリンク被り防止） */
  background: #000; border-bottom: 1px solid var(--line);
  display: flex; justify-content: center;
}
.hero__video{
  width: auto !important; height: auto !important;
  max-width: 100%; max-height: 500px;
  object-fit: contain;
  display: block; margin: 0 auto;
  pointer-events: none;                         /* ← クリック透過（被り対策） */
}
@media (max-width: 767px){
  .hero__video{ max-height: 300px; }
}

/* ==== メイン / 見出し ==== */
.main{ padding: 16px min(4vw, 24px) 80px; position: relative; z-index: 100; }
.section-title{ font-size: 18px; font-weight: 700; margin: 8px 2px 14px; }

/* ==== おすすめ商品グリッド：列幅167px固定・隙間10px ==== */
.product-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, 167px);
  gap: 10px;
  justify-content: center;
  position: relative; z-index: 100;
}

/* ==== 商品カード（外枠なし・画像167×200・文字も167幅） ==== */
.card{
  display: flex; flex-direction: column; align-items: center;
  border: none !important; border-radius: 0 !important; box-shadow: none !important;
  background: transparent !important;
  position: relative; z-index: 0;                /* ← オーバーレイ化を防ぐ */
}

/* 画像リンクがはみ出してオーバーレイしないよう、厳密にサイズ固定 */
.card__imgwrap{
  display: flex; align-items: center; justify-content: center;
  width: 167px !important; height: 200px !important;
  margin: 0 auto;
  background: transparent !important;
  border: none !important; border-radius: 0 !important;
  flex: 0 0 auto;
  position: relative; z-index: 0;                /* ← オーバーレイ防止 */
}
.card__img{
  width: 167px !important; height: 200px !important;
  object-fit: cover; display:block;
}

/* 画像が無い時のプレースホルダー */
.card__imgwrap.noimg::after{
  content: "No Image";
  position: absolute; inset: 0; display:grid; place-items:center;
  color: #999; font-size: 12px; letter-spacing: .08em;
}

/* 本文領域：画像と同じ幅に揃える（外枠なし） */
.card__body{
  width: 167px !important;
  padding: 8px 0 12px;
  background: transparent !important;
  color: var(--fg);
  text-align: left;
}

/* 説明文（タイトル/メタ/価格） */
.card__title{
  font-size: 14px; line-height:1.3;
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  line-clamp: 2; -webkit-line-clamp: 2; min-height: 2.6em;
}
.card__meta{
  font-size: 12px; color: var(--muted); margin-top: 2px; line-height:1.3;
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  line-clamp: 1; -webkit-line-clamp: 1;
}
.card__price{ margin-top: 6px; font-weight: 700; }

.card:focus-within{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==== 吹き出しメニュー（長押し） ==== */
.bubble-menu{
  position: fixed; inset: auto auto 0 0;
  transform: translate(-9999px, -9999px);
  background: var(--white); border:1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display:flex; flex-direction:column; overflow:hidden; z-index: 1200;
}
.bubble-menu[aria-hidden="false"]{ transform: none; }
.bubble-menu button{ padding: 10px 14px; text-align: left; }
.bubble-menu button + button{ border-top:1px solid var(--line); }
.bubble-menu button:hover{ background:#fafafa; }

/* ==== フッター ==== */
.footer{ padding: 24px; text-align:center; color: var(--muted); }

/* ==== レスポンシブ補助 ==== */
@media (max-width: 640px){
  .brand__name{ display: none; }
  .search input{
    font-size: 13px; height: 32px; width: clamp(150px, 40vw, 260px);
  }
  .search button{ height: 32px; font-size: 12px; }
}

/* ==== フォーカス可視性 ==== */
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
