/* ============================================================
 * common/css/tag.css
 *
 *   タグ関連ページ専用 CSS
 *   - /tag/    (page-tag.php)         … タグ一覧（PC: tag-page__all、SP: tag-browser）
 *   - /tag/{slug}/ (tag.php)          … タグ詳細（PC: td-*、SP: td-*-sp）
 *
 *   ベース変数 (--brand-*, --cat-*, --line, --shadow 等) は common.css に依存
 * ============================================================ */


/* ============================================================
 * 1. /tags/ ページ + OTHER TAGS 共通: tag-page__all / tp-cat
 * ============================================================ */

.tag-page__all {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.tp-cat {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 22px 24px 26px;
  scroll-margin-top: 100px;
}

.tp-cat__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tp-cat__head-l { display: flex; align-items: center; gap: 14px; }

.tp-cat__dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cat-c, var(--brand-pink));
  flex-shrink: 0;
}

.tp-cat__sm {
  font-size: 10px; font-weight: 700;
  color: var(--cat-c, var(--brand-pink));
  letter-spacing: .24em;
  margin-bottom: 2px;
}

.tp-cat__name {
  font-family: arial, sans-serif;
  font-size: 20px; font-weight: 800;
  color: var(--brand-dark);
  letter-spacing: .04em;
  line-height: 1.1;
}

a.tp-cat__more,
a.tp-cat__more:link,
a.tp-cat__more:visited {
  font-size: 12px; font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: .06em;
  transition: color .2s;
  text-decoration: none;
}
a.tp-cat__more:hover { color: var(--brand-pink); }

.tp-group { margin-bottom: 14px; }
.tp-group:last-child { margin-bottom: 0; }

.tp-group__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-mid);
  letter-spacing: .12em;
  margin-bottom: 10px;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
}
.tp-group__label::before {
  content: ''; width: 14px; height: 1px;
  background: var(--brand-mid);
}

