/* ============================================================
   LAB CANVAS STYLES — Niteesh Yadav Website
   Extends styles/tokens.css for the canvas-based Lab experience.
   Pixel-matched to Figma node 558:8506 & restrained card system.
   ============================================================ */

/* ---------- 1 · LAYOUT & CANVAS FIELD ---------- */
html.lab-active,
body.lab-page {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #F3F3E7 !important;
  color: var(--text-primary, #0b0b0b);
  font-family: var(--sans);
  user-select: none;
}

/* Dotted canvas background field */
.lab-canvas-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
  background-color: #F3F3E7 !important;
  background-image: radial-gradient(var(--dot, #e2e2da) 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: 0 0;
}

.lab-canvas-viewport.is-dragging {
  cursor: grabbing;
}

/* World container holding transformed nodes & lines */
.lab-canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* SVG relationship overlay layer */
.lab-svg-layer {
  position: absolute;
  top: -5000px;
  left: -5000px;
  width: 10000px;
  height: 10000px;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.lab-connection-path {
  fill: none;
  stroke: var(--border-light, #d3d3d3);
  stroke-width: 1px;
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.lab-connection-path.is-hovered,
.lab-connection-path.is-active {
  stroke: var(--text-primary, #0b0b0b);
  stroke-width: 2.5px;
}

.lab-connection-path[data-type="questions"] {
  stroke: var(--border-strong, #a5a5a5);
  stroke-linecap: round;
  stroke-dasharray: 1 3;
}

.lab-connection-path[data-source-type="note"],
.lab-connection-path[data-source-type="reference"],
.lab-connection-path[data-source-type="image"] {
  stroke: var(--border-strong, #a5a5a5);
  stroke-linecap: round;
  stroke-dasharray: 1 3;
}

.lab-connection-path[data-type="archived_into"] {
  stroke: var(--text-tertiary, #777777);
  stroke-dasharray: 2 4;
}

/* Territory Cluster Boundaries (Figma Node 593:12348) */
.lab-cluster-zone {
  position: absolute;
  border: 1px dashed var(--border-light, #d3d3d3);
  border-radius: 4px;
  pointer-events: none;
  z-index: 0;
  background: transparent;
  transition: opacity 0.3s ease;
}

.lab-cluster-label {
  position: absolute;
  top: -4px;
  left: 0;
  transform: translateY(-100%);
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-tertiary, #777777);
  background: var(--bg-surface, #ffffff);
  padding: 4px 8px;
  border-radius: 0;
  box-sizing: border-box;
  z-index: 1;
}


/* ---------- 2 · MAIN SITE TOPBAR HEADER ---------- */
.topbar {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 0;
  box-sizing: border-box;
  z-index: 1000;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.lab-left-rail {
  position: fixed;
  bottom: 24px;
  left: 24px;
  top: auto;
  width: 188px;
  padding: 4px;
  background: var(--button-bg, #0b0b0b);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 900;
  pointer-events: auto;
  box-sizing: border-box;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lab-intro-panel,
.lab-concept-panel {
  width: 100%;
}

.lab-intro-panel {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-light, #d3d3d3);
  box-sizing: border-box;
}

.lab-intro-panel-head {
  height: 26px;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-light, #d3d3d3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary, #0b0b0b);
  box-sizing: border-box;
}

.lab-rail-toggle {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-tertiary, #777777);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}

.lab-rail-toggle:hover {
  color: var(--text-primary, #0b0b0b);
}

.lab-left-rail.is-closed {
  height: auto;
}

.lab-left-rail.is-closed .lab-intro-panel-head {
  border-bottom: 0;
}

.lab-left-rail.is-closed .lab-intro-panel-body,
.lab-left-rail.is-closed .lab-concept-panel {
  display: none !important;
}

.lab-intro-panel-body {
  padding: 8px;
  box-sizing: border-box;
}

.lab-intro-panel-body p {
  margin: 0;
  font-family: var(--sans);
  font-size: 10px;
  line-height: 16px;
  font-weight: 400;
  color: var(--text-secondary, #454545);
}

.lab-concept-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lab-concept-panel-label {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 2px 8px;
  background: var(--bg-surface, #ffffff);
  color: var(--text-tertiary, #777777);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  align-self: flex-start;
  box-sizing: border-box;
}

.lab-concept-panel-list {
  width: 100%;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.lab-concept-panel-item {
  height: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary, #777777);
  background: var(--bg-surface, #ffffff);
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lab-concept-panel-item:not(:last-child) {
  border-bottom: 1px solid var(--border-light, #d3d3d3);
}

.lab-concept-panel-item.is-active {
  background: var(--bg-panel, #ececec);
  color: var(--text-tertiary, #777777);
}

.lab-concept-panel-item.is-active::after {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent, #4eff7b);
  display: block;
  flex-shrink: 0;
}

.lab-concept-panel-item:hover {
  background: var(--bg-panel, #ececec);
  color: var(--text-primary, #0b0b0b);
}

.logo {
  width: 140px;
  height: 32px;
  background: var(--button-bg, #0b0b0b);
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 8px;
  box-sizing: border-box;
  transition: opacity 0.2s ease;
  text-decoration: none;
}

.logo:hover {
  opacity: 0.9;
}

.logo img {
  width: 68px;
  height: 24px;
  object-fit: contain;
  display: block;
}
.logo-wrap { display:flex; flex-direction:column; align-items:flex-start; }
.beta-badge { background:var(--style-yellow1); font-family:var(--mono); font-size:8px; font-weight:400; line-height:1.4; text-transform:uppercase; color:var(--text-primary); padding:1px 4px; display:inline-flex; align-items:center; justify-content:center; }

.tools {
  display: flex;
  gap: 4px;
  position: relative;
}

.tools button {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  height: 32px;
  background: var(--button-bg, #0b0b0b);
  color: var(--button-text, #ffffff);
  border: 0;
  cursor: pointer;
  padding: 0 12px;
  transition: background-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tools button:hover {
  background: #252525;
}

.tools button.is-open,
.tools button.is-active,
.tools button.is-menu-active,
.tools button.is-search-active {
  background: var(--accent, #4eff7b) !important;
  color: #0b0b0b !important;
}

#menuDropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 248px;
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  box-sizing: border-box;
}

#menuDropdown.is-open,
#menuDropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

#menuDropdown .menu-dropdown-item {
  display: flex;
  align-items: center;
  height: 29px;
  padding: 7px 26px 7px 8px;
  background: var(--button-bg, #0b0b0b);
  color: var(--button-text, #ffffff);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

#menuDropdown .menu-dropdown-item:hover,
#menuDropdown .menu-dropdown-item:focus {
  background: #252525;
  color: var(--button-text, #ffffff);
  outline: none;
}

.lab-pill {
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary, #454545);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
}

.lab-pill:hover {
  background: var(--bg-panel, #ececec);
  color: var(--text-primary, #0b0b0b);
}

.lab-pill.is-active {
  background: var(--button-bg, #0b0b0b);
  color: var(--button-text, #ffffff);
}

/* Zoom controls bottom right (Figma Node 620:17496) */
.lab-zoom-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 158px;
  height: 25px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--button-bg, #0b0b0b);
  border: 0;
  box-sizing: border-box;
  z-index: 1000;
  color: var(--text-inverse, #ffffff);
}

.lab-zoom-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lab-zoom-btn {
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-inverse, #ffffff);
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s ease;
}

.lab-zoom-btn:hover {
  opacity: 0.7;
  background: transparent;
}

.lab-zoom-level {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-inverse, #ffffff);
  text-align: center;
}

.lab-zoom-reset-btn {
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-inverse, #ffffff);
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: opacity 0.15s ease;
}

.lab-zoom-reset-btn:hover {
  opacity: 0.7;
  background: transparent;
}


/* ---------- 3 · FIGMA CARD COMPONENT SYSTEM ---------- */
.lab-node {
  position: absolute;
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 10;
  user-select: text;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.lab-node:hover {
  z-index: 20;
}

.lab-node.is-focused {
  z-index: 30;
}

.lab-node.is-filtered-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lab-node.is-dragging {
  z-index: 50 !important;
  cursor: grabbing !important;
}

.lab-node.is-dragging * {
  cursor: grabbing !important;
}

.lab-node.is-dragging .lab-node-body-card,
.lab-node.is-dragging .lab-node-header-bar,
.lab-node.is-dragging .lab-node-footer-bar {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.lab-node-top-notch,
.lab-node-bottom-notch,
.lab-side-notch,
.lab-node-header-bar {
  cursor: grab;
}

/* Top Notch Handle (Figma Rectangle 767) */
.lab-node-top-notch {
  width: 40px;
  height: 4px;
  background: var(--icon-disabled, #c2c2c2);
  border-radius: 0;
  flex-shrink: 0;
  margin-bottom: -2px;
}

/* Bottom Notch Handle (Figma Rectangle 766) */
.lab-node-bottom-notch {
  width: 40px;
  height: 4px;
  background: var(--icon-disabled, #c2c2c2);
  border-radius: 0;
  flex-shrink: 0;
  margin-top: -2px;
}

/* Sub-block 1: Header Bar (Figma Frame 1056) */
.lab-node-header-bar {
  width: 280px;
  height: 20px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid #d4d2d2;
  border-radius: 4px;
  padding: 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-tertiary, #777777);
  flex-shrink: 0;
}

.lab-node-id {
  font-size: 10px;
  color: var(--text-tertiary, #777777);
}

.lab-node-toggle {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-tertiary, #777777);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.lab-node-toggle:hover {
  color: var(--text-primary, #0b0b0b);
}

/* Sub-block 2: Body Wrapper & Side Notches (Figma Frame 1060) */
.lab-node-body-wrapper {
  position: relative;
  width: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lab-side-notch {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 40px;
  background: var(--icon-disabled, #c2c2c2);
  z-index: 1;
}

.lab-side-notch-left {
  left: -4px;
}

.lab-side-notch-right {
  right: -4px;
}

.lab-node-body-card {
  width: 280px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid #d4d2d2;
  border-radius: 4px;
  padding: 12px;
  box-sizing: border-box;
}

.lab-node-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  line-height: 22px;
  margin: 0 0 4px 0;
  color: var(--text-primary, #0b0b0b);
}

.lab-node-summary {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary, #454545);
  margin: 0;
  white-space: pre-line;
}

.lab-node-summary.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lab-node-summary a {
  color: var(--link, #0b56ff);
  text-decoration: underline;
  text-underline-offset: 3px;
  vertical-align: baseline;
}

/* Question Specifics */
.lab-node[data-type="question"] .lab-node-summary {
  display: block;
}

.lab-node[data-type="question"] .lab-node-summary.is-clamped {
  display: -webkit-box;
}

.lab-question-more-btn {
  display: block;
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary, #777777);
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lab-question-more-btn:hover {
  color: var(--text-primary, #0b0b0b);
  opacity: 0.9;
}

/* Yellow Ground for Reference Cards */
.lab-node[data-type="reference"] .lab-node-body-card {
  background: var(--style-yellow2, #fef98d);
  border-color: #e2d966;
}

/* Reference-only node styling (no header/footer/notches) */
.lab-node.lab-node-reference-only {
  width: 280px;
  gap: 0;
}

.lab-node.lab-node-reference-only .lab-node-body-card {
  background: var(--style-yellow2, #fef98d);
  border-color: #e2d966;
  border-radius: 4px;
}


.lab-reference-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lab-reference-links a {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-primary, #0b0b0b);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lab-node-card-interactive,
.lab-node[data-type="experiment"] .lab-node-body-card {
  cursor: pointer;
}

/* Inactive Node Styling (Figma Node 593:12571) */
.lab-node[data-status="archived"] .lab-node-header-bar,
.lab-node[data-status="archived"] .lab-node-body-card,
.lab-node[data-status="archived"] .lab-node-footer-bar,
.lab-node[data-status="paused"] .lab-node-header-bar,
.lab-node[data-status="paused"] .lab-node-body-card,
.lab-node[data-status="paused"] .lab-node-footer-bar {
  background: var(--bg-panel, #ececec);
  border-color: #d4d2d2;
}

/* Sub-block 3: Media Block */
.lab-node-media-block {
  width: 280px;
  height: 160px;
  background: var(--bg-panel, #d9d9d9);
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.lab-node-media-block img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg-panel, #f4f4f4);
  display: block;
}

.lab-node-media-placeholder {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-placeholder, #979797);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sub-block 4: Footer Bar */
.lab-node-footer-bar {
  width: 280px;
  height: 20px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid #d4d2d2;
  border-radius: 4px;
  padding: 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-placeholder, #979797);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.lab-footer-type-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lab-footer-meta-right {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-placeholder, #979797);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lab-dot-ellipse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline;
  flex-shrink: 0;
}

.lab-dot-prototype,
.lab-dot-demo { background-color: var(--style-green2, #2ecc71); }
.lab-dot-note { background-color: var(--style-orange2, #ff7a29); }
.lab-dot-question { background-color: var(--success, #27ae60); }
.lab-dot-experiment { background-color: var(--style-blue2, #3498db); }
.lab-node[data-status="paused"] .lab-dot-experiment { background-color: var(--style-red2, #e74c3c); }
.lab-dot-reference { background-color: var(--style-yellow2, #fef98d); }
.lab-dot-image { background-color: var(--type-image, #8b5cf6); }
.lab-node[data-status="archived"] .lab-dot-demo,
.lab-node[data-status="archived"] .lab-dot-prototype,
.lab-dot-archived { background-color: var(--style-red2, #e74c3c); }

/* Stacked Image Presentation on Card (Figma Node 565:15362) */
.lab-node-media-block.is-stack {
  position: relative;
  background: transparent;
  border: none;
  overflow: visible;
  padding: 0;
  width: 247px;
  height: 248px;
}

/* Image-Only Node Card (No header or footer section) */
.lab-node.lab-node-image-only {
  width: auto;
  gap: 0;
}

.lab-node.lab-node-image-only .lab-node-media-block {
  width: 280px;
  height: 180px;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-light, #d3d3d3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lab-node.lab-node-image-only .lab-node-media-block.is-stack {
  border: none;
  box-shadow: none;
  width: 247px;
  height: 248px;
  border-radius: 0;
}

.lab-node.lab-node-image-only:hover .lab-node-media-block {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.lab-node.lab-node-image-only:hover .lab-node-media-block.is-stack {
  transform: none;
  box-shadow: none;
}

.lab-node-stack-wrapper {
  position: relative;
  width: 247px;
  height: 248px;
}

.lab-node-stack-layer {
  position: absolute;
  width: 234px;
  height: 234px;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--border-light, #d3d3d3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  background: var(--bg-surface, #ffffff);
  transition: transform 0.2s ease, box-shadow 0.2s ease, left 0.2s ease, top 0.2s ease;
}

.lab-node-stack-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Layer offsets matching Figma Node 565:15362 (Layer 1 top-left 0,0; Layer 2 top-left 13px,14px) */
.lab-node-stack-layer:nth-child(1) {
  z-index: 1;
  top: 0;
  left: 0;
}

.lab-node-stack-layer:nth-child(2) {
  z-index: 2;
  top: 14px;
  left: 13px;
  opacity: 1;
}

.lab-node-stack-layer:nth-child(3) {
  z-index: 3;
  top: 28px;
  left: 26px;
  opacity: 1;
}

.lab-node-media-block.is-stack:hover .lab-node-stack-layer:nth-child(2) {
  top: 16px;
  left: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.lab-node-media-block.is-stack:hover .lab-node-stack-layer:nth-child(3) {
  top: 32px;
  left: 30px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.lab-sep-square {
  width: 4px;
  height: 4px;
  background: #d9d9d9;
  display: inline;
  flex-shrink: 0;
}


/* ---------- 4 · LIGHTWEIGHT QUESTION MODAL POPUP ---------- */
.lab-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lab-modal-overlay[hidden] {
  display: none !important;
}

.lab-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.lab-modal-card {
  position: relative;
  width: 100%;
  max-width: 624px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-light, #d3d3d3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  z-index: 1;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}

.lab-modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary, #777777);
}

.lab-modal-type {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lab-modal-close {
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary, #777777);
  text-transform: uppercase;
  cursor: pointer;
  padding: 2px 4px;
  letter-spacing: 0.05em;
  transition: color 0.15s ease, background 0.15s ease;
}

.lab-modal-close:hover {
  color: var(--text-primary, #0b0b0b);
  background: var(--bg-panel, #ececec);
}

.lab-modal-body {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lab-modal-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  color: var(--text-primary, #0b0b0b);
}

.lab-modal-content {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  color: var(--text-primary, #0b0b0b);
  white-space: pre-line;
}

.lab-modal-footer {
  height: 32px;
  min-height: 32px;
  padding: 0 16px;
  border-top: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel, #ececec);
}

.lab-modal-status {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-tertiary, #777777);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Expanded View Modal for Image & Image Stack Nodes (Figma Node 618:14022 Specs) */
.lab-image-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lab-image-modal-overlay[hidden] {
  display: none !important;
}

.lab-image-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.lab-image-modal-card {
  position: relative;
  width: fit-content;
  max-width: min(92vw, 1000px);
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-light, #d3d3d3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  z-index: 1;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  overflow: hidden;
  padding: 0;
  gap: 0;
}

.lab-image-modal-header {
  padding: 12px 16px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface, #ffffff);
  box-sizing: border-box;
}

.lab-image-modal-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.lab-image-modal-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  color: var(--text-primary, #0b0b0b);
}

.lab-image-modal-close {
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary, #777777);
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.lab-image-modal-close:hover {
  color: var(--text-primary, #0b0b0b);
  background: var(--bg-panel, #ececec);
}

.lab-image-modal-description {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-secondary, #454545);
  margin: 0;
  max-width: 520px;
  white-space: pre-line;
}

.lab-image-modal-stage {
  position: relative;
  width: 100%;
  max-height: min(65vh, 700px);
  background: var(--bg-page, #F3F3E7);
  border-top: 1px solid var(--border-light, #d3d3d3);
  border-bottom: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

.lab-image-modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lab-image-modal-media-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.lab-image-modal-single {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 1000px);
  max-height: min(65vh, 700px);
  object-fit: contain;
}

/* Footer / Restrained Source & Slide Indicator Metadata Row (Figma Node 618:14022) */
.lab-image-modal-footer {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface, #ffffff);
  box-sizing: border-box;
}

.lab-image-modal-meta {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary, #777777);
}

.lab-image-modal-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lab-image-modal-source {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-tertiary, #777777);
  text-decoration: underline;
  text-underline-offset: 3px;
  vertical-align: baseline;
  word-break: break-all;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.lab-image-modal-source:hover {
  color: var(--text-primary, #0b0b0b);
}

/* Slide Indicator Blocks (12px × 12px Square Size, 4px Gap matching Figma Node 564:15360) */
.lab-image-modal-indicators {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lab-slide-indicator-block {
  width: 12px;
  height: 12px;
  background: #d9d9d9;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 0;
  transition: background-color 0.15s ease;
}

.lab-slide-indicator-block:hover:not(.is-active) {
  background: #a5a5a5;
}

.lab-slide-indicator-block.is-active {
  background: var(--button-primary-bg, #0b0b0b);
}


/* ---------- 5 · SEARCH & INDEX DRAWER ---------- */
.lab-index-drawer {
  position: fixed;
  top: 68px;
  left: 24px;
  width: 320px;
  max-height: calc(100vh - 120px);
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-light, #d3d3d3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.lab-index-drawer[hidden] {
  display: none !important;
}

.lab-index-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lab-index-input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 13px;
  border: 1px solid var(--border-light, #d3d3d3);
  outline: none;
  box-sizing: border-box;
  background: var(--bg-panel, #ececec);
}

.lab-index-input:focus {
  border-color: var(--text-primary, #0b0b0b);
  background: var(--bg-surface, #ffffff);
}

.lab-index-list {
  overflow-y: auto;
  padding: 8px 0;
  margin: 0;
  list-style: none;
}

.lab-index-item {
  padding: 8px 14px;
  border-bottom: 1px solid var(--bg-panel, #ececec);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 13px;
}

.lab-index-item:hover {
  background: var(--bg-panel, #ececec);
}

.lab-index-item-title {
  font-weight: 500;
  color: var(--text-primary, #0b0b0b);
}

.lab-index-item-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-tertiary, #777777);
  text-transform: uppercase;
}


/* ---------- 7 · IN-PAGE BROWSER DEMO MODAL (Figma Node 602:15282) ---------- */
.lab-demo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lab-demo-modal-overlay[hidden] {
  display: none !important;
}

.lab-demo-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.lab-demo-modal-card {
  position: relative;
  width: 92vw;
  height: 88vh;
  max-width: 1328px;
  max-height: 900px;
  background: var(--bg-surface, #ffffff);
  border: none;
  border-radius: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lab-demo-modal-header {
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface, #ffffff);
  flex-shrink: 0;
}

.lab-demo-modal-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lab-demo-modal-title-group .lab-dot-ellipse {
  width: 12px;
  height: 12px;
}

.lab-demo-modal-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  margin: 0;
  color: var(--text-tertiary, #777777);
}

.lab-demo-modal-close {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-tertiary, #777777);
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 2px;
  transition: color 0.15s ease, background 0.15s ease;
}

.lab-demo-modal-close:hover {
  color: var(--text-primary, #0b0b0b);
  background: var(--bg-panel, #ececec);
}

.lab-demo-modal-stage {
  flex: 1;
  width: 100%;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.lab-demo-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.lab-demo-modal-footer {
  height: 32px;
  padding: 0 0 0 16px;
  border-top: 1px solid var(--border-light, #d3d3d3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel, #ececec);
  flex-shrink: 0;
}

.lab-demo-modal-meta {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.04em;
  color: var(--text-tertiary, #777777);
  text-transform: uppercase;
}

.lab-demo-modal-expand-btn {
  width: 128px;
  height: 32px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--button-bg, #0b0b0b);
  color: #ffffff;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lab-demo-modal-expand-btn:hover {
  background: #252525;
}


/* ---------- 6 · RESPONSIVE DEGRADATION ---------- */
@media (max-width: 768px) {
  .topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .lab-left-rail {
    top: auto;
    bottom: 12px;
    left: 12px;
    width: min(calc(100vw - 24px), 188px);
    padding: 4px;
    background: var(--button-bg, #0b0b0b);
    gap: 4px;
  }

  .lab-zoom-controls {
    bottom: 12px;
    right: 12px;
  }

  .lab-intro-panel-head {
    height: 26px;
    min-height: 26px;
    padding: 0 8px;
    font-size: 11px;
  }

  .lab-intro-panel-body {
    padding: 8px;
  }

  .lab-intro-panel-body p {
    font-size: 10px;
    line-height: 16px;
  }

  .lab-concept-panel-label {
    height: 18px;
    padding: 2px 8px;
    font-size: 10px;
  }

  .lab-concept-panel-item {
    height: 28px;
    min-height: 28px;
    padding: 0 16px 0 8px;
    font-size: 10px;
  }

  .lab-zoom-controls {
    bottom: 12px;
    right: 12px;
  }

  .lab-node {
    width: 260px;
  }

  .lab-node-header-bar,
  .lab-node-body-wrapper,
  .lab-node-body-card,
  .lab-node-media-block,
  .lab-node-footer-bar {
    width: 260px;
  }
}
