/* ═══════════════════════════════════════════════════════════════
   Category hub pages — lab-index layout
   Shared by the category landing pages (/testing/ first). Loaded
   AFTER site.css; every rule is scoped under .hub so nothing here
   can reach a tool page.
   ═══════════════════════════════════════════════════════════════ */

.hub {
  --hub-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --hub-line: rgba(120, 150, 210, .09);
  --g: var(--accent);          /* per-group accent, set on each .hub-group */
  box-sizing: border-box;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 600px) { .hub { padding: 0 16px; } }

/* ── Hero ─────────────────────────────────────────────────────── */
.hub-hero {
  position: relative;
  margin: 8px 0 28px;
  padding: 40px 32px 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(79,142,247,.16) 0%, transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(255,140,66,.10) 0%, transparent 60%),
    linear-gradient(var(--hub-line) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--hub-line) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--surface);
}
.hub-hero::after {               /* engineering-drawing corner ticks */
  content: "";
  position: absolute; inset: 12px;
  pointer-events: none;
  background:
    linear-gradient(var(--text-dim), var(--text-dim)) 0 0 / 14px 1px no-repeat,
    linear-gradient(var(--text-dim), var(--text-dim)) 0 0 / 1px 14px no-repeat,
    linear-gradient(var(--text-dim), var(--text-dim)) 100% 100% / 14px 1px no-repeat,
    linear-gradient(var(--text-dim), var(--text-dim)) 100% 100% / 1px 14px no-repeat;
  opacity: .55;
}
.hub-crumbs {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font: 600 .72rem/1 var(--hub-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hub-crumbs a { color: var(--accent); text-decoration: none; padding: 6px 0; }
.hub-crumbs a:hover { text-decoration: underline; }
.hub-crumbs [aria-current] { color: #b9c3d8; }
.hub-hero h1 {
  margin: 12px 0 10px;
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  max-width: 22ch;
}
.hub-hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #4f8ef7 0%, #7fb6ff 45%, #ffb07a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hub-lede {
  max-width: 64ch;
  color: #aab4c8;
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0;
}
.hub-stats {
  display: flex; flex-wrap: wrap; gap: 10px 28px;
  margin: 24px 0 0; padding: 18px 0 0;
  border-top: 1px dashed var(--border);
  list-style: none;
}
.hub-stats li { display: flex; align-items: baseline; gap: 8px; color: var(--text-dim); font-size: .85rem; }
.hub-stats b {
  font: 700 1.5rem/1 var(--hub-mono);
  color: var(--text);
}

/* ── Hero art: a floating cluster of the category's own tool icons ──
   Decorative only (aria-hidden). Sits in the right of the hero behind the
   text, fading toward it; fewer tiles on mid widths, none on phones. */
.hub-hero > :not(.hub-hero-art) { position: relative; z-index: 1; }
.hub-hero-art {
  position: absolute; top: 6%; bottom: 20%; right: 2%; width: 40%;
  pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
}
.hub-hero-art img {
  position: absolute; display: block; height: auto;
  border-radius: 18%;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.7), 0 0 0 1px rgba(120,150,210,.10);
  animation: hubFloat 9s ease-in-out infinite;
  --r: 0deg;
  transform: rotate(var(--r));
}
.hub-hero-art img:nth-child(1) { top: 6%;  left: 20%; width: 84px; --r: -8deg; opacity: .9;  animation-duration: 9s; }
.hub-hero-art img:nth-child(2) { top: 0%;  left: 64%; width: 62px; --r: 10deg; opacity: .55; filter: blur(.6px); animation-duration: 11s; animation-delay: -3s; }
.hub-hero-art img:nth-child(3) { top: 36%; left: 44%; width: 96px; --r: 6deg;  opacity: .95; animation-duration: 10s; animation-delay: -5s; }
.hub-hero-art img:nth-child(4) { top: 62%; left: 10%; width: 58px; --r: -14deg; opacity: .5; filter: blur(.8px); animation-duration: 12s; animation-delay: -2s; }
.hub-hero-art img:nth-child(5) { top: 30%; left: 82%; width: 72px; --r: -6deg; opacity: .75; animation-duration: 8s; animation-delay: -6s; }
.hub-hero-art img:nth-child(6) { top: 70%; left: 70%; width: 60px; --r: 12deg; opacity: .6;  animation-duration: 10s; animation-delay: -1s; }
.hub-hero-art img:nth-child(7) { top: 76%; left: 38%; width: 50px; --r: -4deg; opacity: .45; filter: blur(.8px); animation-duration: 13s; animation-delay: -7s; }
@keyframes hubFloat {
  0%, 100% { transform: translateY(0) rotate(var(--r)); }
  50%      { transform: translateY(-7px) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) { .hub-hero-art img { animation: none; } }
@media (min-width: 1061px) { .hub-hero .hub-lede { max-width: 58ch; } }
@media (max-width: 1240px) {
  .hub-hero-art { width: 30%; }
  .hub-hero-art img:nth-child(n+5) { display: none; }
  .hub-hero-art img:nth-child(1) { left: 22%; }
  .hub-hero-art img:nth-child(3) { left: 46%; }
  .hub-hero-art img:nth-child(4) { left: 24%; }
}
@media (max-width: 1060px) { .hub-hero-art { display: none; } }

/* ── Filter pills ─────────────────────────────────────────────── */
.hub-filter {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 8px;
  margin: 0 -8px 22px; padding: 12px 8px;
  overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(var(--bg) 78%, rgba(13,17,23,0));
}
.hub-filter::-webkit-scrollbar { display: none; }
.hub-pill {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #b9c3d8;
  font-size: .88rem; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s, transform .12s;
}
.hub-pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--pill, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pill, var(--accent)) 22%, transparent);
}
.hub-pill:hover { border-color: var(--pill, var(--accent)); color: var(--text); }
.hub-pill:active { transform: scale(.97); }
.hub-pill[aria-current="true"] {
  background: color-mix(in srgb, var(--pill, var(--accent)) 16%, var(--surface));
  border-color: var(--pill, var(--accent));
  color: var(--text);
}
.hub-pill .n {
  font: 600 .72rem/1 var(--hub-mono);
  padding: 4px 7px; border-radius: 999px;
  background: var(--surface2); color: var(--text-dim);
}
.hub-pill[aria-current="true"] .n { background: var(--pill, var(--accent)); color: #0d1117; }

/* ── Groups ───────────────────────────────────────────────────── */
.hub-group { margin: 0 0 40px; scroll-margin-top: 72px; }
.hub-group[hidden] { display: none; }
.hub-group-head {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px;
  align-items: end;
  margin: 0 0 16px; padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hub-group-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 72px; height: 2px; background: var(--g);
}
.hub-group-code {
  grid-row: span 2;
  font: 700 .7rem/1.2 var(--hub-mono);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--g);
  border: 1px solid color-mix(in srgb, var(--g) 45%, transparent);
  border-radius: 8px; padding: 8px 10px; text-align: center;
  align-self: stretch; display: grid; place-content: center;
}
.hub-group-code b { display: block; font-size: 1.35rem; letter-spacing: 0; color: var(--text); }
.hub-group h2 { margin: 0; font-size: 1.3rem; font-weight: 750; color: var(--text); }
.hub-group-head p { margin: 0; color: var(--text-dim); font-size: .9rem; line-height: 1.5; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

/* ── Lab cards ────────────────────────────────────────────────── */
.lab-card {
  position: relative;
  display: grid; grid-template-columns: 76px 1fr; gap: 14px;
  padding: 14px 16px 14px 14px;
  border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--g) 7%, var(--surface)) 0%, var(--surface) 55%);
  color: var(--text); text-decoration: none;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
  animation: hubRise .45s ease both;
}
.lab-card:hover, .lab-card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--g) 60%, var(--border));
  box-shadow: 0 10px 28px -14px color-mix(in srgb, var(--g) 70%, transparent);
}
.lab-card img {
  width: 76px; height: 76px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  object-fit: contain;
}
.lab-card h3 { margin: 2px 0 6px; font-size: 1rem; line-height: 1.3; font-weight: 700; }
.lab-card .measures { margin: 0 0 10px; color: #9aa6bd; font-size: .84rem; line-height: 1.45; }
.lab-card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lab-chip {
  font: 600 .68rem/1 var(--hub-mono);
  letter-spacing: .03em;
  padding: 5px 7px; border-radius: 6px;
  color: var(--g);
  background: color-mix(in srgb, var(--g) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--g) 30%, transparent);
}
.lab-card .go {
  margin-left: auto; color: var(--text-dim); font-size: .95rem;
  transition: transform .18s, color .18s;
}
.lab-card:hover .go { transform: translateX(4px); color: var(--g); }


