:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #181818;
  background: #f5f4f1;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { background: #f5f4f1; }
button { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
}

.viewer-panel {
  min-width: 0;
  min-height: 720px;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 32px 20px;
  background:
    radial-gradient(circle at 50% 44%, rgba(255,255,255,.96) 0, rgba(255,255,255,.74) 28%, rgba(236,234,229,.5) 62%, rgba(224,221,214,.56) 100%);
  overflow: hidden;
}

.viewer-toolbar,
.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: #74716a;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .14em;
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.03em; }
h1 { font-size: clamp(25px, 3vw, 42px); }
h2 { font-size: 19px; }

.viewer-branding {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo {
  width: 168px;
  height: auto;
  display: block;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(0,0,0,.08);
}

.viewer {
  position: absolute;
  inset: 0;
  z-index: 0;
  touch-action: none;
}

.viewer canvas { display: block; width: 100%; height: 100%; }
.viewer-toolbar, .viewer-hint, .loading { position: relative; z-index: 2; pointer-events: none; }
.viewer-toolbar button { pointer-events: auto; }
.viewer-hint { margin: auto 0 0; text-align: center; color: #77736b; font-size: 12px; }

.loading {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.08);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.controls-panel {
  position: relative;
  z-index: 3;
  background: #fff;
  border-left: 1px solid #dedbd4;
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 38px;
  overflow: auto;
}

.part-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.part-button {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #dedbd4;
  border-radius: 12px;
  background: #fff;
  color: #292825;
  cursor: pointer;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.part-button:hover { border-color: #9d9990; }
.part-button:focus-visible,
.swatch-button:focus-visible,
.ghost-button:focus-visible,
.text-button:focus-visible,
.download-button:focus-visible { outline: 3px solid rgba(24,24,24,.16); outline-offset: 2px; }
.part-button[aria-pressed="true"] { border-color: #181818; background: #f4f2ed; }
.part-button-name { display: block; font-weight: 650; }
.part-button-colour { display: flex; gap: 7px; align-items: center; margin-top: 6px; color: #77736b; font-size: 12px; }
.mini-swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.16); flex: 0 0 auto; }

.palette {
  margin-top: 17px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 14px;
}
.swatch-button {
  width: 74px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: center;
  color: #56534d;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.swatch-dot {
  width: 60px; height: 60px;
  margin: 0 0 8px;
  display: block;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.13);
  box-shadow: inset 0 0 0 4px #fff;
  transition: transform .15s ease, box-shadow .15s ease;
}
.swatch-button:hover .swatch-dot {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 4px #fff, 0 0 0 1px rgba(24,24,24,.18);
}
.swatch-button[aria-checked="true"] .swatch-dot {
  box-shadow: inset 0 0 0 4px #fff, 0 0 0 3px #181818;
  transform: scale(.95);
}
.swatch-label { font-size: 12px; line-height: 1.25; }
.selected-colour-name { font-size: 12px; color: #77736b; padding-top: 4px; }

.summary-card { margin-top: auto; padding-top: 24px; border-top: 1px solid #e5e2dc; }
.configuration { margin-top: 15px; display: grid; gap: 9px; }
.config-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #efede8;
  font-size: 13px;
}
.config-row:last-child { border-bottom: 0; }
.config-colour { color: #77736b; }

.ghost-button,
.text-button {
  border: 0;
  cursor: pointer;
}
.ghost-button {
  padding: 9px 13px;
  border: 1px solid #c9c5bd;
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(8px);
}
.text-button { padding: 4px 0; color: #6d6961; background: transparent; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .viewer-panel { min-height: 60vh; height: 620px; padding: 20px; }
  .controls-panel { border-left: 0; border-top: 1px solid #dedbd4; padding: 26px 20px 36px; }
}

@media (max-width: 520px) {
  .viewer-panel { min-height: 480px; height: 58vh; }
  .viewer-toolbar { align-items: flex-start; }
  .viewer-branding { gap: 10px; align-items: flex-start; }
  .brand-logo { width: 112px; padding: 6px 7px; border-radius: 10px; }
  .viewer-toolbar h1 { max-width: 180px; }
  .part-list { grid-template-columns: 1fr 1fr; }
  .palette { gap: 14px 12px; }
  .swatch-button { width: 68px; }
  .swatch-dot { width: 52px; height: 52px; }
}

.part-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}


.download-button {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  border: 1px solid #181818;
  border-radius: 999px;
  background: #181818;
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.download-button:hover { transform: translateY(-1px); }
.download-button:active { transform: translateY(0); opacity: .86; }
.download-note {
  margin: 9px 0 0;
  color: #77736b;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}
