/* 상단 「제품」 메가 메뉴 (/app/js/nav/megamenu.js) · 제품 화면 섹션 · 「준비 중」 빈 화면 (/app/js/nav/stub.js).
 * 색은 토큰(app.css :root · theme.css 다크)만 쓴다 — 다크에서 따로 덮을 것이 없다. */

/* 섹션 보이기 — 넓은 한 칸(#content) */
body[data-section="charts"] #sect-charts,
body[data-section="screener"] #sect-screener,
body[data-section="calendar"] #sect-calendar { display: block; }

/* 「제품」 단추 — 대메뉴 링크(.tb__nl)와 같은 모양 */
.tb__prodbtn { -webkit-tap-highlight-color: transparent; background: transparent; border-left: 0; border-right: 0; font-family: inherit; cursor: pointer; gap: 4px; }
.tb__prodbtn[aria-expanded="true"] { color: #fff; background: rgba(255, 255, 255, .06); }
.tb__prodbtn.is-current { color: #fff; border-bottom-color: #34c3c5; }
.tb__prodbtn:focus-visible { outline: 2px solid #34c3c5; outline-offset: -4px; }
.tb__caret { font-size: 10px; opacity: .8; }

/* 패널 (데스크톱 — 상단 바 아래로 펼침) */
.mega { position: absolute; top: 100%; left: 20px; z-index: 55; width: 620px; max-width: calc(100vw - 16px); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: 0 18px 40px rgba(16, 24, 40, .22); }
.mega[hidden] { display: none; }
.mega__head { display: none; }
.mega__body { --mega-col: 340px; position: relative; padding: 16px; min-height: 296px; }
.mega__col { width: var(--mega-col); display: grid; gap: 6px; align-content: start; }
.mega a { color: var(--ink); text-decoration: none; }
.mega a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring, rgba(15, 139, 141, .28)); }

.mega__card { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(150deg, var(--accent-soft), transparent 70%), var(--panel-2); }
.mega__card:hover { border-color: var(--accent); }
.mega__ct { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.mega__cd { color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.mega__card[aria-current="page"] .mega__ct { color: var(--accent); }

.mega__g { margin: 10px 0 0; padding: 0 10px; font-size: 11.5px; font-weight: 800; color: var(--ink-3); }
.mega__tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mega__tool--sub { position: static; }
.mega__tl { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; }
.mega__tl:hover, .mega__tool--sub.is-open > .mega__tl { background: var(--panel-2); }
.mega__tn { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14.5px; }
.mega__th { color: var(--ink-3); font-size: 12px; }
.mega__chev { color: var(--ink-3); font-weight: 800; }
.mega__tl[aria-current="page"] .mega__tn { color: var(--accent); }

/* 캘린더 하위 — 오른쪽 칸. 캘린더 줄에 올리거나 포커스하면 보인다. */
.mega__sub { list-style: none; margin: 0; padding: 0 0 0 16px; display: none; position: absolute; top: 16px; bottom: 16px; left: calc(var(--mega-col) + 32px); right: 16px; border-left: 1px solid var(--line); align-content: start; gap: 2px; }
.mega__tool--sub.is-open > .mega__sub, .mega__tool--sub:hover > .mega__sub, .mega__tool--sub:focus-within > .mega__sub { display: grid; }
.mega__sl { display: block; padding: 9px 10px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.mega__sl:hover { background: var(--panel-2); }
.mega__sl[aria-current="page"] { color: var(--accent); }
.mega-bd { display: none; }
body.mega-open .tb { z-index: 92; } /* 열린 메뉴 · 시트가 아래 화면(하단 탭 · 채팅)보다 위에 */

/* 좁은 화면 — 아래에서 올라오는 시트 */
@media (max-width: 1099.98px) {
  .mega { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; max-height: 85svh; overflow-y: auto; overscroll-behavior: contain; z-index: 91; border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -18px 40px rgba(9, 14, 24, .28); }
  .mega__head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--panel); padding: 10px 12px 6px 22px; border-bottom: 1px solid var(--line); }
  .mega__ht { margin: 0; font-weight: 800; font-size: 16px; }
  .mega__x { min-width: 44px; min-height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 16px; cursor: pointer; }
  .mega__x:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring, rgba(15, 139, 141, .28)); }
  .mega__body { padding: 12px 12px 16px; min-height: 0; }
  .mega__col { width: auto; }
  .mega__tl { min-height: 44px; align-content: center; }
  .mega__sub { position: static; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 2px 0 6px 10px; border-left: 0; }
  .mega__sl { min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--panel-2); padding: 0 6px; }
  .mega-bd:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 90; background: rgba(9, 14, 24, .5); }
}

/* 「준비 중」 빈 화면 */
.stub { padding: 24px 20px 40px; max-width: 920px; }
.stub__h { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.stub__k { color: var(--ink-2); font-weight: 700; }
.stub__d { margin: 6px 0 0; color: var(--ink-2); }
.stub__tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.stub__tab { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; color: var(--ink-2); font-weight: 700; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.stub__tab:hover { color: var(--ink); }
.stub__tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.stub__box { margin: 16px 0 0; }
@media (max-width: 1099.98px) {
  .stub { padding: 16px 12px 32px; }
  .stub__h { font-size: 19px; }
}

/* 「제품」 단추 · 「마켓」 링크가 늘어난 만큼 — 1100~1599px 에서 대메뉴 간격을 줄여 전역 검색 너비(≥360px)를 지킨다 */
@media (min-width: 1100px) and (max-width: 1599.98px) {
  .tb__in { gap: 10px; }
  .tb__nav { gap: 0; }
  .tb__nl { padding: 0 8px; }
}