/* chip tweaks for tag page */
.tag-page__all .tb-chip {
  font-size: 12px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.tag-page__all .tb-chip::before {
  content: '#';
  color: var(--brand-mid);
  margin-right: 4px;
  font-weight: 500;
}

@media (max-width: 900px) {
  .tag-page__all { gap: 22px; }
}
@media (max-width: 600px) {
  .tp-cat { padding: 18px 16px 20px; }
  .tp-cat__head { flex-wrap: wrap; }
  .tp-cat__name { font-size: 17px; }
}


/* ============================================================
 * 2. /tag/{slug}/ 詳細ページ PC: td-head / td-toolbar / td-pickup / etc.
 * ============================================================ */

/* ─── TD HEAD ─── */
.td-head {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.td-head > * { position: relative; z-index: 1; }

.td-head__title {
  font-family: arial, sans-serif;
  font-size: 42px; font-weight: 800;
  color: var(--brand-dark);
  letter-spacing: .04em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.td-head__hash {
  color: var(--brand-pink);
  margin-right: 6px;
  font-weight: 500;
}
.td-head__meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 12px; color: var(--brand-mid);
  letter-spacing: .04em;
}
.td-head__count strong {
  font-family: arial, sans-serif;
  color: var(--brand-dark);
  font-size: 16px; font-weight: 800;
  margin-right: 4px;
}
.td-head__sep { color: var(--text-light); }

.td-head--simple {
  padding: 26px 32px;
}
.td-head--simple .td-head__title { margin-bottom: 10px; font-size: 36px; }
.td-head--simple .td-head__meta { margin: 0; }


/* ─── TD TOOLBAR ─── */
.td-toolbar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 14px;
  padding: 10px 4px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.td-toolbar__sort { display: flex; align-items: center; gap: 10px; }
.td-toolbar__sort label {
  font-size: 11px; font-weight: 700;
  color: var(--brand-mid);
  letter-spacing: .12em;
}

.td-select {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23544541' stroke-width='1.5' stroke-linecap='round'><path d='M1 1l4 4 4-4'/></svg>") no-repeat right 12px center;
  border-radius: 999px;
  padding: 8px 32px 8px 14px;
  font: inherit;
  font-size: 12px;
  color: var(--brand-dark);
  cursor: pointer;
}
.td-select:focus { outline: none; border-color: var(--brand-pink); }


/* ─── TD PICKUP（プルダウン切替 + フェード）─── */
.td-pickup {
  margin-bottom: 36px;
}
.td-pickup__head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
  padding: 10px 4px;
  border-bottom: 1px solid #e3decf;
}
.td-pickup__label {
  font-size: 11px; letter-spacing: .12em; font-weight: 700;
  color: #897570;
}
.td-pickup__select {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23544541' stroke-width='1.5' stroke-linecap='round'><path d='M1 1l4 4 4-4'/></svg>") no-repeat right 12px center;
  border-radius: 999px;
  padding: 8px 32px 8px 14px;
  font: inherit;
  font-size: 12px;
  color: var(--brand-dark);
  cursor: pointer;
}
.td-pickup__select:focus { outline: none; border-color: var(--brand-pink); }

.td-pickup__stage {
  position: relative;
  min-height: 280px;
}
.td-pickup__stage .td-feature {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility 0s linear .35s;
  pointer-events: none;
}
.td-pickup__stage .td-feature.is-active {
  position: relative;
  opacity: 1; visibility: visible;
  transition: opacity .35s ease, visibility 0s linear 0s;
  pointer-events: auto;
}


/* ─── TD FEATURE（PICK UP カード）─── */
a.td-feature,
a.td-feature:link,
a.td-feature:visited {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .25s, box-shadow .25s;
  color: inherit;
  text-decoration: none;
}
a.td-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
a.td-feature:hover .td-feature__title { color: var(--brand-pink); }

.td-feature__img {
  position: relative;
  aspect-ratio: 16/10;
  width: 100%;
  background: var(--cream-100);
  overflow: hidden;
}
.td-feature__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.td-feature__badge {
  position: absolute; top: 16px; left: 16px;
  background: var(--brand-pink);
  color: #fff;
  font-size: 10px; font-weight: 700;
  letter-spacing: .2em;
  padding: 5px 12px;
  border-radius: 2px;
  z-index: 2;
}

.td-feature__body {
  padding: 30px 34px 0 30px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 14px;
}
.td-feature__cat {
  display: inline-block;
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  width: fit-content;
  letter-spacing: .08em;
  /* 背景色は cat-XX クラスに完全委任（top.css の .cat-recipe / .cat-trip / .cat-misc 等）
     ここで background を再定義すると tag.css が後ロードのため上書きしてしまうので書かない */
}
.td-feature__title {
  font-family: arial, sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.55;
  letter-spacing: .02em;
  transition: color .2s;
  /* 枠に入らない分は … で省略（3 行）*/
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-feature__desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.85;
  /* 枠に入らない分は … で省略（4 行）*/
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 900px) {
  .td-feature__title { -webkit-line-clamp: 3; line-clamp: 3; }
  .td-feature__desc  { -webkit-line-clamp: 4; line-clamp: 4; }
}
.td-feature__meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--brand-mid);
  letter-spacing: .08em;
}
.td-feature__sep { color: var(--text-light); }


/* ─── 結果件数 / ページネーション ─── */
.td-result-count {
  font-size: 11px;
  color: var(--brand-mid);
  letter-spacing: .06em;
}

