/* ══ 표준 푸터 — 맨 아래 회사, 그 위 패밀리 ══
   family-sync.py 가 사이트마다 복사한다. 고칠 일은 정본을 고치고 다시 뿌린다.
   정본: D:/manhattan/fat-man/harness/docs/family-footer/README.md

   색은 그 사이트 토큰을 먼저 쓴다. 토큰 이름이 다른 사이트는 제 CSS 에
   .ff { --ff-pan: …; --ff-fg: …; --ff-key: …; } 세 줄만 적으면 된다.
   :where 로 묶어 두어 사이트 쪽이 어느 순서로 불려도 이긴다. */
:where(.ff, .fd) {
  --ff-pan: var(--pan, #101215);
  --ff-fg: var(--fg, #ffffff);
  --ff-line: var(--line, color-mix(in srgb, var(--ff-fg) 12%, transparent));
  --ff-line2: var(--line-2, color-mix(in srgb, var(--ff-fg) 18%, transparent));
  --ff-dim: var(--dim, color-mix(in srgb, var(--ff-fg) 58%, transparent));
  --ff-w4: var(--w4, color-mix(in srgb, var(--ff-fg) 68%, transparent));
  --ff-key: var(--key, #2bf5c8);
  --ff-key-soft: var(--key-soft, color-mix(in srgb, var(--ff-key) 14%, transparent));
  --ff-tap: var(--tap, 44px);
  --ff-ease: var(--ease, ease);
  --ff-max: 1680px;
  --ff-gut: clamp(14px, 3vw, 48px);
}

.ff { background: var(--ff-pan); color: var(--ff-dim); border-top: 1px solid var(--ff-line); }

/* 사이트 쪽 초기화에 기대지 않는다. 어느 저장소에 떨어져도 같은 모양으로 선다 */
.ff-floors, .ff-floors * { box-sizing: border-box; }
.ff-floors a { color: inherit; text-decoration: none; }
.ff-floors ul { margin: 0; padding: 0; list-style: none; }
.ff-floors a:focus-visible, .ff-sum:focus-visible { outline: 2px solid var(--ff-key); outline-offset: 2px; }

/* 테두리는 화면 끝까지 가고 글만 가운데 폭에 맞춘다.
   안쪽 시작점은 max-width + margin:auto + 같은 여백으로 선 사이트 제 푸터와 같다 */
.ff-fam, .ff-co {
  padding-inline: calc(max(0px, (100% - var(--ff-max)) / 2) + var(--ff-gut));
  border-top: 1px solid var(--ff-line);
}

.ff-n { color: var(--ff-key); font-size: 0.78rem; font-family: var(--font-num, inherit); font-variant-numeric: tabular-nums; font-weight: 400; }

/* ── 패밀리층 — 평소엔 접힌 줄뿐이다. 수가 늘어도 이 줄은 늘지 않는다 ── */
.ff-sum {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--ff-tap);
  padding-block: 4px;
  color: var(--ff-w4);
  font-size: 0.86rem;
  cursor: pointer;
  list-style: none;
}
.ff-sum-next { margin-left: 8px; }
.ff-sum::-webkit-details-marker { display: none; }
.ff-sum::after { content: '▾'; color: var(--ff-dim); font-size: 0.72rem; transition: transform 180ms var(--ff-ease); }
.ff-fold[open] > .ff-sum::after { transform: rotate(180deg); }
.ff-sum:hover, .ff-sum:focus-visible { color: var(--ff-key); }

.ff-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px clamp(20px, 3vw, 48px);
  padding-block: 4px 12px;
}
.ff-block { min-width: 0; }

.ff-bname {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ff-line2);
  color: var(--ff-fg);
  font-size: 0.86rem;
  font-weight: 700;
}
.ff-floors a.ff-bname { color: var(--ff-fg); }
.ff-floors a.ff-bname:hover, .ff-floors a.ff-bname:focus-visible { color: var(--ff-key); }
.ff-bname .ff-n { margin-left: auto; }

/* 칸 폭을 먼저 묶어야 긴 이름이 옆 묶음으로 넘어가지 않고 말줄임으로 끊긴다 */
.ff-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }

.ff-cell > a, .ff-cell.ff-off, .ff-cell.ff-here {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  min-height: 28px;
  padding: 3px 0;
}

/* 긴 이름은 줄을 늘리지 않고 말줄임으로 끊는다 */
.ff-tag { flex: 0 0 5.5em; overflow: hidden; color: var(--ff-dim); font-size: 0.72rem; letter-spacing: 0.04em; text-overflow: ellipsis; white-space: nowrap; }
.ff-nm { min-width: 0; overflow: hidden; color: var(--ff-w4); font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
.ff-ico { flex: 0 0 1.5em; font-size: 0.92rem; text-align: center; }
.ff-cell > a:hover .ff-nm, .ff-cell > a:focus-visible .ff-nm { color: var(--ff-key); }

/* 주소 없는 사이트는 흐리게 두고 누르지 못하게 한다. 지금 사이트는 핵심색이다 */
.ff-off { opacity: 0.56; }
.ff-here .ff-nm, .ff-here .ff-tag, .ff-bname.ff-here { color: var(--ff-key); }
.ff-floors .ff-rest a { color: var(--ff-dim); font-size: 0.78rem; font-family: var(--font-num, inherit); }
.ff-floors .ff-rest a:hover { color: var(--ff-key); }

.ff-all { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 20px; margin: 0; padding-block: 0 16px; font-size: 0.78rem; }
.ff-floors .ff-all a { display: inline-flex; align-items: center; min-height: 28px; color: var(--ff-w4); }
.ff-floors .ff-all a:hover { color: var(--ff-key); }

.ff-hid { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── 회사층 — 맨 아래 한 줄 ── */
.ff-co {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  margin: 0;
  padding-block: 12px 32px;
  color: var(--ff-dim);
  font-size: 0.76rem;
  text-align: center;
  overflow-wrap: anywhere;
}
.ff-co b { color: var(--ff-w4); font-weight: 500; }
.ff-co i { font-style: normal; letter-spacing: 0.06em; }

@media (max-width: 859px) {
  .ff-blocks { grid-template-columns: minmax(0, 1fr); }
  .ff-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* 손가락으로 누르는 화면은 누름 자리를 44px 로 올린다 */
@media (max-width: 859px), (pointer: coarse) {
  .ff-cell > a, .ff-cell.ff-off, .ff-cell.ff-here { align-items: center; min-height: var(--ff-tap); }
  .ff-floors .ff-rest a { display: flex; align-items: center; min-height: var(--ff-tap); }
  .ff-bname { align-items: center; min-height: var(--ff-tap); margin-bottom: 4px; padding-bottom: 0; }
  .ff-floors .ff-all a { min-height: var(--ff-tap); }
}

@media (prefers-reduced-motion: reduce) {
  .ff-sum::after { transition: none; }
}
