/* Home uses the store desk's header density while the catalog keeps its own layout. */
body:has(#site-home:not([hidden])) .site-entry-header {
  min-height: 60px;
  border-color: var(--bb-desk-rule);
}
body:has(#site-home:not([hidden])) .site-entry-header-inner {
  width: 100%;
  max-width: var(--bb-desk-max);
  min-height: 60px;
  padding-inline: var(--bb-desk-gutter);
  gap: 16px;
}
body:has(#site-home:not([hidden])) .site-entry-navigation {
  gap: 4px;
  padding-inline-start: 0;
  border-inline-start: 0;
}
body:has(#site-home:not([hidden])) .site-entry-header :is(button, nav a) {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--bb-desk-ink);
  font: 500 14px/20px system-ui, "PingFang SC", sans-serif;
  text-decoration: none;
}
body:has(#site-home:not([hidden])) .site-entry-header :is(button:hover, nav a:hover, [aria-current], button[aria-expanded=true]) {
  color: var(--bb-desk-green);
  background: var(--bb-desk-selected);
}
body:has(#site-home:not([hidden])) .site-entry-actions { gap: 6px; }
body:has(#site-home:not([hidden])) .site-entry-actions [data-site-search] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  border: 1px solid var(--bb-desk-rule);
  color: var(--bb-desk-muted);
  font-size: 13px;
}
.home-search-icon { display: none; }
body:has(#site-home:not([hidden])) .home-search-icon { display: block; flex: none; }
body:has(#site-home:not([hidden])) .site-entry-actions [data-site-cart] { border: 1px solid var(--bb-desk-rule); }
body:has(#site-home:not([hidden])) .site-entry-header :focus-visible,
#site-home :is(button, input):focus-visible { outline: 2px solid var(--bb-desk-green); outline-offset: 2px; }

#site-home {
  --paper: var(--bb-desk-wash);
  --accent: #ae492d; /* Esc is the physical cutaway's reference point. */
  --cn: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --shop-header: 61px;
  font-family: var(--cn);
  color: var(--bb-desk-ink);
  background: #fff;
  scroll-margin-top: var(--shop-header);
}
html:has(#site-home:not([hidden])) { overscroll-behavior-y: none; }
#site-home::after { content: ""; display: block; height: 145vh; height: 145svh; }
#site-home .studio {
  position: sticky;
  top: var(--shop-header);
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  height: calc(100dvh - var(--shop-header));
  max-width: var(--bb-desk-max);
  margin: auto;
  padding: clamp(12px,2.4vh,22px) var(--bb-desk-gutter) clamp(8px,2.2vh,20px);
}
#site-home-title { margin: 0 0 12px; font: 650 clamp(21px,2vw,29px)/1.3 var(--cn); }
#site-home button { font-family: inherit; cursor: pointer; }
#site-home .exhibit {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--bb-desk-rule);
  border-radius: 8px;
  background: var(--paper);
}
#figure { position: absolute; inset: 4px 6px 48px; margin: 0 auto; max-width: 1380px; }
#figure canvas, #figure img, #guides { display: block; width: 100%; height: 100%; }
/* The stored fallback's pale paper becomes transparent-looking on the same sage surface. */
#figure img { object-fit: contain; filter: brightness(1.065); mix-blend-mode: multiply; }
#guides { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
#guides path { fill: none; stroke: #757b6f; stroke-width: .85; stroke-linejoin: round; }
#guides circle { fill: #667063; stroke: var(--paper); stroke-width: .9; }
#guides .switch-label circle { fill: var(--accent); }
#guides #esc-bore { fill: none; stroke: #ad4c2d; stroke-width: 1.15; }
#guides text { font: 500 13px var(--cn); letter-spacing: .025em; fill: #42483f; }
.exhibit-control {
  position: absolute;
  inset: auto 0 2px;
  display: grid;
  grid-template-columns: minmax(0,1fr) clamp(80px,12vw,156px) minmax(0,1fr);
  align-items: center;
  gap: 14px;
  min-height: 44px;
  pointer-events: none;
}
.exhibit-instruction { justify-self: end; font: 500 13px/1.4 var(--cn); color: var(--bb-desk-muted); white-space: nowrap; }
#exhibit-end:not(:empty) { color: var(--bb-desk-green); }
#exhibit-end:not(:empty) + .exhibit-tip, .exhibit-tip .touch-tip { display: none; }
@media (pointer: coarse) {
  .exhibit-tip .wheel-tip { display: none; }
  .exhibit-tip .touch-tip { display: inline; }
}
#scrub {
  appearance: none;
  pointer-events: auto;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --played: 0%;
}
#scrub::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(to right,var(--bb-desk-green) var(--played),#b8c8ba var(--played)); border-radius: 3px; }
#scrub::-moz-range-track { height: 3px; background: #b8c8ba; }
#scrub::-moz-range-progress { height: 3px; background: var(--bb-desk-green); }
#scrub::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: var(--bb-desk-green); }
#scrub::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--bb-desk-green); }
#play, #site-home .home-shop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--bb-desk-rule);
  border-radius: 6px;
  font: 550 14px/20px var(--cn);
  white-space: nowrap;
}
#play { pointer-events: auto; justify-self: start; background: #fff; color: var(--bb-desk-ink); }
#play:is(:hover,[aria-pressed=true]) { background: var(--bb-desk-selected); border-color: #a9b9ac; }
#play:disabled { opacity: .55; cursor: default; }
#play .play-icon { width: 0; height: 0; border-left: 7px solid currentColor; border-block: 4px solid transparent; }
#play[aria-pressed=true] .play-icon { width: 7px; height: 9px; border: 0; border-inline: 2px solid currentColor; }

