/* Atlas: Apple-inspired tokens (see open-design/design-systems/apple). */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --canvas: #f2f0eb;              /* warm off-white field */
  --dot: rgba(70, 58, 36, .085);
  --fg: #1d1d1f;
  --fg-2: #424245;
  --muted: #6e6e73;
  --meta: #86868b;
  --hairline: rgba(0, 0, 0, .09);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #0066cc;
  --link: #0066cc;

  --glass-bg: rgba(255, 255, 255, .72);
  --glass-solid: #fbfbfd;
  --glass-border: rgba(0, 0, 0, .07);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, .03), 0 8px 28px rgba(0, 0, 0, .09);
  --control-hover: rgba(0, 0, 0, .055);
  --seg-active: #ffffff;
  --seg-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04);

  --card: #ffffff;
  --card-ink: #1d1d1f;
  --card-muted: #6e6e73;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 18px rgba(0, 0, 0, .07);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, .08), 0 16px 36px rgba(0, 0, 0, .14);
  --stage: #ffffff;
  --panel-bg: rgba(255, 255, 255, .82);
  --list-bg: #ffffff;
  --chip-bg: rgba(0, 0, 0, .05);
  --backdrop-base: rgba(242, 240, 235, .62);
  --mm-bg: rgba(0, 0, 0, .04);

  --ease: cubic-bezier(.28, 0, .22, 1);
  --ease-spring: cubic-bezier(.2, .85, .25, 1);
  --radius-pill: 980px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #1c1b1a;              /* warm graphite, never pure black */
    --dot: rgba(255, 244, 226, .07);
    --fg: #f5f5f7;
    --fg-2: #d2d2d7;
    --muted: #a1a1a6;
    --meta: #8e8e93;
    --hairline: rgba(255, 246, 232, .11);
    --accent: #0a84ff;
    --accent-hover: #2997ff;
    --accent-active: #0071e3;
    --link: #2997ff;
    --glass-bg: rgba(46, 44, 41, .72);
    --glass-solid: #2b2927;
    --glass-border: rgba(255, 246, 232, .1);
    --glass-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .38);
    --control-hover: rgba(255, 246, 232, .09);
    --seg-active: rgba(255, 246, 232, .17);
    --seg-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --card: #e9e7e2;                /* soft paper card: product photos stay on a light plate */
    --card-muted: #5e5e63;          /* AA on the paper card */
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 22px rgba(0, 0, 0, .32);
    --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .5);
    --stage: #e9e7e2;
    --panel-bg: rgba(36, 34, 32, .86);
    --list-bg: rgba(255, 246, 232, .06);
    --chip-bg: rgba(255, 246, 232, .1);
    --backdrop-base: rgba(22, 21, 20, .7);
    --mm-bg: rgba(255, 246, 232, .06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #1c1b1a;              /* warm graphite, never pure black */
  --dot: rgba(255, 244, 226, .07);
  --fg: #f5f5f7;
  --fg-2: #d2d2d7;
  --muted: #a1a1a6;
  --meta: #8e8e93;
  --hairline: rgba(255, 246, 232, .11);
  --accent: #0a84ff;
  --accent-hover: #2997ff;
  --accent-active: #0071e3;
  --link: #2997ff;
  --glass-bg: rgba(46, 44, 41, .72);
  --glass-solid: #2b2927;
  --glass-border: rgba(255, 246, 232, .1);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .38);
  --control-hover: rgba(255, 246, 232, .09);
  --seg-active: rgba(255, 246, 232, .17);
  --seg-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --card: #e9e7e2;                /* soft paper card: product photos stay on a light plate */
    --card-muted: #5e5e63;          /* AA on the paper card */
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 22px rgba(0, 0, 0, .32);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .5);
  --stage: #e9e7e2;
  --panel-bg: rgba(36, 34, 32, .86);
  --list-bg: rgba(255, 246, 232, .06);
  --chip-bg: rgba(255, 246, 232, .1);
  --backdrop-base: rgba(22, 21, 20, .7);
  --mm-bg: rgba(255, 246, 232, .06);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--fg);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}
button { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: 0; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* Glass material */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border: .5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-solid); }
}

/* ---------- Canvas ---------- */
.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background-color: var(--canvas);
  background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.4px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}
.viewport:focus-visible { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); outline: none; }
.viewport.grabbing { cursor: grabbing; }

.world {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  opacity: 0;
  transition: opacity .7s var(--ease);
}
body.ready .world { opacity: 1; }
.world.moving { will-change: transform; }

