/* The labs page (templates/labkit/hub.html), made simple for someone new:
   search, one row of topics, then one clear card per lab (picture, name, one line, one button).
   Colours come from the site tokens, so palettes and dark mode follow.
   Phone: topics swipe sideways, cards are full-width rows. Tablet: 2 cards a row.
   Laptop: 3. Monitor: 4. TV: 5. Tap targets are at least 44px. */
.hub { max-width: 1180px; margin: 0 auto; }
@media (min-width: 1536px) { .hub { max-width: 1400px; } }
@media (min-width: 1920px) { .hub { max-width: 1680px; } }
.hub-head { text-align: center; }
.hub-head .eyebrow { justify-content: center; display: flex; }
.hub-title { margin-top: .3rem; font-family: Manrope, Inter, sans-serif; font-weight: 700; font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.1; letter-spacing: -.02em; color: rgb(var(--c-ink)); }
.hub-sub { margin: .7rem auto 0; max-width: 42rem; color: rgb(var(--c-slate-500)); }
.hub-search { display: flex; align-items: center; gap: .7rem; max-width: 36rem; min-height: 56px; margin: 1.4rem auto 0; padding: 0 1.1rem; border-radius: 16px;
  background: rgb(var(--c-card)); border: 2px solid rgb(var(--c-line)); border-bottom-width: 4px; }
.hub-search:focus-within { border-color: rgb(var(--c-accent-2-light)); }
.hub-search svg { flex: none; width: 22px; height: 22px; color: rgb(var(--c-slate-500)); }
.hub-search input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; font-size: 1.05rem; font-weight: 600; color: rgb(var(--c-ink)); outline: none; box-shadow: none; }

