:root {
  --lab-bg: #fafafa;
  --lab-surface: #fff;
  --lab-ink: #161616;
  --lab-muted: #616161;
  --lab-line: #dedede;
  --lab-accent: #161616;
  --lab-gutter: clamp(20px, 5vw, 72px);
  --lab-content: 1296px;
}

html.dark {
  --lab-bg: #171717;
  --lab-surface: #222222;
  --lab-ink: #f4f4f4;
  --lab-muted: #b4b4b4;
  --lab-line: #3e3e3e;
  --lab-accent: #f4f4f4;
}

html[data-lang="zh"] .lab-en,
html:not([data-lang="zh"]) .lab-zh { display: none !important; }
html[data-uv-cn-hidden] :is([data-uv-cn-entry], [data-uv-cn-account], [data-uv-cn-module]) { display: none !important; }
html[data-uv-cn-hidden] :is(.lab-hero, .lab-shortcuts) { grid-template-columns: minmax(0, 1fr); }

body { background: var(--lab-bg); }

html .site-top,
html.dark .site-top {
  height: 70px;
  min-height: 70px;
  max-height: 70px;
  padding-inline: max(var(--lab-gutter), calc((100vw - var(--lab-content)) / 2));
  background: var(--lab-bg);
  color: var(--lab-ink);
  border-bottom: 1px solid var(--lab-line);
  overflow: visible;
  backdrop-filter: none;
}

.site-top .logo { gap: 9px; }
.site-top .logo-image { height: 36px; max-width: 120px; }
.site-top .logo-text {
  color: var(--lab-ink);
  text-transform: none;
  font-weight: 720;
  font-size: 19px;
  letter-spacing: -.035em;
}
.site-top.has-logo-image .logo-text { display: inline; }
.lab-brand-wordmark { font-size: 0 !important; }
.lab-brand-wordmark::before {
  content: "";
  display: inline-block;
  width: 81px;
  aspect-ratio: 85 / 20;
  vertical-align: middle;
  background: currentColor;
  mask: url("/assets/kbdlab-wordmark.svg") center / contain no-repeat;
}
.mobile-nav-drawer.has-logo-image .mobile-nav-brand .lab-brand-wordmark { display: inline-flex; }
.site-top .nav-links {
  justify-content: center;
  gap: clamp(13px, 1.9vw, 32px);
  overflow: visible;
}
.site-top .nav-links a,
.site-top .nav-links summary {
  gap: 6px;
  color: var(--lab-muted);
  font-size: 13px;
  font-weight: 610;
  letter-spacing: .012em;
}
.site-top .nav-links a:is(:hover,.active,[aria-current="page"]),
.site-top .nav-links summary:hover { color: var(--lab-ink); }
.site-top .nav-links > a:is(.active,[aria-current="page"])::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: var(--lab-ink);
}
body[data-kbdlab-uv-shell] .site-top .nav-links > a.active:not([aria-current="page"])::after { content: none; }
.lab-nav-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--lab-accent);
}
.lab-more { position: relative; align-self: center; }
.lab-more summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.lab-more summary::-webkit-details-marker { display: none; }
.lab-more summary svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.4; fill: none; }
.lab-more-menu {
  position: absolute;
  z-index: 2;
  top: calc(100% + 13px);
  right: -18px;
  min-width: 144px;
  padding: 6px;
  border: 1px solid var(--lab-line);
  border-radius: 12px;
  background: var(--lab-surface);
  box-shadow: 0 10px 32px #1616160b;
}
.site-top .lab-more-menu a { display: flex; min-height: 37px; padding: 8px 11px; border-radius: 7px; }
.site-top .lab-more-menu a:hover { background: var(--lab-bg); }
.site-top > .row-actions :is(.btn,.btn:hover),
.site-top > .mobile-menu-button {
  color: var(--lab-ink);
  border-color: var(--lab-line);
  background: transparent;
  border-radius: 8px;
  min-height: 36px;
}
.site-top > .mobile-menu-button { padding: 0 12px; }
html .site-top .online-count { color: var(--lab-muted); background: transparent; border-color: transparent; }
html .site-top .online-count::before { background: var(--lab-muted); box-shadow: none; }
.site-top .logo-image, .mobile-nav-brand .logo-image { filter: grayscale(1); }

.lab-header-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--lab-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}
.lab-header-icon:hover {
  background: color-mix(in srgb, var(--lab-ink) 6%, var(--lab-bg));
  border-color: var(--lab-line);
}
.lab-header-icon:focus-visible,
.lab-language-control:has(select:focus-visible) {
  outline: 2px solid var(--lab-ink);
  outline-offset: 2px;
}
.lab-header-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.lab-language-control select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  color-scheme: light;
}
html.dark .lab-language-control select { color-scheme: dark; }
html:not(.dark) .lab-sun,
html.dark .lab-moon { display: none; }

@media (max-width: 820px), (pointer: coarse) and (max-width: 1180px), (pointer: coarse) and (max-height: 560px) {
  html .site-top > .row-actions { display: flex !important; }
  html .site-top .online-count { display: none; }
}


