/* 自治体の取り組み（トップのカード＋一覧ページ）。tools/build.js が data-cms="topics" / "topics-list" のあるページにだけ読み込む。
   カードの DOM は build.js の topicCard() と assets/torikumi.js の cardFor() が同じ形で作る。 */
.cms-sec-topics{background:#fbf6ee}
.cms-sec-topics-list{background:#fff}

.cms-tp{width:100%;display:flex;flex-direction:column;gap:22px}
.cms-tp-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.cms-tp-grid2{grid-template-columns:repeat(2,minmax(0,1fr))}
.cms-tp-grid .cms-empty{grid-column:1/-1}

/* カード */
.cms-tp-card{box-sizing:border-box;display:flex;flex-direction:column;min-width:0;border-radius:14px;background:#fff;overflow:hidden;text-decoration:none;color:#222;box-shadow:0 2px 10px rgba(0,0,0,.12);transition:transform .2s,box-shadow .2s}
.cms-tp-card:hover,.cms-tp-card:focus-visible{transform:translateY(-3px);box-shadow:0 8px 18px rgba(0,0,0,.18)}
.cms-tp-card:focus-visible{outline:3px solid var(--cms-green,#057b64);outline-offset:2px}
.cms-tp-img{position:relative;display:block;width:100%;aspect-ratio:16/9;background:#4b6a63;overflow:hidden}
.cms-tp-img>img:not(.cms-tp-emblem){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
/* テーマ別の代替画像（背景色はインラインのグラデーション） */
.cms-tp-ph{position:absolute;inset:0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:0 16px;color:#fff;text-align:center}
.cms-tp-ph-ico{display:block;opacity:.9}
.cms-tp-ph-name{color:#fff;font-size:20px;font-weight:700;letter-spacing:.12em;line-height:1.3}
/* 市章：写真の左下に小さく */
.cms-tp-emblem{position:absolute;left:8px;bottom:8px;width:30px;height:30px;padding:3px;box-sizing:border-box;object-fit:contain;display:block;background:rgba(255,255,255,.94);border-radius:8px;box-shadow:0 1px 4px rgba(0,0,0,.25)}
.cms-tp-body{display:flex;flex-direction:column;gap:8px;padding:14px 16px 16px;flex:1}
.cms-tp-muni{display:flex;align-items:center;gap:8px;min-width:0}
.cms-tp-muni-name{font-size:13px;font-weight:700;color:var(--cms-green,#057b64);line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.cms-tp-member{flex:none;padding:0 8px;border-radius:9px;background:var(--cms-orange,#ff7745);color:#fff;font-size:11px;font-weight:700;line-height:1.7}
.cms-tp-title{font-size:16.5px;font-weight:700;line-height:1.5;color:#222;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.cms-tp-sum{font-size:13.5px;line-height:1.75;color:#555;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.cms-tp-tags{display:flex;flex-wrap:wrap;gap:6px;min-width:0;margin-top:auto;padding-top:4px}
.cms-tp-tag{padding:1px 10px;border-radius:10px;background:#e6f2ee;color:var(--cms-green,#057b64);font-size:11.5px;font-weight:700;line-height:1.7;white-space:nowrap}
.cms-tp-tag.cms-tp-sys{background:#fff1e0;color:#b4570a}
.cms-tp-foot{display:flex;align-items:center;gap:8px}
.cms-tp-date{flex:none;font-size:12px;color:#777}
.cms-tp-ext{flex:none;margin-left:auto;font-size:16px;font-weight:700;color:var(--cms-green,#057b64);line-height:1}

/* 一覧ページの絞り込み */
.cms-tp-search{gap:12px}
.cms-tp-search label{flex:1 1 180px;min-width:0}
.cms-tp-search select,.cms-tp-search input{width:100%;min-width:0;padding:10px 12px}
.cms-tp-head{min-height:1.6em}
.cms-tp-head small{font-size:13px;font-weight:400;color:#666}
.cms-tp-empty{grid-column:1/-1;display:flex;flex-direction:column;align-items:center;gap:14px;padding:32px 0;color:#666;font-size:15px}
.cms-tp-empty button{padding:11px 22px;border:2px solid var(--cms-green,#057b64);border-radius:10px;background:#fff;color:var(--cms-green,#057b64);font:inherit;font-weight:700;cursor:pointer}
/* 投稿導線 */
.cms-tp-post{display:flex;flex-direction:column;align-items:center;gap:12px;margin-top:20px;padding:28px 24px;border:2px solid var(--cms-green,#057b64);border-radius:16px;background:#f4f8f6}

@media screen and (max-width:1140px){.cms-tp-grid:not(.cms-tp-grid2){grid-template-columns:repeat(2,minmax(0,1fr))}}
@media screen and (max-width:768px){
  .cms-tp-grid,.cms-tp-grid2{grid-template-columns:1fr;gap:18px}
  .cms-tp-search label{flex:1 1 100%}
  .cms-tp-title{font-size:16px}
}
@media (prefers-reduced-motion:reduce){.cms-tp-card{transition:none}.cms-tp-card:hover{transform:none}}

/* 2026-10-08: スマホでは一覧も1列（1140px の2列指定が詳細度で勝っていたため） */
@media screen and (max-width:768px){.cms-tp-grid:not(.cms-tp-grid2),.cms-tp-grid2{grid-template-columns:1fr}}

/* 2026-10-08: どこの自治体の取り組みか一目で分かるよう、市章と自治体名を本文の先頭に大きく出す */
.cms-tp-muni{display:flex;align-items:center;gap:12px;min-width:0;padding-bottom:10px;margin-bottom:2px;border-bottom:1px solid #e6ece9}
.cms-tp-muni .cms-tp-emblem{position:static;flex:none;width:48px;height:48px;padding:4px;box-sizing:border-box;object-fit:contain;background:#fff;border:1px solid #dfe6e3;border-radius:10px;box-shadow:none}
.cms-tp-emblem-ph{display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:700;color:#057b64;background:#e6f2ec!important}
.cms-tp-muni-txt{display:flex;flex-direction:column;min-width:0;flex:1}
.cms-tp-pref{font-size:12px;color:#6b7a75;line-height:1.3}
.cms-tp-muni-name{font-size:19px!important;font-weight:700;color:#1f2a27!important;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cms-tp-muni .cms-tp-member{flex:none;align-self:center}

/* 2026-10-08: キーワード検索欄は1行目に全幅で置く */
.cms-tp-search .cms-tp-kw{flex:1 1 100%!important}
.cms-tp-search .cms-tp-kw input{width:100%}
.cms-tp-note{font-size:12px;color:#6b7a75;margin:6px 0 0;text-align:right}
@media screen and (max-width:768px){.cms-tp-note{text-align:left}}

/* 2026-10-08: 検索欄の枠をそろえる。5つの欄を同じ幅・同じ高さの格子に並べ、キーワード欄は1行目に全幅 */
.cms-tp-search{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px 12px;align-items:end}
.cms-tp-search label{min-width:0;margin:0}
.cms-tp-search .cms-tp-kw{grid-column:1/-1}
.cms-tp-search input,.cms-tp-search select{display:block;width:100%!important;min-width:0!important;height:48px!important;margin:0!important;padding:0 14px!important;line-height:normal!important;font-size:15px!important;font-weight:400;box-sizing:border-box!important;-webkit-appearance:none;appearance:none}
.cms-tp-search select{padding-right:34px!important;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23057b64' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center!important}
.cms-tp-search .cms-tp-q-reset{grid-column:1/-1;justify-self:center;height:48px}
@media screen and (max-width:1000px){.cms-tp-search{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media screen and (max-width:560px){.cms-tp-search{grid-template-columns:1fr}}

/* 2026-10-08 v2: カード上部に市章＋自治体名＋人口を大きく。テーマのアイコンは背景に薄く敷く */
.cms-tp-img{position:relative}
.cms-tp-ph{position:absolute;inset:0;display:block}
.cms-tp-ph-ico{position:absolute;right:-10px;bottom:-14px;opacity:.16;width:120px;height:120px}
.cms-tp-ph-name{display:none}
.cms-tp-hero{position:absolute;inset:0;display:flex;align-items:center;gap:16px;padding:0 22px;color:#fff}
.cms-tp-hero.on-photo{align-items:flex-end;padding-bottom:14px;background:linear-gradient(to top,rgba(0,0,0,.62),rgba(0,0,0,0) 65%)}
.cms-tp-hero-emb{flex:none;width:72px;height:72px;padding:6px;box-sizing:border-box;object-fit:contain;background:#fff;border-radius:14px;box-shadow:0 2px 8px rgba(0,0,0,.18)}
.cms-tp-hero-emb-ph{display:flex;align-items:center;justify-content:center;font-size:30px;font-weight:700;color:#057b64}
.cms-tp-hero-txt{display:flex;flex-direction:column;min-width:0;text-shadow:0 1px 3px rgba(0,0,0,.25)}
.cms-tp-hero .cms-tp-pref{font-size:13px;color:rgba(255,255,255,.92);line-height:1.3}
.cms-tp-hero .cms-tp-muni-name{font-size:26px!important;font-weight:700;color:#fff!important;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cms-tp-hero-pop{font-size:13px;color:rgba(255,255,255,.92);margin-top:2px}
.cms-tp-img>.cms-tp-member{position:absolute;top:12px;right:12px;z-index:1}
.cms-tp-muni{display:none}
/* 制度名など長いタグは折り返して枠内に収める */
.cms-tp-tags{display:flex;flex-wrap:wrap;gap:6px}
.cms-tp-tag{white-space:normal!important;max-width:100%;box-sizing:border-box;word-break:break-all}

/* 概要が無いカードは概要欄を出さない */
.cms-tp-sum:empty{display:none}
