/* フォルダハブ（folder-hub）。2026-10-09
   どの幅でも同じ形: 左に分類の列、右に選んだ分類の説明つきの一覧。部品（分類の行・記事の行・検索の窓）と色も同じ
   （2026-10-09 依頼主「ウィンドウ縮めたら全く別スタイルになるから使いづらい」→ 狭い画面の案 4「左の細い列」）。
   - PC（960px〜）: 左 280px に検索と分類、選んだ分類の下に題だけの目次。右の一覧は 2 列
   - タブレット（600〜959px）: 左 210px に分類（名前と件数）。右の上に検索、一覧は 2 列
   - スマホ（〜599px）: 左 64px に分類（絵と短い名前）。右の上に検索、一覧は 1 列
   最初から CSS で 1 分類だけ出す（JS を待つと画面がずれる）。JS が付ける .is-ready が無いあいだは、
   分類（#id へのリンク）を押すとその分類が :target で出る。リンクは全部 HTML にある（見せないだけ）。
   本文の a・p・img の SWELL の飾りより強くするため、.ntg-fhub を頭に付ける（!important は使わない） */

/* 色と角の丸みはテーマの変数（ライト・ダークで替わる。tokens-nettoge.css）。無いときの値はライト。
   カードの地は --ntg2-paper（ライト #f6f5f3・ダーク #26292d、上の更新の帯と同じ）、角は --ntg2-radius（6px） */