.td-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}
a.td-page,
a.td-page:link,
a.td-page:visited,
span.td-page {
  min-width: 36px; height: 36px;
  padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-family: arial, sans-serif;
  font-size: 13px; font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: .04em;
  transition: all .2s;
  text-decoration: none;
}
a.td-page:hover { border-color: var(--brand-pink); color: var(--brand-pink); }
.td-page--active,
a.td-page--active:link,
a.td-page--active:visited {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
a.td-page--active:hover { color: #fff; }
.td-page--ellipsis {
  border: none;
  background: transparent;
  color: var(--text-light);
}
.td-page--prev, .td-page--next {
  font-size: 12px;
  letter-spacing: .08em;
}
.td-page[aria-disabled="true"] {
  opacity: .4; pointer-events: none;
}


/* ─── OTHER TAGS（末尾）─── */
.td-other { margin-top: 48px; }
.td-other .tag-page__all { gap: 20px; }

/* OTHER TAGS の中で「現在のタグ」を強調表示するための非リンク chip */
.tb-chip--current,
span.tb-chip--current {
  background: var(--brand-dark) !important;
  color: #fff !important;
  border-color: var(--brand-dark) !important;
  cursor: default;
}
.tb-chip--current::before {
  content: '#';
  opacity: .55;
  margin-right: 1px;
}

/* article-card 内の「記事に付いてるタグ」を #ハッシュタグで列挙する小さい chip 群 */
.card-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.card-tags a,
.card-tags a:link,
.card-tags a:visited,
.card-tags span {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--cream-50);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-mid);
  letter-spacing: .02em;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.card-tags a:hover {
  background: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
}


/* ============================================================
 * 3. PC レスポンシブ（mid breakpoint）
 * ============================================================ */
@media (max-width: 900px) {
  .td-head { padding: 24px 22px; }
  .td-head__title { font-size: 30px; }
  a.td-feature, a.td-feature:link, a.td-feature:visited { grid-template-columns: 1fr; }
  .td-feature__body { padding: 22px; }
}


/* ============================================================
 * 4. SP（≤768px）専用: td-head-sp / td-toolbar-sp / td-pagination-sp / tag-page-sp
 * ============================================================ */
@media (max-width: 768px) {

  .td-head-sp {
    padding: 22px 14px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
  }
  .td-head-sp__title {
    font-family: arial, sans-serif;
    font-size: 26px; font-weight: 800;
    color: var(--brand-dark);
    letter-spacing: .04em;
    margin-bottom: 8px;
    line-height: 1.15;
  }
  .td-head-sp__hash { color: var(--brand-pink); margin-right: 4px; font-weight: 500; }
  .td-head-sp__meta {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: var(--brand-mid);
    letter-spacing: .04em;
  }
  .td-head-sp__meta strong {
    font-family: arial, sans-serif;
    color: var(--brand-dark);
    font-size: 14px; font-weight: 800;
    margin-right: 2px;
  }
  .td-head-sp__sep { color: var(--text-light); }

  .td-toolbar-sp {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
  }
  .td-toolbar-sp label {
    font-size: 10px; font-weight: 700;
    color: var(--brand-mid); letter-spacing: .12em;
  }
  .td-select-sp {
    appearance: none;
    border: 1px solid var(--line); background: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23544541' stroke-width='1.5' stroke-linecap='round'><path d='M1 1l4 4 4-4'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    border-radius: 999px;
    padding: 6px 26px 6px 12px;
    font: inherit; font-size: 11px;
    color: var(--brand-dark);
  }

  .td-pagination-sp {
    display: flex; align-items: center; justify-content: center;
    gap: 4px;
    padding: 26px 14px 8px;
    flex-wrap: wrap;
  }
  a.td-page-sp,
  a.td-page-sp:link,
  a.td-page-sp:visited,
  span.td-page-sp {
    min-width: 32px; height: 32px;
    padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    font-family: arial, sans-serif;
    font-size: 12px; font-weight: 700;
    color: var(--brand-dark);
    letter-spacing: .04em;
    text-decoration: none;
  }
  .td-page-sp--active,
  a.td-page-sp--active:link,
  a.td-page-sp--active:visited {
    background: var(--brand-dark); border-color: var(--brand-dark); color: #fff;
  }
  .td-page-sp--ellipsis {
    border: none; background: transparent; color: var(--text-light);
  }
  .td-page-sp[aria-disabled="true"] { opacity: .4; pointer-events: none; }

  /* /tags/ SP wrapper */
  .tag-page-sp { padding-top: 18px; }
  .tag-page-sp .tag-browser { margin-top: 0; }

  /* SP の PICK UP は左右の余白を画面端に合わせる（PC の card 形状をそのまま使用）*/
  .td-pickup {
    margin: 14px 0 24px;
    padding: 0 14px;
  }
  .td-pickup__head {
    padding: 0 0 12px;
  }
  .td-pickup__stage {
    min-height: 0; /* SP は縦伸び OK */
  }
  /* SP では td-feature を画像→本文の縦並びに（PC 2col → SP 1col 切替は既存 @media 900 で対応済）*/
  .td-feature__body {
    padding: 18px 16px;
    gap: 10px;
  }
  .td-feature__title { font-size: 16px; }
}