body > main > .section {
  padding-inline: max(var(--lab-gutter), calc((100vw - var(--lab-content)) / 2));
  color: var(--lab-ink);
}
body > main > .section > .section-head h2 {
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 670;
  letter-spacing: -.04em;
  text-transform: none;
}
body > main > #gallery { padding-block: 32px 70px; }
.lab-hero {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
.lab-hero-copy { display: grid; align-content: center; justify-items: start; padding-block: 34px; }
.lab-hero h1 {
  margin: 0 0 16px;
  font-size: clamp(44px, 5.15vw, 78px);
  line-height: 1.12;
  font-weight: 680;
  letter-spacing: -.065em;
}
.lab-hero-description {
  max-width: 32ch;
  font-size: clamp(14px, 1.18vw, 17px);
  line-height: 1.8;
  color: var(--lab-muted);
}
.lab-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.lab-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-height: 46px;
  padding-inline: 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease;
}
.lab-action-primary { color: var(--lab-bg); background: var(--lab-ink); }
.lab-action-primary:hover { background: color-mix(in srgb, var(--lab-ink), var(--lab-bg) 18%); }
.lab-action-secondary { color: var(--lab-ink); border-color: var(--lab-line); background: var(--lab-surface); }
.lab-action-secondary:hover { border-color: var(--lab-muted); }

.lab-hero-art {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  aspect-ratio: 1.82;
  margin: 0;
  padding: 20px 21px 15px;
  border-radius: 19px;
  overflow: hidden;
  color: #161616;
  border: 1px solid #e2e2e2;
  background: radial-gradient(ellipse at 49% 48%, #fff 14%, #f0f0f0 80%);
}
.lab-hero-stage { position: relative; min-height: 0; isolation: isolate; }
.lab-hero-art.has-3d-preview .lab-hero-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 69% 19% 5%;
  background: radial-gradient(ellipse, #0000002e, transparent 70%);
  filter: blur(10px);
}
.lab-hero-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
  filter: drop-shadow(5px 14px 12px #00000029);
}
.lab-hero-art canvas { display: none; position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.lab-hero-art canvas:active { cursor: grabbing; }
.lab-hero-art canvas:focus-visible { outline: 2px solid #505050; outline-offset: -2px; border-radius: 8px; }
.lab-hero-art.has-3d-preview canvas { display: block; }
.lab-hero-art.has-3d-preview img { visibility: hidden; }
.lab-hero-art figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #00000021;
  font-size: 11px;
  font-weight: 650;
}
.lab-art-caption-note { color: #575757; font-size: 10px; font-weight: 550; }
@media (pointer: coarse) { .lab-hero-key-hint { display: none; } }

.lab-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 23px;
}
.lab-shortcut {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  min-height: 72px;
  padding: 12px 15px;
  border: 1px solid var(--lab-line);
  border-radius: 13px;
  background: var(--lab-surface);
  text-decoration: none;
}
.lab-shortcut:hover { border-color: var(--lab-muted); }
.lab-shortcut-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--lab-ink) 8%, var(--lab-surface));
  color: var(--lab-ink);
}
.lab-shortcut-icon svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.45; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lab-shortcut-copy { display: grid; gap: 4px; min-width: 0; }
.lab-shortcut-copy strong { font-size: 13px; font-weight: 700; }
.lab-shortcut-copy small { font-size: 11px; color: var(--lab-muted); }
.lab-catalog-head {
  margin-top: 38px;
  margin-bottom: 16px;
  scroll-margin-top: 96px;
}
.lab-catalog-head h2 { margin-top: 8px; }
.lab-catalog-description { font-size: 13px; color: var(--lab-muted); }

