/* =========================================================================
   関連ジャーナル記事の動線 — 商品カード × ブログ記事
   実装 2026-05-01
   - 1記事のみ → A-5 形式の英日二段見出し（直接遷移）
   - 2記事以上 → A-8 形式のカード内ポップオーバー
   ========================================================================= */

/* A-5 / A-8 共通ベース */
.product-card-simple .journal-stamp,
.product-card .journal-stamp {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #1a1a1a;
  text-align: center;
  position: relative;
}
.product-card-simple .journal-stamp a.journal-trigger,
.product-card .journal-stamp a.journal-trigger {
  text-decoration: none;
  color: #1a1a1a;
  display: inline-block;
  transition: opacity 0.2s ease;
}
.product-card-simple .journal-stamp a.journal-trigger:hover,
.product-card .journal-stamp a.journal-trigger:hover {
  opacity: 0.6;
}
.product-card-simple .journal-stamp .en,
.product-card .journal-stamp .en {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  font-weight: 600;
  text-transform: uppercase;
}
.product-card-simple .journal-stamp .ja,
.product-card .journal-stamp .ja {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: #888;
  margin-top: 4px;
}
.product-card-simple .journal-stamp .ja::before,
.product-card .journal-stamp .ja::before { content: "— "; }
.product-card-simple .journal-stamp .ja::after,
.product-card .journal-stamp .ja::after  { content: " —"; }

/* A-8 ポップオーバー（複数記事時） */
.product-card-simple .journal-stamp.has-popover .count,
.product-card .journal-stamp.has-popover .count {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.6rem;
  color: #999;
  letter-spacing: 0.05em;
  font-weight: 400;
}
.product-card-simple .journal-stamp.has-popover .arrow,
.product-card .journal-stamp.has-popover .arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform 0.25s ease;
}
.product-card-simple .journal-stamp.has-popover.open .arrow,
.product-card .journal-stamp.has-popover.open .arrow {
  transform: rotate(180deg);
}

.product-card-simple .journal-popover,

.product-card .journal-popover {
  position: absolute;
  left: -18px;
  right: -18px;
  top: calc(100% + 10px);
  background: #fff;
  border: 1px solid #1a1a1a;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  padding: 18px 18px 14px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease,
    visibility 0s linear 0.22s;
  text-align: left;
}
.product-card-simple .journal-stamp.open .journal-popover,
.product-card .journal-stamp.open .journal-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s;
}
.product-card-simple .journal-popover::before,
.product-card .journal-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid #1a1a1a;
  border-top: 1px solid #1a1a1a;
}
.product-card-simple .journal-popover .pop-head,
.product-card .journal-popover .pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dotted #ccc;
}
.product-card-simple .journal-popover .pop-title,
.product-card .journal-popover .pop-title {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #888;
}
.product-card-simple .journal-popover .pop-close,
.product-card .journal-popover .pop-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  color: #999;
  font-size: 1.05rem;
  line-height: 1;
  font-family: inherit;
}
.product-card-simple .journal-popover .pop-close:hover,
.product-card .journal-popover .pop-close:hover { color: #1a1a1a; }
.product-card-simple .journal-popover ul,
.product-card .journal-popover ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.product-card-simple .journal-popover li + li,
.product-card .journal-popover li + li {
  border-top: 1px dotted #eee;
}
.product-card-simple .journal-popover li a,
.product-card .journal-popover li a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  text-decoration: none;
  color: #1a1a1a;
  transition: opacity 0.2s ease;
}
.product-card-simple .journal-popover li a:hover,
.product-card .journal-popover li a:hover { opacity: 0.6; }
.product-card-simple .journal-popover .pop-thumb,
.product-card .journal-popover .pop-thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: #999;
  text-transform: uppercase;
  flex-shrink: 0;
  overflow: hidden;
}
.product-card-simple .journal-popover .pop-thumb img,
.product-card .journal-popover .pop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(8%) grayscale(8%);
}
.product-card-simple .journal-popover .pop-meta,
.product-card .journal-popover .pop-meta {
  flex: 1;
  min-width: 0;
}
.product-card-simple .journal-popover .pop-cat,
.product-card .journal-popover .pop-cat {
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: #999;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.product-card-simple .journal-popover .pop-name,
.product-card .journal-popover .pop-name {
  font-size: 0.7rem;
  line-height: 1.4;
  color: #1a1a1a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-simple .journal-popover .pop-arrow,
.product-card .journal-popover .pop-arrow {
  flex: 0 0 12px;
  color: #bbb;
  font-size: 0.7rem;
}

/* PCホバー時のオーバーレイ z-index と競合しないようにポップオーバーを最上位 */
@media (min-width: 769px) {
  .product-card-simple.journal-open,
  .product-card.journal-open {
    z-index: 200 !important;
  }
}

/* index.html の .product-card は overflow:hidden が設定されているため、
   ポップオーバー展開時のみ overflow:visible にしてクリップを解除する */
.product-card.journal-open {
  overflow: visible !important;
  z-index: 200 !important;
}

/* SP対応 — モバイルでは画面下からのボトムシート風 */
@media (max-width: 768px) {
  /* card に z-index:200 を付けると stacking context ができ、その内部の
     position:fixed popover も stacking context 内に閉じ込められる結果、
     body::after のバックドロップ（z-index:1000）の下に来てしまう。
     モバイルでは card 側の z-index を解除して、popover が body 直下と
     同じ stacking context で z-index 競合できるようにする。 */
  .product-card.journal-open,
  .product-card-simple.journal-open {
    z-index: auto !important;
  }

  .product-card-simple .journal-popover,
  .product-card .journal-popover {
    /* viewport 下部に固定表示。カード幅の狭さに引きずられない */
    position: fixed !important;
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    top: auto !important;
    max-height: 70vh;
    overflow-y: auto;
    padding: 18px 18px 14px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18), 0 12px 32px rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    z-index: 1001;
    -webkit-overflow-scrolling: touch;
  }
  /* モバイルでは矢印インジケータは不要（ボトムシートでカードに繋がっていない） */
  .product-card-simple .journal-popover::before,
  .product-card .journal-popover::before {
    display: none;
  }
  /* サムネを大きく＋タイトルを読みやすく */
  .product-card-simple .journal-popover .pop-thumb,
  .product-card .journal-popover .pop-thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
  }
  .product-card-simple .journal-popover .pop-name,
  .product-card .journal-popover .pop-name {
    font-size: 0.78rem;
    line-height: 1.45;
    -webkit-line-clamp: 3;
  }
  .product-card-simple .journal-popover li a,
  .product-card .journal-popover li a {
    padding: 12px 0;
    gap: 12px;
  }
  .product-card-simple .journal-popover .pop-head,
  .product-card .journal-popover .pop-head {
    margin-bottom: 6px;
    padding-bottom: 10px;
  }
  /* トリガーUIの英字フォント微調整 */
  .product-card-simple .journal-stamp .en,
  .product-card .journal-stamp .en {
    font-size: 0.72rem;
    letter-spacing: 0.28em;
  }
  /* バックドロップ：body にクラスが付いた時のみ表示 */
  body.journal-popover-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1000;
    animation: journal-backdrop-fade 0.2s ease-out;
  }
}
@keyframes journal-backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
