/* "Try it in the lab" rail (partials/lab_links.html) and the lab overlay (js/lab-overlay.js). */
.lablinks { margin: 1.5rem 0; padding: 1rem 1rem .5rem; border-radius: 1.25rem; border: 1px solid rgba(167, 139, 250, .28);
  background: linear-gradient(135deg, rgba(76, 29, 149, .28), rgba(14, 116, 144, .16)); }
.lablinks-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.lablinks-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; color: #fff; }
.lablinks-n { display: inline-block; min-width: 1.6em; padding: 0 .45em; border-radius: 99px; background: rgba(167, 139, 250, .25);
  color: #ddd6fe; font-size: .8rem; text-align: center; vertical-align: middle; }
.lablinks-all { color: #c4b5fd; font-size: .9rem; white-space: nowrap; text-decoration: none; }
.lablinks-all:hover { color: #fff; }
.lablinks-rail { list-style: none; margin: 0; padding: 0 0 .75rem; display: grid; grid-auto-flow: column; grid-auto-columns: 7.5rem;
  gap: .65rem; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(167, 139, 250, .5) transparent; }
.lablinks-rail > li { scroll-snap-align: start; }
.lablink { --h: 200; display: flex; flex-direction: column; align-items: center; gap: .5rem; height: 100%; padding: .9rem .5rem .75rem;
  border-radius: 1rem; text-align: center; text-decoration: none; color: #f8fafc;
  background: radial-gradient(130% 75% at 50% 0%, hsla(var(--h), 85%, 60%, .16), transparent 62%), #0f172a;
  border: 1px solid rgba(148, 163, 184, .22); transition: transform .15s, border-color .15s; }
.lablink:hover, .lablink:focus-visible { transform: translateY(-3px); border-color: hsla(var(--h), 90%, 70%, .9); color: #fff; }
.lablink-ico { width: 3.4rem; height: 3.4rem; }
/* The lab's icon chip, as on /code/labs (code-bench.css .lt-ico): its own colour, a dark line icon. */
.lablink-ico, .labov-ico { display: grid; place-items: center; border-radius: 28%; color: hsl(var(--h), 75%, 13%);
  background: linear-gradient(140deg, hsl(var(--h), 90%, 72%), hsl(calc(var(--h) + 16), 80%, 56%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 16px hsla(var(--h), 85%, 50%, .25); }
.lablink-ico .lab-ic, .labov-ico .lab-ic { width: 56%; height: 56%; stroke-width: 2.5; }
.lablink-name { font-size: .82rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .lablink { transition: none; } .lablink:hover { transform: none; } }
html[data-theme="light"] .lablinks { background: linear-gradient(135deg, #f5f3ff, #ecfeff); border-color: #ddd6fe; }
html[data-theme="light"] .lablinks-head h2 { color: #1e1b4b; }
html[data-theme="light"] .lablinks-all { color: #6d28d9; }
html[data-theme="light"] .lablinks-n { color: #5b21b6; background: #ede9fe; }
html[data-theme="light"] .lablink { color: #1e293b; background: linear-gradient(160deg, hsl(var(--h), 80%, 94%), #fff); border-color: hsl(var(--h), 60%, 82%); }
html[data-theme="light"] .lablink:hover { color: #0f172a; }

/* The overlay: the lab page in a frame, nearly the whole window. */
.labov { width: min(96vw, 1500px); height: 94vh; max-width: none; max-height: none; margin: auto; padding: 0; border: 1px solid rgba(167, 139, 250, .4);
  border-radius: 1.1rem; background: #0b1020; color: #e2e8f0; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.labov[open] { display: flex; flex-direction: column; }
.labov::backdrop { background: rgba(2, 6, 23, .78); backdrop-filter: blur(4px); }
.labov-bar { display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem .55rem 1rem; border-bottom: 1px solid rgba(148, 163, 184, .18);
  background: linear-gradient(90deg, rgba(76, 29, 149, .45), rgba(14, 116, 144, .25)); }
.labov-ico { width: 2rem; height: 2rem; flex: none; }
.labov-title { flex: 1; min-width: 0; margin: 0; font-size: 1.05rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.labov-new, .labov-x { display: inline-flex; align-items: center; justify-content: center; min-height: 2.4rem; border-radius: .7rem;
  border: 1px solid rgba(148, 163, 184, .3); background: rgba(15, 23, 42, .6); color: #e2e8f0; font-size: .85rem; text-decoration: none; cursor: pointer; }
.labov-new { padding: 0 .8rem; }
.labov-x { width: 2.4rem; font-size: 1.3rem; }
.labov-new:hover, .labov-x:hover { border-color: #a78bfa; color: #fff; }
.labov-frame { flex: 1; width: 100%; border: 0; background: #0b1020; }
@media (max-width: 640px) {
  .labov { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .labov-new { display: none; }
}
html[data-theme="light"] .labov { background: #f8fafc; color: #0f172a; }
html[data-theme="light"] .labov-bar { background: linear-gradient(90deg, #ede9fe, #cffafe); }
html[data-theme="light"] .labov-title { color: #1e1b4b; }
html[data-theme="light"] .labov-new, html[data-theme="light"] .labov-x { background: #fff; color: #334155; border-color: #cbd5e1; }
html[data-theme="light"] .labov-frame { background: #f8fafc; }
/* Desktop: every tile visible (wrapping grid); phones keep the swipeable rail. */
@media (min-width: 900px) { .lablinks-rail { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); overflow: visible; } }
@media (max-width: 600px) { .lablinks-rail { grid-auto-columns: 6.6rem; } .lablink-ico { width: 3rem; height: 3rem; } }
/* In the narrow column beside a video the rail stays a rail at every width. */
.video-aside .lablinks { margin: 0 0 1rem; padding: .8rem .8rem .3rem; }
.video-aside .lablinks-head h2 { font-size: 1rem; }
.video-aside .lablinks-rail { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 6.6rem; overflow-x: auto; }