/* Transform only, never opacity: if the animation never runs (a paused or
   hidden tab, a screenshot bot) the card must still be visible. */
@keyframes hubRise { from { transform: translateY(10px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .lab-card { animation: none; transition: none; }
}

/* ── Sub-page library (e.g. one card per cross-section) ─────────── */
.hub-sublib {
  grid-column: 1 / -1;
  padding: 14px 16px 16px;
  border: 1px dashed color-mix(in srgb, var(--g) 40%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--g) 4%, transparent);
}
.hub-sublib h3 {
  margin: 0 0 12px;
  font: 700 .72rem/1 var(--hub-mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--g);
}
.hub-sublib ul {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px;
}
.hub-sublib a {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none;
  font-size: .86rem; font-weight: 600;
  transition: border-color .18s, transform .12s;
}
.hub-sublib a:hover { border-color: var(--g); }
.hub-sublib a:active { transform: scale(.98); }
.hub-sublib svg { flex: 0 0 26px; width: 26px; height: 26px; color: var(--g); }

/* ── Reference table in the article ──────────────────────────── */
.hub-table-wrap { overflow-x: auto; margin: 14px 0 8px; border: 1px solid var(--border); border-radius: 12px; }
.hub-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 620px; }
.hub-table th, .hub-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.hub-table thead th {
  font: 700 .7rem/1.2 var(--hub-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); background: var(--surface2);
}
.hub-table tbody tr:last-child td { border-bottom: 0; }
.hub-table tbody th { font-weight: 650; color: var(--text); }
.hub-table td.std { font-family: var(--hub-mono); font-size: .78rem; color: #b9c3d8; white-space: nowrap; }
.hub-table tr.sep td { background: var(--surface); font: 700 .7rem/1 var(--hub-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); padding: 8px 12px; }

.hub-faq details {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); margin: 0 0 10px; padding: 0 16px;
}
.hub-faq summary { cursor: pointer; padding: 14px 0; font-weight: 650; color: var(--text); }
.hub-faq details[open] summary { border-bottom: 1px dashed var(--border); }
.hub-faq details p { margin: 12px 0 14px; }