/* how it works: three small steps */
.hub-how { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.6rem; margin: 1.6rem 0 0; padding: 0; list-style: none; }
.hub-how li { display: flex; align-items: center; gap: .55rem; font-weight: 800; color: rgb(var(--c-slate-600)); }
.hub-how b, .hub-h b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgb(var(--c-accent-1)); color: #fff;
  font-family: Manrope, Inter, sans-serif; font-size: 1.05rem; box-shadow: 0 3px 0 color-mix(in srgb, rgb(var(--c-accent-1)) 70%, #000); }
:root[data-theme="dark"] .hub-how b, :root[data-theme="dark"] .hub-h b { color: #181311; }

/* the helper quiz, folded away */
.hub-finder { max-width: 46rem; margin: 1.4rem auto 0; border-radius: 16px; border: 2px dashed rgb(var(--c-line)); background: rgb(var(--c-card)); }
.hub-finder summary { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 52px; padding: .4rem 1rem; cursor: pointer; list-style: none;
  font-weight: 800; color: rgb(var(--c-accent-2)); text-align: center; }
.hub-finder summary::-webkit-details-marker { display: none; }
.hub-finder summary::after { content: "+"; font-size: 1.4rem; line-height: 1; }
.hub-finder[open] summary::after { content: "–"; }
.hub-finder .finder { padding: 0 1.1rem 1.2rem; }

.hub-h { display: flex; align-items: center; gap: .7rem; margin-top: 2.6rem; font-family: Manrope, Inter, sans-serif; font-weight: 700; font-size: clamp(1.4rem, 3vw, 1.8rem); color: rgb(var(--c-ink)); }

/* topics */
.hub-cats { display: grid; gap: .8rem; margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hub-cat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 120px; padding: .9rem .6rem; text-align: center; border-radius: 18px;
  background: rgb(var(--c-card)); border: 2px solid rgb(var(--c-line)); border-bottom-width: 5px; transition: transform .1s ease, background .15s ease, border-color .15s ease; }
.hub-cat-ico { font-size: 2.3rem; line-height: 1; }
.hub-cat-name { font-weight: 800; line-height: 1.2; color: rgb(var(--c-ink)); }
.hub-cat small { font-weight: 700; font-size: .78rem; color: rgb(var(--c-slate-500)); }
@media (hover: hover) { .hub-cat:hover { background: rgb(var(--c-accent-2-tint) / .6); } }
.hub-cat:active { transform: translateY(3px); border-bottom-width: 2px; }
.hub-cat.is-on { background: rgb(var(--c-accent-2-tint)); border-color: rgb(var(--c-accent-2-light)); }
.hub-cat.is-on .hub-cat-name { color: rgb(var(--c-accent-2)); }
@media (max-width: 639px) {
  .hub-cats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 136px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .5rem; scrollbar-width: none;
    margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; }
  .hub-cats::-webkit-scrollbar { display: none; }
  .hub-cat { scroll-snap-align: start; min-height: 108px; }
}

/* one group per topic */
.hub-group { margin-top: 1.8rem; }
.hub-group-head { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; border-radius: 16px; background: var(--g-tint); }
.hub-group-ico { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 14px; background: rgb(var(--c-card)); font-size: 1.7rem; box-shadow: 0 3px 0 rgb(0 0 0 / .1); }
.hub-group-head h3 { margin: 0; font-family: Manrope, Inter, sans-serif; font-weight: 700; font-size: 1.35rem; line-height: 1.15; color: rgb(var(--c-ink)); }
.hub-group-head p { margin: .15rem 0 0; font-size: .92rem; color: rgb(var(--c-slate-600)); }
.hub-group:nth-of-type(6n+1) { --g: #8b5e3c; --g-bg: linear-gradient(150deg, #ecd3b4, #c4935f); --g-tint: color-mix(in srgb, #c4935f 22%, rgb(var(--c-card))); }
.hub-group:nth-of-type(6n+2) { --g: #a05214; --g-bg: linear-gradient(150deg, #f6d29f, #dd9548); --g-tint: color-mix(in srgb, #dd9548 22%, rgb(var(--c-card))); }
.hub-group:nth-of-type(6n+3) { --g: #4f7d32; --g-bg: linear-gradient(150deg, #d6e3bd, #8aa765); --g-tint: color-mix(in srgb, #8aa765 24%, rgb(var(--c-card))); }
.hub-group:nth-of-type(6n+4) { --g: #2f6f73; --g-bg: linear-gradient(150deg, #c6dfdf, #6ba1a5); --g-tint: color-mix(in srgb, #6ba1a5 24%, rgb(var(--c-card))); }
.hub-group:nth-of-type(6n+5) { --g: #8a6a12; --g-bg: linear-gradient(150deg, #f1e0a8, #cfaa48); --g-tint: color-mix(in srgb, #cfaa48 24%, rgb(var(--c-card))); }
.hub-group:nth-of-type(6n+6) { --g: #a14a4a; --g-bg: linear-gradient(150deg, #f0cbc3, #cd8479); --g-tint: color-mix(in srgb, #cd8479 22%, rgb(var(--c-card))); }

/* lab cards: a clear picture, a name, one line, one button */
.hub-grid { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (min-width: 1920px) { .hub-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.hub-lab { display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: rgb(var(--c-card)); border: 2px solid rgb(var(--c-line)); border-bottom-width: 5px;
  transition: transform .12s ease, border-color .15s ease; }
.hub-lab-art { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 8; background: var(--g-bg); overflow: hidden; }
.hub-lab-art::before { content: ""; position: absolute; inset: 0; opacity: .35;
  background: radial-gradient(circle at 18% 22%, #fff 0 10%, transparent 11%), radial-gradient(circle at 86% 78%, #fff 0 14%, transparent 15%), radial-gradient(circle at 80% 14%, #fff 0 5%, transparent 6%); }
.hub-lab-ico { position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 24px; background: #fffbf4; font-size: 2.9rem; line-height: 1;
  box-shadow: 0 5px 0 rgb(0 0 0 / .16); transform: rotate(-4deg); transition: transform .2s ease; }
.hub-lab-body { display: flex; flex-direction: column; gap: .25rem; flex: 1; padding: .9rem 1rem 1rem; }
.hub-lab-kind { font-weight: 800; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: var(--g); }
:root[data-theme="dark"] .hub-lab-kind { color: rgb(var(--c-accent-2)); }
.hub-lab-name { font-family: Manrope, Inter, sans-serif; font-weight: 600; font-size: 1.2rem; line-height: 1.2; color: rgb(var(--c-ink)); }
.hub-lab-text { font-size: .92rem; line-height: 1.45; color: rgb(var(--c-slate-500)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hub-lab-go { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: auto; padding: 0 1rem; border-radius: 12px; font-weight: 800; font-size: .82rem; letter-spacing: .05em; text-transform: uppercase;
  background: rgb(var(--c-accent-1)); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, rgb(var(--c-accent-1)) 70%, #000); }
.hub-lab-body > .hub-lab-text { margin-bottom: .7rem; }
.hub-lab-go.is-pro { background: rgb(var(--c-card)); color: rgb(var(--c-slate-600)); border: 2px solid rgb(var(--c-line)); box-shadow: 0 4px 0 rgb(var(--c-line)); }
:root[data-theme="dark"] .hub-lab-go:not(.is-pro) { color: #181311; }
@media (hover: hover) { .hub-lab:hover { transform: translateY(-3px); border-color: rgb(var(--c-accent-2-light)); } .hub-lab:hover .hub-lab-ico { transform: rotate(4deg) scale(1.06); } }
.hub-lab:active { transform: translateY(2px); border-bottom-width: 3px; }
/* phone: a compact row – picture on the left, words on the right */
@media (max-width: 559px) {
  .hub-grid { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .hub-lab { flex-direction: row; align-items: stretch; }
  .hub-lab-art { flex: none; width: 104px; aspect-ratio: auto; }
  .hub-lab-ico { width: 64px; height: 64px; border-radius: 18px; font-size: 2.2rem; }
  .hub-lab-body { padding: .7rem .8rem .8rem; min-width: 0; }
  .hub-lab-body > .hub-lab-text { margin-bottom: .5rem; }
  .hub-lab-go { min-height: 40px; align-self: flex-start; }
}

.hub-pro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2.6rem; padding: 1.3rem 1.4rem; border-radius: 18px;
  background: rgb(var(--c-card)); border: 2px solid rgb(var(--c-line)); border-bottom-width: 5px; }

/* the drawing fills the picture; the lab's own icon sits in the corner as a badge */
.hub-lab-art { aspect-ratio: 2 / 1; }
.hub-lab-art::before { display: none; }
.hub-lab-art .la { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hub-lab-art .hub-lab-image { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.finder-picture { display:block; width:100%; aspect-ratio:320 / 130; object-fit:cover; border-bottom:1px solid rgb(var(--c-line)); }
.hub-lab-art .hub-lab-ico { position: absolute; left: 10px; bottom: 10px; width: 46px; height: 46px; border-radius: 14px; font-size: 1.6rem; transform: rotate(-4deg); box-shadow: 0 3px 0 rgb(0 0 0 / .22); }
.la * { transform-box: fill-box; transform-origin: center; }
@media (hover: hover) {
  .hub-lab:hover .la-move { animation: la-move .9s ease-in-out infinite alternate; }
  .hub-lab:hover .la-glow { animation: la-glow .7s ease-in-out infinite alternate; }
  .hub-lab:hover .la-grow { transform-origin: bottom; animation: la-grow .8s ease-in-out infinite alternate; }
}
@keyframes la-move { from { transform: translate(0, 0); } to { transform: translate(6px, -5px); } }
@keyframes la-glow { from { opacity: 1; transform: scale(1); } to { opacity: .6; transform: scale(1.15); } }
@keyframes la-grow { from { transform: scaleY(1); } to { transform: scaleY(.7); } }
.no-motion .la * { animation: none !important; }
@media (max-width: 559px) { .hub-lab-art { aspect-ratio: auto; } .hub-lab-art .hub-lab-ico { width: 36px; height: 36px; font-size: 1.2rem; left: 6px; bottom: 6px; border-radius: 10px; } }

/* Stronger discovery and clear card interaction */
.hub { max-width: 1320px; padding-bottom: 3rem; }
.hub-head { position: relative; overflow: hidden; padding: clamp(24px, 5vw, 58px) 20px 34px; border: 1px solid rgb(var(--c-line)); border-radius: 30px; background: radial-gradient(ellipse at 50% -10%, rgb(var(--c-accent-2-tint)), transparent 60%), rgb(var(--c-card)); box-shadow: 0 24px 70px -52px rgb(15 23 42 / .5); }
.hub-head .eyebrow { align-items: center; gap: 8px; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: rgb(var(--c-accent-2)); }
.hub-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgb(34 197 94 / .13); }
.hub-title { max-width: 780px; margin-left: auto; margin-right: auto; }
.hub-sub { max-width: 48rem; line-height: 1.65; }
.hub-search { max-width: 42rem; margin-top: 1.8rem; box-shadow: 0 12px 30px -24px rgb(15 23 42 / .55); transition: border-color .18s, box-shadow .18s, transform .18s; }
.hub-search:focus-within { transform: translateY(-2px); box-shadow: 0 14px 34px -22px rgb(var(--c-accent-2)); }
.hub-how { margin-top: 1.4rem; }
.hub-cats { grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: .7rem; }
.hub-cat { min-height: 108px; border-radius: 16px; }
.hub-group { margin-top: 2.3rem; }
.hub-group-head { min-height: 80px; border: 1px solid rgb(var(--c-line) / .7); }
.hub-grid { grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 1.15rem; }
.hub-lab { border-radius: 20px; box-shadow: 0 12px 32px -28px rgb(15 23 42 / .7); }
.hub-lab-art { aspect-ratio: 1.9 / 1; }
.hub-lab-body { padding: 1rem 1.05rem 1.05rem; }
.hub-lab-name { font-size: 1.27rem; }
.hub-lab-go { letter-spacing: .035em; transition: filter .15s, transform .15s; }
.hub-lab:hover .hub-lab-go { filter: brightness(1.06); transform: translateY(-1px); }
.hub-lab:focus-visible, .hub-cat:focus-visible { outline: 3px solid rgb(var(--c-accent-2)); outline-offset: 3px; }
.hub-cat:focus-visible { position: relative; z-index: 1; }
.hub-empty { margin: 1rem 0; padding: 24px; border: 1px dashed rgb(var(--c-line)); border-radius: 16px; color: rgb(var(--c-slate-500)); text-align: center; }
@media (max-width: 639px) {
  .hub-head { margin: 0 -4px; border-radius: 22px; padding: 28px 14px 24px; }
  .hub-title { font-size: clamp(1.8rem, 9vw, 2.6rem); }
  .hub-group-head { align-items: flex-start; padding: .8rem; }
}
@media (prefers-reduced-motion: reduce) { .hub-search, .hub-lab-go { transition: none; } }
.hub-progress { display: flex; align-items: center; gap: 12px; margin: 1.6rem 0 0; padding: 14px 18px; border: 1px solid color-mix(in srgb, rgb(var(--c-accent-2)) 25%, rgb(var(--c-line))); border-radius: 16px; background: color-mix(in srgb, rgb(var(--c-accent-2-tint)) 65%, rgb(var(--c-card))); }
.hub-progress-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: rgb(var(--c-card)); color: rgb(var(--c-accent-2)); font-size: 1.35rem; }
.hub-progress > span:nth-child(2) { display: grid; gap: 2px; color: rgb(var(--c-ink)); }
.hub-progress small { color: rgb(var(--c-slate-600)); }
.hub-progress a { margin-left: auto; color: rgb(var(--c-accent-2)); font-weight: 800; white-space: nowrap; text-decoration: none; }
.hub-progress a:hover { text-decoration: underline; }
.hub-lab-progress { align-self: flex-start; margin: 0 0 .45rem; padding: 3px 9px; border: 1px solid rgb(34 197 94 / .25); border-radius: 999px; background: rgb(34 197 94 / .09); color: #15803d; font-size: .76rem; font-weight: 800; }
:root[data-theme="dark"] .hub-lab-progress { color: #86efac; }
@media (max-width: 559px) { .hub-progress { align-items: flex-start; flex-wrap: wrap; } .hub-progress a { margin-left: 50px; } }

/* A considered motion system: small cues guide attention without turning the catalog into a toy. */
.hub-head { isolation: isolate; }
.hub-head::after { content: ""; position: absolute; z-index: -1; right: -92px; bottom: -160px; width: 350px; aspect-ratio: 1; border: 1px solid rgb(var(--c-accent-2) / .18); border-radius: 50%; box-shadow: 0 0 0 34px rgb(var(--c-accent-2) / .035), 0 0 0 72px rgb(var(--c-accent-2) / .025); animation: hub-orbit 22s linear infinite; pointer-events: none; }
.hub-live-dot { animation: hub-pulse 2.8s ease-in-out infinite; }
.hub-cat { transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, border-color .2s, background .2s; }
.hub-cat-ico { display: inline-block; transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.hub-group-head { position: relative; overflow: hidden; }
.hub-group-head::after { content: ""; position: absolute; right: 0; bottom: 0; width: 30%; height: 2px; opacity: .35; background: linear-gradient(90deg, transparent, var(--g), transparent); }
.hub-lab { transform: translateY(0); transition: transform .24s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .24s; animation: hub-card-in .48s both; }
.hub-lab:nth-child(4n + 2) { animation-delay: 45ms; }
.hub-lab:nth-child(4n + 3) { animation-delay: 90ms; }
.hub-lab:nth-child(4n + 4) { animation-delay: 135ms; }
.hub-lab-art { isolation: isolate; }
.hub-lab-art::after { content: ""; position: absolute; z-index: 0; inset: 0; background: linear-gradient(115deg, transparent 25%, rgb(255 255 255 / .18) 48%, transparent 68%); transform: translateX(-120%); transition: transform .65s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.hub-lab-art .hub-lab-image, .hub-lab-art .la { transition: transform .45s cubic-bezier(.2,.8,.2,1), filter .45s; }
.hub-lab-art .hub-lab-ico { z-index: 1; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
.hub-progress-icon { animation: hub-spark 3.6s ease-in-out infinite; }
@media (hover: hover) {
  .hub-cat:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -20px rgb(var(--c-ink) / .45); }
  .hub-cat:hover .hub-cat-ico { transform: translateY(-3px) rotate(-5deg); }
  .hub-lab:hover { transform: translateY(-5px); box-shadow: 0 22px 38px -28px rgb(var(--c-ink) / .42); }
  .hub-lab:hover .hub-lab-art::after { transform: translateX(120%); }
  .hub-lab:hover .hub-lab-image, .hub-lab:hover .hub-lab-art .la { transform: scale(1.045); }
  .hub-lab:hover .hub-lab-ico { transform: rotate(3deg) scale(1.1); box-shadow: 0 8px 18px rgb(0 0 0 / .22); }
}
.hub-lab:active .hub-lab-go { transform: translateY(1px) scale(.985); }
@keyframes hub-card-in { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@keyframes hub-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgb(34 197 94 / .12); } 50% { box-shadow: 0 0 0 8px rgb(34 197 94 / .045); } }
@keyframes hub-orbit { to { rotate: 360deg; } }
@keyframes hub-spark { 0%, 82%, 100% { transform: rotate(0) scale(1); } 87% { transform: rotate(-9deg) scale(1.08); } 92% { transform: rotate(8deg) scale(1.08); } }
html.no-motion .hub-head::after, html.no-motion .hub-live-dot, html.no-motion .hub-lab, html.no-motion .hub-progress-icon { animation: none !important; }
html.no-motion .hub-lab, html.no-motion .hub-cat, html.no-motion .hub-lab-art::after, html.no-motion .hub-lab-image, html.no-motion .hub-lab-ico { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .hub-head::after, .hub-live-dot, .hub-lab, .hub-progress-icon { animation: none !important; }
  .hub-lab, .hub-cat, .hub-lab-art::after, .hub-lab-image, .hub-lab-ico { transition: none !important; }
}