.ntg-fhub {
  --fhub-line: var(--ntg2-line, #e3e0dc);
  --fhub-paper: var(--ntg2-paper, #f6f5f3);
  --fhub-text: var(--ntg2-text, #1a1714);
  --fhub-muted: var(--ntg2-sub, #5f5a55);
  --fhub-link: var(--ntg2-link, #3061a6);
  --fhub-radius: var(--ntg2-radius, 6px);
  /* 小見出しの帯・押したときの地（カードの地を少し濃く） */
  --fhub-ground: var(--fhub-paper);
  --fhub-ground: color-mix(in srgb, var(--fhub-text) 5%, var(--fhub-paper));
  --fhub-hi: var(--fhub-ground);
  --fhub-hi: color-mix(in srgb, var(--fhub-link) 13%, var(--fhub-paper));
  /* 左の列を留める高さ。スマホ・タブレットのヘッダーは 57px（2026-10-09 本番で測った） */
  --fhub-top: 66px;
  margin: 4px 0 2em;
  color: var(--fhub-text);
  line-height: 1.6;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 10px;
  align-items: start;
}

.ntg-fhub a {
  color: inherit;
  text-decoration: none;
  box-shadow: none;
}

.ntg-fhub p {
  margin: 0;
  padding: 0;
}

.ntg-fhub img {
  display: block;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
}

.ntg-fhub picture {
  display: contents;
}

/* ---- 左: 分類の列 ---- */
/* スマホ・タブレットでは、左の箱（検索と分類）を解いて、検索を右の上へ置く */
.ntg-fhub .ntg-fhub__side {
  display: contents;
}

.ntg-fhub .ntg-fhub__q {
  grid-column: 2;
  grid-row: 1;
  margin-bottom: 12px;
}

.ntg-fhub .ntg-fhub__cats {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  top: var(--fhub-top);
  max-height: calc(100vh - var(--fhub-top) - 12px);
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--fhub-paper);
  border: 1px solid var(--fhub-line);
  border-radius: var(--fhub-radius);
}

.ntg-fhub .ntg-fhub__cats::-webkit-scrollbar {
  display: none;
}

.ntg-fhub .ntg-fhub__cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 2px;
  border-top: 1px solid var(--fhub-line);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.ntg-fhub .ntg-fhub__cat:first-child {
  border-top: 0;
}

.ntg-fhub .ntg-fhub__ci {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: none;
}

.ntg-fhub .ntg-fhub__cn,
.ntg-fhub .ntg-fhub__n,
.ntg-fhub .ntg-fhub__tree {
  display: none;
}

.ntg-fhub .ntg-fhub__cs {
  word-break: break-all;
}

.ntg-fhub .ntg-fhub__cat:hover {
  background: var(--fhub-ground);
}

.ntg-fhub .ntg-fhub__cat.is-active {
  background: var(--fhub-hi);
  color: var(--fhub-link);
}

.ntg-fhub .ntg-fhub__cat {
  transition: background-color .15s, color .15s;
}

/* ---- 右: 分類の中身（地の箱に 1 行 1 本）。見せるのは選んだ 1 つだけ ---- */
.ntg-fhub .ntg-fhub__main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.ntg-fhub .ntg-fhub__panel {
  display: none;
}

.ntg-fhub .ntg-fhub__panel.is-enter {
  animation: ntg-fhub-in .28s ease-out;
}

@keyframes ntg-fhub-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.ntg-fhub:not(.is-ready) .ntg-fhub__panel:first-child,
.ntg-fhub.is-ready .ntg-fhub__panel.is-active {
  display: block;
}

.ntg-fhub:not(.is-ready) .ntg-fhub__main:has(.ntg-fhub__panel:target) .ntg-fhub__panel:first-child:not(:target) {
  display: none;
}

.ntg-fhub:not(.is-ready) .ntg-fhub__panel:target {
  display: block;
}

.ntg-fhub .ntg-fhub__phd {
  padding: 0 0 12px;
}

.ntg-fhub .ntg-fhub__pt {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.ntg-fhub .ntg-fhub__lead {
  font-size: 13px;
  color: var(--fhub-muted);
  margin-top: 2px;
}

.ntg-fhub .ntg-fhub__grp {
  background: var(--fhub-paper);
  border: 1px solid var(--fhub-line);
  border-radius: var(--fhub-radius);
  overflow: hidden;
  margin-bottom: 10px;
}

.ntg-fhub .ntg-fhub__gh {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--fhub-muted);
  background: var(--fhub-ground);
  border-bottom: 1px solid var(--fhub-line);
  padding: 7px 14px 5px;
}

.ntg-fhub .ntg-fhub__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.ntg-fhub .ntg-fhub__it {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
  border-top: 1px solid var(--fhub-line);
  transition: background-color .15s;
}

.ntg-fhub .ntg-fhub__it:hover {
  background: var(--fhub-ground);
}

/* 公開から 7 日以内（JS が .is-new を付ける）。アイコンの角に重ねて、題の幅を変えない（後から足しても行がずれない） */
.ntg-fhub .ntg-fhub__it.is-new::after {
  content: "NEW";
  position: absolute;
  top: 5px;
  left: 4px;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 13px;
  letter-spacing: .02em;
  padding: 0 3px;
  border-radius: 3px;
  background: #e5484d;
  color: #fff;
  pointer-events: none;
}

.ntg-fhub .ntg-fhub__list > .ntg-fhub__it:first-child {
  border-top: 0;
}

.ntg-fhub .ntg-fhub__it.is-main {
  background: var(--fhub-hi);
}

.ntg-fhub .ntg-fhub__sq {
  flex: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ntg-fhub .ntg-fhub__sq img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ntg-fhub .ntg-fhub__num {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--fhub-link);
  color: var(--fhub-paper);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ntg-fhub .ntg-fhub__tx {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ntg-fhub .ntg-fhub__t {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.45;
}

.ntg-fhub .ntg-fhub__d {
  font-size: 12px;
  line-height: 1.5;
  color: var(--fhub-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ntg-fhub .ntg-fhub__mt {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
  border-radius: 4px;
  padding: 0 6px;
  margin-right: 6px;
  vertical-align: 1px;
}

.ntg-fhub .ntg-fhub__mt {
  background: var(--fhub-link);
  color: var(--fhub-paper);
}

.ntg-fhub .ntg-fhub__it:hover .ntg-fhub__tt,
.ntg-fhub .ntg-fhub__it:focus-visible .ntg-fhub__tt {
  color: var(--fhub-link);
  text-decoration: underline;
}

.ntg-fhub .ntg-fhub__it mark {
  background: rgba(255, 214, 102, .55);
  color: inherit;
  border-radius: 2px;
}

.ntg-fhub .ntg-fhub__none {
  padding: 20px 14px;
  font-size: 14px;
  color: var(--fhub-muted);
}

/* ---- 検索の窓（JS が作る） ---- */
.ntg-fhub .ntg-fhub__in {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--fhub-paper);
  border: 1px solid var(--fhub-line);
  color: var(--fhub-muted);
  transition: border-color .15s;
}

.ntg-fhub .ntg-fhub__in:focus-within {
  border-color: var(--fhub-link);
  background: var(--fhub-paper);
}

.ntg-fhub .ntg-fhub__in input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font: inherit;
  font-size: 16px;
  color: var(--fhub-text);
  outline: none;
  padding: 0;
  height: auto;
}

.ntg-fhub .ntg-fhub__in input::placeholder {
  color: var(--fhub-muted);
}

/* ==========================================================================
   タブレット（600〜959px）: 左は名前と件数の列、右の一覧は 2 列
   ========================================================================== */
@media (min-width: 600px) {
  .ntg-fhub {
    grid-template-columns: 210px minmax(0, 1fr);
    column-gap: 20px;
  }

  .ntg-fhub .ntg-fhub__cat {
    flex-direction: row;
    gap: 10px;
    padding: 9px 12px;
    font-size: 14px;
    text-align: left;
  }

  .ntg-fhub .ntg-fhub__cn,
  .ntg-fhub .ntg-fhub__n {
    display: inline;
  }

  .ntg-fhub .ntg-fhub__cs {
    display: none;
  }

  .ntg-fhub .ntg-fhub__ci {
    width: 24px;
    height: 24px;
  }

  .ntg-fhub .ntg-fhub__n {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--fhub-muted);
  }

  .ntg-fhub .ntg-fhub__pt {
    font-size: 20px;
  }

  .ntg-fhub .ntg-fhub__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ntg-fhub .ntg-fhub__it {
    border-top: 0;
    border-bottom: 1px solid var(--fhub-line);
    padding: 11px 14px;
  }

  .ntg-fhub .ntg-fhub__list > .ntg-fhub__it:nth-child(odd) {
    border-right: 1px solid var(--fhub-line);
  }

  .ntg-fhub .ntg-fhub__list > .ntg-fhub__it:nth-last-child(1),
  .ntg-fhub .ntg-fhub__list > .ntg-fhub__it:nth-last-child(2):nth-child(odd) {
    border-bottom: 0;
  }

  .ntg-fhub .ntg-fhub__it.is-main {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .ntg-fhub .ntg-fhub__sq {
    width: 34px;
    height: 34px;
  }

  .ntg-fhub .ntg-fhub__t {
    font-size: 15px;
  }

  .ntg-fhub .ntg-fhub__d {
    font-size: 12.5px;
  }
}

/* ==========================================================================
   PC（960px〜）: 左 280px の箱に検索と分類、選んだ分類の下に題だけの目次
   ========================================================================== */
@media (min-width: 960px) {
  .ntg-fhub {
    /* ヘッダーとテーマの見出しの帯（34px）の下 */
    --fhub-top: calc(var(--ntg2-header-h, 64px) + 46px);
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-rows: auto;
    column-gap: 28px;
  }

  .ntg-fhub .ntg-fhub__side {
    display: block;
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: var(--fhub-top);
    max-height: calc(100vh - var(--fhub-top) - 16px);
    overflow-y: auto;
    background: var(--fhub-paper);
    border: 1px solid var(--fhub-line);
    border-radius: var(--fhub-radius);
  }

  .ntg-fhub .ntg-fhub__q {
    padding: 12px;
    margin: 0;
    border-bottom: 1px solid var(--fhub-line);
  }

  .ntg-fhub .ntg-fhub__in {
    height: 40px;
    background: var(--ntg2-bg, #fff);
  }

  .ntg-fhub .ntg-fhub__in input {
    font-size: 15px;
  }

  .ntg-fhub .ntg-fhub__cats {
    position: static;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .ntg-fhub .ntg-fhub__cat {
    padding: 9px 14px;
    font-size: 14.5px;
  }

  .ntg-fhub .ntg-fhub__main {
    grid-column: 2;
    grid-row: 1;
  }

  /* 選んだ分類の下の、題だけの目次（JS が作る） */
  .ntg-fhub .ntg-fhub__tree {
    display: block;
    overflow: hidden;
    background: var(--fhub-hi);
    transition: height .26s ease, opacity .26s ease;
  }

  /* 余白は中の箱に（外の箱の高さを 0 までたためるように） */
  .ntg-fhub .ntg-fhub__tin {
    padding: 2px 0 10px;
  }

  /* 開くときは透明から、たたむときは透明へ（高さは JS が付ける） */
  .ntg-fhub .ntg-fhub__tree.is-opening,
  .ntg-fhub .ntg-fhub__tree.is-closing {
    opacity: 0;
  }

  .ntg-fhub .ntg-fhub__tl {
    display: block;
    font-size: 13px;
    line-height: 1.45;
    padding: 4px 14px 4px 48px;
  }

  .ntg-fhub .ntg-fhub__tl:hover {
    color: var(--fhub-link);
    text-decoration: underline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ntg-fhub .ntg-fhub__panel.is-enter {
    animation: none;
  }

  .ntg-fhub .ntg-fhub__cat,
  .ntg-fhub .ntg-fhub__it,
  .ntg-fhub .ntg-fhub__in,
  .ntg-fhub .ntg-fhub__tree {
    transition: none;
  }
}