.hub-cross { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 12px 0 0; }
.hub-cross a {
  display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); text-decoration: none; color: var(--text); font-weight: 650; font-size: .92rem;
}
.hub-cross a span { display: block; margin-top: 4px; font-weight: 400; font-size: .8rem; color: var(--text-dim); line-height: 1.4; }
.hub-cross a:hover { border-color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────── */
/* The site logo is position:fixed at the top-left. Below ~1360 px #app no
   longer leaves a gutter for it, so the hero starts under its footprint. */
@media (max-width: 1360px) {
  .hub-hero { margin-top: 62px; }
  .hub-filter { top: 54px; }               /* stick below the logo, not under it */
  .hub-group { scroll-margin-top: 126px; }
}
@media (max-width: 600px) {
  .hub-hero { margin-top: 48px; }
  .hub-filter { top: 40px; }
  .hub-group { scroll-margin-top: 110px; }
}
@media (max-width: 768px) {
  .hub-hero { padding: 30px 20px 22px; border-radius: 14px; }
  .hub-grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .hub-hero { padding: 26px 16px 20px; }
  .hub-stats { gap: 8px 18px; }
  .hub-stats b { font-size: 1.25rem; }
  .lab-card { grid-template-columns: 60px 1fr; gap: 12px; }
  .lab-card img { width: 60px; height: 60px; }
  .hub-group-head { grid-template-columns: 1fr; }
  .hub-group-code { grid-row: auto; justify-self: start; display: inline-flex; gap: 8px; align-items: baseline; padding: 5px 9px; }
  .hub-group-code b { display: inline; font-size: .95rem; }
}
@media (max-width: 500px) { .hub-sublib ul { grid-template-columns: 1fr 1fr; } .hub-sublib a { font-size: .8rem; } }
