/* MoaHub Ecosystem Widget v2.0 — 모아 코어 v2 크롬. 모든 스타일은 .moahub-eco-* 로 스코프. */
/* 2026-10-01: 외부 Pretendard @import 제거 — 렌더 차단 체인(바 CSS → jsdelivr CSS)이 LCP 를 늦췄다.
   바 글꼴은 페이지에 이미 있는 Pretendard 를 쓰고, 없으면 시스템 글꼴로 대체된다. */

.moahub-eco-bar, .moahub-eco-dropdown, .moahub-eco-footer {
  --eco-bg: #FFFFFF; --eco-ink: #15171C; --eco-ink-2: #5B5F6B; --eco-line: #ECEBE5; --eco-accent: #4353E8; --eco-soft: #F4F4F1;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  box-sizing: border-box; line-height: 1.4;
}
.moahub-eco-bar[data-theme="dark"], .moahub-eco-dropdown[data-theme="dark"], .moahub-eco-footer[data-theme="dark"] {
  --eco-bg: #101217; --eco-ink: #ECEDF1; --eco-ink-2: #B3B7C2; --eco-line: #262A33; --eco-accent: #9DAAFF; --eco-soft: #171A21;
}
.moahub-eco-bar *, .moahub-eco-dropdown *, .moahub-eco-footer * { box-sizing: border-box; }

/* ===== 상단 바 ===== */
.moahub-eco-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99999;
  height: 40px; padding: 0 14px;
  display: flex; align-items: center; gap: 4px;
  background: var(--eco-bg); color: var(--eco-ink-2);
  border-bottom: 1px solid var(--eco-line);
  font-size: 13px; transition: transform .25s ease;
}
.moahub-eco-bar.moahub-eco-compact { height: 32px; font-size: 12px; }
.moahub-eco-bar.moahub-eco-hidden { transform: translateY(-100%); }

.moahub-eco-brand {
  display: inline-flex; align-items: center; gap: 7px; height: 100%; padding-right: 12px;
  color: var(--eco-ink); font-weight: 700; font-size: 13.5px; text-decoration: none; flex-shrink: 0;
}
.moahub-eco-brand svg { color: var(--eco-accent); }
.moahub-eco-brand:hover span { text-decoration: underline; text-underline-offset: 3px; }

.moahub-eco-links { display: flex; align-items: center; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; flex: 1; }
.moahub-eco-links::-webkit-scrollbar { display: none; }
.moahub-eco-links a {
  display: inline-flex; align-items: center; height: 100%; padding: 0 10px;
  color: var(--eco-ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent;
}
.moahub-eco-links a:hover { color: var(--eco-ink); }
.moahub-eco-links a[data-current="true"] { color: var(--eco-ink); font-weight: 700; border-bottom-color: var(--eco-accent); }

.moahub-eco-more-btn, .moahub-eco-close {
  height: 100%; min-width: 40px; padding: 0 10px; border: 0; background: transparent; color: var(--eco-ink-2);
  font: inherit; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.moahub-eco-more-btn:hover, .moahub-eco-close:hover { color: var(--eco-ink); }
.moahub-eco-more-btn[aria-expanded="true"] { color: var(--eco-accent); }
.moahub-eco-close { font-size: 20px; padding: 0 6px; }
.moahub-eco-more-btn:focus-visible, .moahub-eco-close:focus-visible, .moahub-eco-links a:focus-visible, .moahub-eco-brand:focus-visible {
  outline: 2px solid var(--eco-accent); outline-offset: -2px;
}

/* ===== 드롭다운 ===== */
.moahub-eco-dropdown {
  position: fixed; top: 40px; left: 0; right: 0; z-index: 99998;
  max-height: calc(100vh - var(--moahub-eco-h, 40px)); overflow-y: auto;
  background: var(--eco-bg); color: var(--eco-ink); border-bottom: 1px solid var(--eco-line);
  box-shadow: 0 24px 48px rgba(20, 22, 30, .12);
  padding: 18px 20px 22px; display: none;
}
.moahub-eco-compact + .moahub-eco-dropdown, .moahub-eco-dropdown.moahub-eco-compact { top: 32px; }
.moahub-eco-dropdown.moahub-eco-open { display: block; }
.moahub-eco-dropdown-cat { max-width: 1140px; margin: 0 auto 18px; }
.moahub-eco-dropdown-cat h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--eco-ink-2); text-transform: uppercase; }
.moahub-eco-dropdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.moahub-eco-dropdown-item {
  display: grid; grid-template-columns: 24px 1fr; grid-template-rows: auto auto; column-gap: 10px;
  min-height: 48px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--eco-ink);
}
.moahub-eco-dropdown-item:hover, .moahub-eco-dropdown-item:focus-visible { background: var(--eco-soft); outline: none; }
.moahub-eco-dropdown-item[data-current="true"] { background: var(--eco-soft); box-shadow: inset 0 0 0 1px var(--eco-line); }
.moahub-eco-icon { grid-row: 1 / span 2; font-size: 18px; line-height: 24px; text-align: center; }
.moahub-eco-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.moahub-eco-desc { font-size: 12px; color: var(--eco-ink-2); }
.moahub-eco-badge { font-size: 9.5px; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; background: var(--eco-accent); color: #fff; }
.moahub-eco-badge-hot { background: #E0655A; }

/* ===== 공용 푸터 ===== */
.moahub-eco-footer {
  background: var(--eco-bg); color: var(--eco-ink-2); border-top: 1px solid var(--eco-line);
  padding: 28px 20px 32px; font-size: 12.5px; line-height: 1.7;
}
.moahub-eco-footer-in { max-width: 1140px; margin: 0 auto; }
.moahub-eco-footer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 12px; }
.moahub-eco-footer-brand { display: inline-flex; align-items: center; gap: 7px; color: var(--eco-ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.moahub-eco-footer-brand svg { color: var(--eco-accent); }
.moahub-eco-footer-links { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.moahub-eco-footer-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 8px; color: var(--eco-ink-2); text-decoration: none; font-weight: 500; }
.moahub-eco-footer-links a:hover { color: var(--eco-ink); }
.moahub-eco-footer-biz, .moahub-eco-footer-legal { margin: 0; }
.moahub-eco-footer-biz a, .moahub-eco-footer-legal a { color: inherit; }

@media (max-width: 640px) {
  .moahub-eco-bar { padding: 0 8px; height: 44px; } /* 2026-09-30 탭 높이 39px → 44px (모바일 최소 탭 타깃) */
  .moahub-eco-bar.moahub-eco-compact { height: 36px; }
  .moahub-eco-brand span { display: none; }
  .moahub-eco-brand { min-width: 44px; justify-content: center; padding-right: 8px; } /* 탭 타깃 ≥40px */
  .moahub-eco-more-btn { padding: 0 8px; }
  .moahub-eco-dropdown { padding: 14px 14px 20px; }
  .moahub-eco-dropdown-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .moahub-eco-bar { transition: none; } }
