/* LegalTech CC — Prototype: Listing (skills table areas)
 * Lives in /prototype/. Not shipped.
 * v1.0 — GitHub jump links per group, empty state, table cell row-filter hooks
 */

/* tools-index already styled by _tools.css; only add hooks here */

/* Critical: prevent grid blowout from unbreakable table cells */
.tools-index,
.tools-with-filters > section {
  min-width: 0;
}

/* GitHub jump link — appears in <summary> of each <details> group */
.tools-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tools-group > summary > span {
  flex: 1;
  min-width: 0;
}

.tools-group > summary > span em {
  font-style: normal;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

.gh-jump {
  display: none;
  align-items: center;
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.gh-jump:hover {
  border-color: var(--jade);
  background: rgba(37, 196, 155, 0.06);
  color: var(--teal);
  transform: translateX(2px);
}

.gh-jump:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

/* Hide GitHub jump when group is collapsed — keep summary clean */
.tools-group:not([open]) .gh-jump {
  display: none;
}

/* Card-level GitHub jump link (workflows.html wf-card) */
.wf-card {
  position: relative;
}

.wf-card .gh-jump {
  margin-top: 12px;
  align-self: flex-start;
}

/* Row hidden state — JS toggles .is-hidden */
.tools-group tbody tr.is-hidden,
.tools-group .group-note.is-hidden,
.tools-group .more.is-hidden {
  display: none !important;
}

/* Empty state — visible when no row matches in any group */
.empty-state {
  margin-top: 16px;
  padding: 28px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  text-align: center;
}

.empty-state p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.empty-state .filter-reset {
  display: inline-block;
}

/* Hide groups that have zero visible rows when filtered */
.tools-group.is-empty {
  opacity: 0.45;
}

/* Tutorial TOC layout (tutorial-detail.html)
 * 2:10 layout: AT-A-GLANCE + sidebar TOC + body article
 */
.course-with-toc {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 10fr);
  gap: 28px;
  margin-top: 24px;
  align-items: start;
}

.course-with-toc > .course-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  margin: 0;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  grid-column: 1;
  grid-row: 1;
}

.course-with-toc > .course-body {
  grid-column: 2;
  grid-row: 1;
  margin-top: 0;
  min-width: 0;
}

/* Responsive: stack everything vertically on small screens */
@media (max-width: 980px) {
  .course-with-toc {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .course-with-toc > .course-toc,
  .course-with-toc > .course-body {
    grid-column: 1;
    grid-row: auto;
  }

  .course-with-toc > .course-toc {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* TOC nav: stacked links with active highlight */
.course-toc strong {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 10px;
}

.course-toc nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.course-toc nav a {
  display: block;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
  scroll-margin-top: 80px;
}

.course-toc nav a:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.course-toc nav a.is-active {
  border-left-color: var(--jade);
  background: rgba(37, 196, 155, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.course-toc nav a[data-toc-level="3"] {
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
}

/* GitHub 入口尚未公开；保留源标记，暂不在原型中展示。 */
.github-hidden th:last-child,
.github-hidden td:last-child {
  display: none;
}

/* Article body — scroll-margin so anchor jumps account for fixed header */
.course-body section[id],
.course-body h2[id],
.course-body h3[id] {
  scroll-margin-top: 80px;
}

/* Footnotes — discreet numbered list */
.footnotes {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  counter-reset: footnotes;
}

.footnotes ol {
  padding-left: 0;
  list-style: none;
  counter-reset: none;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.footnotes li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  counter-increment: footnotes;
}

.footnotes li::before {
  content: counter(footnotes);
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--teal);
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
  line-height: 18px;
}

.fn-back {
  margin-left: 4px;
  color: var(--teal);
  text-decoration: none;
  font-size: 11px;
}

.fn-back:hover {
  text-decoration: underline;
}

sup[id^="fnref:"] a {
  color: var(--teal);
  text-decoration: none;
}

sup[id^="fnref:"] a:hover {
  text-decoration: underline;
}