#site-home-categories { padding-top: clamp(12px,2vh,20px); }
#site-home .collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
#site-home .collection-heading h2 { margin: 0; font: 650 clamp(18px,1.4vw,21px)/1.35 var(--cn); }
#site-home .home-shop-link { color: white; background: var(--bb-desk-green); border-color: transparent; }
#site-home .home-shop-link:hover { background: #214b3a; }
#site-home .categories { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: clamp(6px,1vw,14px); }
#site-home .category {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--bb-desk-rule);
  border-radius: 7px;
  background: #fff;
  color: var(--bb-desk-ink);
  text-align: start;
}
#site-home .category:is(:hover,:focus-visible) { color: var(--bb-desk-green); border-color: #8fa996; background: var(--bb-desk-wash); }
#site-home .art-window {
  position: relative;
  display: block;
  overflow: hidden;
  container-type: size;
  height: clamp(65px,min(9.3vw,16svh),142px);
  background: #f2e9da url('./assets/homepage-sketch.webp') 2% 1% / 1400% auto;
  filter: grayscale(.7) contrast(1.02) brightness(1.025);
}
#site-home .art {
  display: block;
  position: absolute;
  aspect-ratio: 1;
  width: 100%;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background-image: url('./assets/homepage-sketch.webp');
  background-size: 204% 204%;
}
#site-home .art-0 { background-position: 1% 1%; }
#site-home .art-1 { background-position: 99% 1%; }
#site-home .art-2 { background-position: 1% 99%; }
#site-home .art-3 { background-position: 99% 99%; }
#site-home .art-2, #site-home .art-3 {
  width: min(100cqw,119cqh);
  left: 50%;
  transform: translate(-50%,-50%);
  mask-image: linear-gradient(to right,transparent,#000 7%,#000 93%,transparent);
}
#site-home .category-sketch { display: block; width: 100%; height: 100%; object-fit: contain; }
#site-home .art-window:has(.category-sketch) { background: #f7e9db; }
#site-home .category-name { display: flex; justify-content: space-between; align-items: center; gap: 2px; min-height: 35px; padding: 5px 10px; }
#site-home .category-name strong { font: 600 15px/1.4 var(--cn); }
#site-home .category-name > span { color: var(--bb-desk-muted); font: 500 17px/1 var(--cn); }
#guides #esc-axis, #section-view .detail-axis { fill: none; stroke: #ab694a; stroke-width: .9; stroke-dasharray: 8 3 1.3 3; }
#section-view { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
#section-view .detail-link { fill: none; stroke: #8b9085; stroke-width: .85; }
#section-view .detail-origin { fill: none; stroke: #ba5c37; stroke-width: 1; }
#section-view .cut { stroke: #424841; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
#section-view .cut .detail-axis { stroke-width: .8; }
#section-view .engrave { fill: none; stroke: #8f5739; stroke-width: .85; }
#section-view .wire-front, #section-view .wire-back { fill: none; stroke-width: 2.25; }
#section-view .wire-back { stroke: #99988b; stroke-width: 1.8; }
#section-view .wire-front { stroke: #655c47; }
#section-view .detail-names text { stroke: none; fill: #50574c; font: 500 11px var(--cn); }
#section-view .detail-names path { stroke: #8b9085; stroke-width: .7; fill: none; }
@media (max-width:1000px) {
  body:has(#site-home:not([hidden])) .site-entry-header-inner { gap: 8px; }
  body:has(#site-home:not([hidden])) .site-entry-header .brand-home { font-size: 20px; }
  body:has(#site-home:not([hidden])) .site-entry-actions [data-site-search] { gap: 0; padding: 0; justify-content: center; font-size: 0; }
  body:has(#site-home:not([hidden])) .site-entry-actions [data-site-search]::after { content: none; }
}
@media (max-width:900px) and (orientation:portrait) {
  #site-home .categories { grid-template-columns: repeat(8,minmax(0,1fr)); }
  #site-home .category { grid-column: span 2; }
  #site-home .category:nth-child(5) { grid-column: 2 / span 2; }
  #site-home .art-window { height: clamp(48px,min(14vw,11svh),98px); }
}
@media (max-width:767px) {
  #site-home .studio { padding-inline: max(12px,var(--bb-desk-gutter)); }
  body:has(#site-home:not([hidden])) .site-entry-header :is(button,nav a), #play, #site-home .home-shop-link { min-height: 44px; }
  body:has(#site-home:not([hidden])) .site-entry-header-inner { gap: 4px; padding-inline: max(12px,var(--bb-desk-gutter)); }
  body:has(#site-home:not([hidden])) .site-entry-actions { gap: 2px; }
  body:has(#site-home:not([hidden])) .site-entry-header .site-entry-actions button:where(:not([data-site-search])) { font-size: 13px; padding-inline: 5px; }
  body:has(#site-home:not([hidden])) .site-entry-header .site-entry-navigation { padding: 6px 12px 10px; }
  body:has(#site-home:not([hidden])) .site-entry-header .site-entry-navigation [aria-current] { border-bottom: 0; }
  #site-home-title { margin-bottom: 8px; }
  #figure { inset: 2px 1px 49px; }
  #guides text { font-size: 12px; letter-spacing: 0; }
  .exhibit-control { gap: 8px; }
  #play, #site-home .home-shop-link { padding-inline: 9px; font-size: 13px; }
  #site-home .collection-heading { margin-bottom: 6px; }
  #site-home .category-name { min-height: 27px; padding: 3px 6px; }
  #site-home .category-name strong { font-size: 13px; }
}
/* Eight tap targets in reading order: all products, then the seven illustrated categories. */
@media (max-width:600px) and (min-height:680px) and (orientation:portrait) {
  #site-home-categories { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  #site-home .collection-heading, #site-home .categories { display: contents; }
  #site-home .collection-heading h2 { grid-column: 1 / -1; margin-bottom: 3px; }
  #site-home .home-shop-link { justify-content: space-between; padding-inline: 13px; }
  #site-home .category, #site-home .category:nth-child(5) { grid-column: auto; display: flex; align-items: center; }
  #site-home .art-window { flex: 0 0 41%; height: clamp(46px,9svh,84px); }
  #site-home .category-name { flex: 1; padding-inline: 9px; }
}
@media (max-height:540px) and (orientation:landscape) {
  #site-home .studio { padding-block: 4px; }
  #site-home-title { margin-bottom: 4px; font-size: 18px; }
  #site-home-categories { padding-top: 4px; }
  #site-home .collection-heading { margin: 0 0 4px; }
  #site-home .collection-heading h2 { font-size: 16px; }
  #site-home .art-window { height: clamp(25px,10svh,52px); }
  #site-home .category-name { min-height: 22px; padding-block: 2px; }
  #site-home .category-name strong { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #site-home::after { height: 0; }
  #site-home .studio { position: static; }
}
