/*
 * ハブ（テーマ別の入口。/jikka/ など）と、トップ・/pest-control/ に足す記事カード・記事一覧の追加スタイル。
 * styles.css（Design Lock・変更禁止）は読むだけで、上書きしない。全セレクタは .hub- で始める（frontend/src/content/hubCss.test.ts が検査）。
 * 読み込み: frontend/src/components/hub/HubStyles.tsx（使うページだけ。React 19 の <link precedence>）。
 *
 * 文字色のコントラスト（白地 #fff。WCAG AA は通常の文字 4.5:1 以上）:
 *   --ink #0b2230 16.33   --ink-2 #274651 10.09   リンク #087260 5.86   補助の文字 #4a5f67 6.72
 *   使わない: --muted #6b7e85 は白地 4.24（AA 未満）。--brand #0f8f79 は文字に使わない（面・線だけ）。
 *   枠線（操作部品の境界。3:1 以上）: #6f8b86 白地 3.68
 */
.hub-main {
  --hub-text: var(--ink);
  --hub-sub: var(--ink-2);
  --hub-muted: #4a5f67;
  --hub-link: var(--brand-d);
  --hub-border: #6f8b86;
  --hub-measure: 40em;
  background: #fff;
  color: var(--hub-text);
}
.hub-main-embed { background: transparent; }
.hub-main a { color: var(--hub-link); text-underline-offset: 3px; }
.hub-main a.btn { color: #fff; text-decoration: none; }
.hub-main a:focus-visible { outline: 3px solid var(--brand-d); outline-offset: 2px; border-radius: 6px; }
.hub-main:not(.hub-main-embed) { padding: 12px 0 56px; }
.hub-embed { padding-block: 8px 0; }

.hub-container { width: min(1000px, calc(100% - 32px)); margin-inline: auto; }
@media (min-width: 641px) { .hub-container { width: min(1000px, calc(100% - 48px)); } }

/* パンくず */
.hub-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--hub-muted); }
.hub-crumbs li { display: flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.hub-crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--hub-muted); }
.hub-crumbs a { display: inline-flex; align-items: center; min-height: 44px; }

/* 頭 */
.hub-head { max-width: var(--hub-measure); margin-bottom: 8px; }
.hub-head h1 { font-size: clamp(26px, 6.4vw, 34px); line-height: 1.45; letter-spacing: 0; }
.hub-intro { margin-top: 12px; font-size: 17px; line-height: 1.9; color: var(--hub-sub); overflow-wrap: anywhere; }

/* 節 */
.hub-section { margin-top: 36px; }
.hub-section h2 { font-size: clamp(20px, 5vw, 24px); line-height: 1.5; padding-left: 12px; border-left: 6px solid var(--brand); }
.hub-section > p { margin-top: 10px; max-width: var(--hub-measure); line-height: 1.85; }
.hub-note { color: var(--hub-sub); }

/* 記事カード（必ずリンクを含む。タイトルのリンクがカード全体に広がる） */
.hub-cards { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hub-card { position: relative; height: 100%; padding: 18px 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s; }
.hub-card:hover { border-color: rgba(15, 143, 121, .5); }
.hub-card h3 { font-size: 17px; line-height: 1.55; }
.hub-card-link { display: inline-block; min-height: 44px; color: var(--ink) !important; text-decoration: none; font-weight: 800; }
.hub-card-link::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.hub-card-link:focus-visible { outline-offset: 4px; }
.hub-card p { margin-top: 4px; font-size: 14px; line-height: 1.75; color: var(--hub-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* 記事の一覧（タイトル＋説明 1 行） */
.hub-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.hub-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hub-list-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.hub-list-desc { margin: 0 0 4px; font-size: 14px; line-height: 1.75; color: var(--hub-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 自治体の情報・診断 */
.hub-area-search { margin-top: 14px; padding: 20px; max-width: 640px; }
.hub-area-link { margin-top: 10px; }
.hub-area-link a { display: inline-flex; align-items: center; min-height: 44px; }
.hub-btn { margin-top: 4px; max-width: 100%; text-align: center; }

/* ほかのテーマ */
.hub-themes { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hub-theme-link { display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 100%; min-height: 64px; padding: 12px 16px; border: 1px solid var(--hub-border); border-radius: 12px; background: #fff; text-decoration: none; }
.hub-theme-link:hover { border-color: var(--brand-d); background: var(--mint); }
.hub-theme-name { font-weight: 800; font-size: 16px; color: var(--ink); line-height: 1.5; }
.hub-theme-desc { font-size: 13px; line-height: 1.65; color: var(--hub-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* トップ: ハブへの導線 */
.hub-gateway-wrap { margin-top: 24px; }
.hub-gateway { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 20px 22px; background: var(--mint); border-left: 6px solid var(--brand-d); border-radius: 4px 14px 14px 4px; }
.hub-gateway > div { flex: 1 1 320px; min-width: 0; }
.hub-gateway h3 { font-size: 18px; line-height: 1.5; }
.hub-gateway p { margin-top: 4px; font-size: 15px; line-height: 1.8; color: var(--hub-sub); }
.hub-gateway-btn { flex: 0 0 auto; }
.hub-gateway-wrap .hub-cards { margin-top: 14px; }

@media (max-width: 900px) {
  .hub-cards, .hub-themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hub-cards, .hub-themes { grid-template-columns: minmax(0, 1fr); }
  .hub-section { margin-top: 30px; }
  .hub-intro { font-size: 16px; }
  .hub-gateway { padding: 18px 16px; }
  .hub-gateway-btn { width: 100%; }
  .hub-area-search { padding: 16px; }
  .hub-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .hub-card { transition: none; } }

/* ハブ先頭の画像（生成イラスト。16:10）。画像の下の注記は出さない */
.hub-hero { max-width: 560px; margin: 18px 0 0; }
.hub-hero picture { display: block; }
.hub-hero img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); }
/* PC 幅（900px 以上）: h1 は全幅、導入文（左）と画像（右・最大 420px）の 2 列。DOM の順序は変えない（header は display: contents で h1・導入文をグリッドに載せる）。画像の無いハブは 1 列のまま。 */
@media (min-width: 900px) {
  .hub-top-has-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); column-gap: 40px; align-items: start; }
  .hub-top-has-hero .hub-head { display: contents; }
  .hub-top-has-hero .hub-head h1 { grid-column: 1 / -1; }
  .hub-top-has-hero .hub-intro { grid-column: 1; grid-row: 2; margin-top: 4px; }
  .hub-top-has-hero .hub-hero { grid-column: 2; grid-row: 2; margin-top: 8px; max-width: 420px; }
}