#gallery .gallery-grid { gap: 14px; }
#gallery .product-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: var(--lab-surface);
  color: var(--lab-ink);
  box-shadow: none;
}
#gallery .product-card:hover { transform: translateY(-2px); border-color: var(--lab-muted); box-shadow: none; }
#gallery .product-preview {
  width: 100%;
  aspect-ratio: 2.08;
  background: var(--lab-bg);
  filter: none;
}
#gallery .home-static-preview-image { object-fit: cover; }
#gallery .product-card > span + span { padding: 14px 16px 16px; width: 100%; }
#gallery .card-title { font-weight: 660; text-transform: none; font-size: 16px; }
#gallery .card-meta { color: var(--lab-muted); margin-top: 5px; }
#gallery .product-description-clamp { display: none; }
html .site-footer {
  display: block;
  padding: clamp(28px, 4vw, 48px) max(var(--lab-gutter), calc((100vw - var(--lab-content)) / 2)) 22px;
  color: var(--lab-muted);
  background: var(--lab-bg);
  border-top: 1px solid var(--lab-line);
  text-align: start;
  letter-spacing: normal;
}
.lab-footer-menu {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, .72fr) auto;
  align-items: start;
  gap: clamp(22px, 5vw, 72px);
}
.lab-footer-brand > a {
  display: inline-flex;
  padding-block: 3px;
  color: var(--lab-ink);
}
.lab-footer-brand .lab-brand-wordmark::before { width: 104px; }
.lab-footer-brand p {
  max-width: 26ch;
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.6;
}
.lab-footer-menu h2 {
  margin: 0 0 14px;
  color: var(--lab-ink);
  font-size: 14px;
  font-weight: 680;
  letter-spacing: 0;
  text-transform: none;
}
.lab-footer-menu ul { padding: 0; margin: 0; list-style: none; }
.lab-social ul { display: grid; gap: 8px; }
.lab-social-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--lab-muted);
  font-size: 13px;
  text-decoration: none;
}
.lab-social svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lab-social-item small { display: block; margin-top: 2px; font-size: 10px; line-height: 1.4; }
.lab-purchase-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 2vw, 25px); }
.lab-purchase-item {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--lab-muted);
  text-align: center;
  text-decoration: none;
}
.lab-purchase-item img {
  display: block;
  width: 104px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  padding: 5px;
  margin-bottom: 4px;
  object-fit: contain;
  border: 1px solid var(--lab-line);
  border-radius: 8px;
  background: white;
}
.lab-purchase-item strong { color: var(--lab-ink); font-size: 12px; font-weight: 650; }
.lab-purchase-item small { font-size: 11px; line-height: 1.4; }
.lab-social a:hover, a.lab-purchase-item:hover strong { color: var(--lab-ink); text-decoration: underline; text-underline-offset: 3px; }
.lab-footer-menu a:focus-visible { outline: 2px solid var(--lab-ink); outline-offset: 4px; }
.lab-footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 29px;
  padding-top: 16px;
  border-top: 1px solid var(--lab-line);
}
@media (max-width: 670px) {
  .lab-footer-menu { grid-template-columns: minmax(0, 1fr) minmax(100px, .65fr); gap: 22px 14px; }
  .lab-purchase { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--lab-line); }
  .lab-purchase-list { max-width: 370px; }
}

@media (max-width: 960px) {
  .lab-hero { gap: 24px; }
  .lab-hero h1 { font-size: clamp(41px, 5.9vw, 58px); }
  #gallery .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  :root { --lab-gutter: 18px; }
  html .site-top, html.dark .site-top { height: 58px; min-height: 58px; max-height: 58px; }
  .site-top .logo-image { height: 28px; }
  .site-top .lab-brand-wordmark::before { width: 65px; }
  body > main > #gallery { padding-block: 22px 42px; }
  .lab-hero { grid-template-columns: minmax(0, 1fr); gap: 21px; }
  .lab-hero-copy { padding-block: 8px 0; }
  .lab-hero h1 { margin-bottom: 11px; font-size: clamp(40px, 11.2vw, 56px); }
  .lab-hero-description { max-width: none; line-height: 1.6; }
  .lab-wide-break { display: none; }
  .lab-hero-actions { margin-top: 17px; }
  .lab-hero-art { aspect-ratio: 1.62; padding: 12px 14px 11px; border-radius: 14px; }
  .lab-shortcuts { gap: 8px; margin-top: 12px; }
  .lab-shortcut { min-height: 64px; gap: 8px; padding: 9px; }
  .lab-shortcut-icon { width: 28px; height: 28px; }
  .lab-shortcut-icon svg { width: 15px; height: 15px; }
  .lab-shortcut-copy small { display: none; }
  .lab-catalog-head { flex-direction: row; align-items: end; margin-top: 32px; gap: 10px; }
  .lab-catalog-description { font-size: 11px; }
  #gallery .gallery-grid { gap: 9px; }
  #gallery .product-card > span + span { padding: 10px; }
  #gallery .card-title { font-size: 14px; }
  #gallery .card-meta { font-size: 11px; line-height: 1.5; }
}
@media (prefers-reduced-motion: reduce) {
  .lab-action, #gallery .product-card { transition: none; }
}

/* The static home hero can render while the catalog is loading. */
html.lab-home-boot.site-booting .boot-screen { display: none; }
html.lab-home-boot.site-booting body > main,
html.lab-home-boot.site-booting .site-top > .nav-links,
html.lab-home-boot.site-booting .site-top > .row-actions { visibility: visible; }
html.lab-home-boot.site-booting #productGrid:empty::before {
  content: "";
  min-height: 140px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--lab-line), var(--lab-bg) 60%);
}
html .mobile-nav-drawer { background: var(--lab-bg); color: var(--lab-ink); }
html .mobile-nav-links a { color: var(--lab-ink); border-color: var(--lab-line); }
html .mobile-nav-links a:is(.active,[aria-current="page"]) { color: var(--lab-accent); }
html .mobile-nav-drawer :is(.mobile-nav-head,.mobile-drawer-footer) { border-color: var(--lab-line); }
html .mobile-nav-drawer :is(.mobile-nav-close,.mobile-drawer-button) {
  color: var(--lab-ink);
  background: var(--lab-surface);
  border-color: var(--lab-line);
}