.tile { position: absolute; left: 0; top: 0; contain: layout style; }
.card {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform .35s var(--ease-spring), box-shadow .35s var(--ease), opacity .45s var(--ease), filter .45s var(--ease);
}
.media {
  position: relative;
  padding: 16px;
}
.media img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;   /* lets white product backdrops melt into the card */
  opacity: 0;
  transition: opacity .5s var(--ease), transform .5s var(--ease-spring);
  -webkit-user-drag: none;
  pointer-events: none;
}
.tile.loaded .media img { opacity: 1; }
.media::before {
  /* soft loading placeholder tinted with the item's color */
  content: "";
  position: absolute; inset: 22%;
  border-radius: 50%;
  background: var(--tint, #ccc);
  opacity: .14;
  filter: blur(18px);
  transition: opacity .5s var(--ease);
}
.tile.loaded .media::before { opacity: 0; }

.cap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 16px 4px;
  color: var(--card-ink);
}
.cap-text { min-width: 0; flex: 1; }
.cap-t {
  display: block;
  font-size: 14px; font-weight: 600; line-height: 1.25;
  letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cap-s {
  display: block;
  margin-top: 2px;
  font-size: 12px; line-height: 1.3; color: var(--card-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cap-dot {
  flex: none;
  width: 12px; height: 12px; border-radius: 50%;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .18);
}
.world.far .cap { visibility: hidden; }

@media (hover: hover) {
  .world:not(.moving) .tile:hover .card { box-shadow: var(--card-shadow-hover); transform: translateY(-3px); }
  .world:not(.moving) .tile:hover .media img { transform: scale(1.04); }
}
.tile.pressed .card { transform: scale(.97); transition-duration: .18s; }
.tile.dim .card { opacity: .2; filter: saturate(.3) blur(1.5px); }
.tile.is-open { visibility: hidden; }
.tile.pulse .card { animation: pulse 1.6s var(--ease) 1; }
@keyframes pulse {
  0%   { box-shadow: var(--card-shadow), 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  40%  { box-shadow: var(--card-shadow), 0 0 0 7px color-mix(in srgb, var(--accent) 45%, transparent); }
  100% { box-shadow: var(--card-shadow), 0 0 0 14px transparent; }
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  z-index: 10;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  justify-self: start;
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
  padding: 11px 16px 11px 14px;
  border-radius: 22px;
}
.brand-mark { width: 18px; height: 18px; color: var(--fg); }
.wordmark { font-size: 17px; font-weight: 600; letter-spacing: -0.022em; }
.brand-count {
  font-size: 13px; color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.segmented {
  position: relative;
  display: flex; gap: 2px;
  height: 40px;
  padding: 3px;
  border-radius: 20px;
  max-width: min(720px, calc(100vw - 32px));
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg {
  position: relative; z-index: 1;
  flex: none;
  height: 34px;
  padding: 0 15px;
  border: 0; border-radius: 17px;
  background: transparent;
  color: var(--fg-2);
  font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: color .25s var(--ease);
}
.seg:hover { color: var(--fg); }
.seg[aria-selected="true"] { color: var(--fg); font-weight: 600; }
.seg-indicator {
  position: absolute; z-index: 0;
  top: 3px; left: 0;
  height: 34px;
  pointer-events: none;
  /* drop-shadow follows the clipped pill shape */
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .14));
}
.seg-pill {
  display: block;
  width: 100%; height: 100%;
  background: var(--seg-active);
  clip-path: inset(0 100% 0 0 round 17px);
  transition: clip-path .42s var(--ease-spring);
}

.top-actions { justify-self: end; display: flex; align-items: center; gap: 10px; min-width: 0; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 40px; width: 230px;
  padding: 0 12px;
  border-radius: 20px;
  transition: box-shadow .25s var(--ease);
}
.search:focus-within { box-shadow: var(--glass-shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.search-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font: inherit; font-size: 14px; color: var(--fg);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--meta); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.search.nomatch .search-count { color: #d70015; }
.search.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }

.icon-btn {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .2s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
/* Link back to the 3D showroom */
.back-pill {
  flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 16px 0 10px;
  border-radius: 980px;
  color: var(--fg); font-size: 14px; font-weight: 500; text-decoration: none;
  transition: transform .2s var(--ease);
}
.back-pill:active { transform: scale(.96); }
.back-pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) { .back-pill span { display: none; } .back-pill { padding: 0 11px; } }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: var(--fg); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-sun { display: none; }
.icon-btn[data-mode="dark"] .i-sun { display: block; }
.icon-btn[data-mode="dark"] .i-moon { display: none; }

/* ---------- Bottom controls ---------- */
.controls {
  position: fixed; z-index: 10;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: center;
}
.ctrl-group { display: flex; align-items: center; height: 44px; padding: 2px; border-radius: 22px; }
.ctrl-sep { width: 1px; height: 20px; background: var(--hairline); }
.ctrl-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 20px;
  background: transparent;
  cursor: pointer;
  transition: background-color .2s var(--ease), opacity .2s var(--ease), transform .15s var(--ease);
}
.ctrl-btn:hover:not(:disabled) { background: var(--control-hover); }
.ctrl-btn:active:not(:disabled) { transform: scale(.92); }
.ctrl-btn:disabled { opacity: .3; cursor: default; }
.ctrl-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--fg); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#home-btn svg { width: 17px; height: 17px; stroke-width: 1.8; }
.zoom-label {
  min-width: 54px; height: 40px;
  border: 0; background: transparent;
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.zoom-label:hover { background: var(--control-hover); }

/* ---------- Minimap ---------- */
.minimap {
  position: fixed; z-index: 10;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  padding: 7px;
  border-radius: 16px;
  cursor: crosshair;
  touch-action: none;
}
.minimap canvas { display: block; border-radius: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60;
  left: 50%;
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 72px));
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
  color: var(--fg);
  background: var(--glass-solid);
  border: .5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  opacity: 0;
  transform: translate(-50%, 10px) scale(.98);
  transition: opacity .35s var(--ease), transform .45s var(--ease-spring);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .sep { color: var(--meta); }

/* ---------- Detail (product sheet) ---------- */
.detail { position: fixed; inset: 0; z-index: 50; }
.d-backdrop {
  position: absolute; inset: 0;
  background-color: var(--backdrop-base);
  background-color: color-mix(in srgb, var(--tint, #888) 22%, var(--backdrop-base));
  -webkit-backdrop-filter: blur(36px) saturate(150%);
  backdrop-filter: blur(36px) saturate(150%);
  transition: background-color .6s var(--ease);
}
.d-stage {
  position: fixed; left: 0; top: 0;
  transform-origin: 0 0;
  background: var(--stage);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .18), 0 6px 18px rgba(0, 0, 0, .08);
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}
.d-stage.zoomed { cursor: grab; }
.d-stage.zoomed.panning { cursor: grabbing; }
.d-stage > * { transition: opacity .25s var(--ease); }
.d-stage.flying > * { opacity: 0 !important; transition: none; pointer-events: none; }
.d-img {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  object-fit: contain;
  mix-blend-mode: multiply;
  -webkit-user-drag: none;
  user-select: none;
}
.d-img.animating { transition: transform .38s var(--ease-spring), opacity .3s var(--ease); }
.d-fly {
  position: fixed; left: 0; top: 0;
  transform-origin: 0 0;
  object-fit: contain;
  mix-blend-mode: multiply;
  pointer-events: none;
  visibility: hidden;
}
.d-fly.on { visibility: visible; }

.d-btn {
  position: absolute;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  color: #1d1d1f;
  --glass-bg: rgba(255, 255, 255, .78);
  --glass-solid: #f5f5f7;
  --glass-border: rgba(0, 0, 0, .07);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, .04), 0 6px 18px rgba(0, 0, 0, .1);
  transition: transform .2s var(--ease), opacity .25s var(--ease);
}
.d-btn:active { transform: scale(.93); }
.d-btn:disabled { opacity: .3; cursor: default; }
.d-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.d-close { top: 16px; right: 16px; }
.d-prev { left: 16px; top: 50%; margin-top: -22px; }
.d-next { right: 16px; top: 50%; margin-top: -22px; }
.d-zoom {
  position: absolute; right: 16px; bottom: 16px;
  height: 32px; padding: 0 12px;
  border-radius: 16px;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: #1d1d1f;
  --glass-bg: rgba(255, 255, 255, .8);
  --glass-solid: #f5f5f7;
  cursor: pointer;
}
.d-variants {
  position: absolute; left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  max-width: calc(100% - 140px);
  padding: 6px;
  border-radius: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  --glass-bg: rgba(255, 255, 255, .8);
  --glass-solid: #f5f5f7;
  --glass-border: rgba(0, 0, 0, .06);
}
.d-variants::-webkit-scrollbar { display: none; }
.v-thumb {
  flex: none;
  width: 52px; height: 52px;
  padding: 4px;
  border: 0; border-radius: 12px;
  background: #fff;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.v-thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; display: block; pointer-events: none; }
.v-thumb:hover { transform: translateY(-1px); }
.v-thumb[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #0071e3; }

/* Info panel */
.d-panel {
  position: fixed;
  top: 24px; right: 24px; bottom: 24px;
  width: clamp(320px, 30vw, 400px);
  display: flex; flex-direction: column;
  border-radius: 24px;
  background: var(--panel-bg);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border: .5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}
.d-grab { flex: none; padding: 26px 26px 0; }
.d-handle { display: none; }
.d-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 26px 26px; overscroll-behavior: contain; }

.d-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.d-cat { font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.d-count { font-size: 12px; color: var(--meta); font-variant-numeric: tabular-nums; }
.d-title { margin: 0; font-size: 28px; font-weight: 600; line-height: 1.14; letter-spacing: -0.025em; text-wrap: balance; }
.d-code {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 12px;
  height: 30px; padding: 0 10px 0 11px;
  border: 0; border-radius: 9px;
  background: var(--chip-bg);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.d-code:hover { background: color-mix(in srgb, var(--chip-bg) 100%, var(--fg) 6%); }
.d-code svg, .swatch-btn svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.d-desc { margin: 16px 0 0; font-size: 15px; line-height: 1.5; color: var(--fg-2); letter-spacing: -0.012em; }
.d-variant-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.d-variant-note b { color: var(--fg); font-weight: 600; }

.d-section { margin-top: 24px; }
.d-h { margin: 0 0 8px 14px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.inset-list { border-radius: 14px; background: var(--list-bg); overflow: hidden; box-shadow: 0 0 0 .5px var(--hairline); }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 15px;
  position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: .5px; background: var(--hairline); }
.row-k { color: var(--fg); flex: none; max-width: 45%; }
.row-v { color: var(--muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.swatch-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: none; padding: 4px 0;
  font-size: 14px; color: var(--muted);
  cursor: pointer;
}
.swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center;
  height: 32px; padding: 0 14px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--chip-bg);
  font-size: 13px; font-weight: 500; color: var(--fg);
}
button.chip { cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease); }
button.chip:hover { background: color-mix(in srgb, var(--chip-bg) 100%, var(--fg) 6%); }
button.chip[aria-pressed="true"] { background: var(--accent); color: #fff; }

.d-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.btn {
  flex: 1 1 140px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 500;
  text-decoration: none;
  transition: background-color .2s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--chip-bg); color: var(--fg); }
.btn.secondary:hover { background: color-mix(in srgb, var(--chip-bg) 100%, var(--fg) 6%); }
.d-foot { margin: 18px 2px 0; font-size: 12px; line-height: 1.5; color: var(--meta); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.d-foot span { display: inline-flex; align-items: center; gap: 5px; }
.d-foot svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .search { width: 180px; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
  .brand { grid-column: 1; grid-row: 1; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .search { width: auto; flex: 1; max-width: 260px; }
  .segmented { grid-column: 1 / -1; grid-row: 2; justify-self: start; max-width: 100%; }
}
@media (max-width: 760px) {
  .minimap { display: none; }
  .controls { left: 50%; transform: translateX(-50%); }
  .brand { padding: 11px 14px 11px 12px; }
  .brand-count { display: none; }
  .search { max-width: none; }

  .d-stage { border-radius: 20px; }
  .d-close { top: 10px; right: 10px; }
  .d-prev { left: 10px; }
  .d-next { right: 10px; }
  .d-btn { width: 40px; height: 40px; }
  .d-prev, .d-next { margin-top: -20px; }
  .d-zoom { right: 10px; bottom: 10px; }
  .d-variants { bottom: 10px; max-width: calc(100% - 20px); }
  .v-thumb { width: 46px; height: 46px; }

  /* Bottom sheet */
  .d-panel {
    top: 7vh; left: 0; right: 0; bottom: auto;
    height: 93vh;
    width: auto;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    will-change: transform;
  }
  .d-grab { padding: 8px 20px 0; touch-action: none; cursor: grab; }
  .d-handle { display: block; width: 38px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--meta); opacity: .5; }
  .d-body { padding: 0 20px calc(28px + env(safe-area-inset-bottom)); overflow-y: hidden; }
  .d-panel.expanded .d-body { overflow-y: auto; }
  .d-title { font-size: 22px; }
}
@media (max-width: 420px) {
  .seg { padding: 0 12px; }
  .toast { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
