@font-face { font-family: "Poppins"; src: url(../fonts/Poppins-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/Poppins-SemiBold.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url(../fonts/SourceSans3-Variable.woff2) format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  --ink: #212529;
  --muted: #8a867f;
  --line: #e4e1da;
  --bg: #f5f4f1;
  --accent: #f0a100;
  --head: "Poppins", system-ui, sans-serif;
  --body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* the page is exactly one screen: no scroll, no bounce, no pull-to-refresh */
html, body {
  height: 100%; margin: 0; overflow: hidden;
  overscroll-behavior: none;
}
html { -webkit-text-size-adjust: 100%; }
body {
  position: fixed; inset: 0;
  height: 100vh; height: 100svh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: var(--sa-t) var(--sa-r) 0 var(--sa-l);
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
h1, p { margin: 0; }
button { font: inherit; color: inherit; touch-action: manipulation; }
img { display: block; -webkit-user-drag: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.top { flex: none; display: flex; align-items: center; height: 52px; padding: 0 20px; background: var(--bg); }
.brand img { height: 16px; width: auto; mix-blend-mode: multiply; }   /* the PNG has a white ground */

.layout { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* viewer */
.stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
model-viewer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; --poster-color: transparent; outline: none;
  touch-action: none;
}
.loader {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  transition: opacity .5s ease;
}
.loader img { width: min(70%, 520px); height: auto; aspect-ratio: 1; object-fit: contain; opacity: .35; }
.loader-bar {
  position: absolute; left: 50%; bottom: 16px; width: 64px; height: 2px; margin-left: -32px;
  background: rgba(33, 37, 41, .08); overflow: hidden;
}
.loader-bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s ease; }
.loader.done { opacity: 0; }

/* controls */
.panel {
  flex: none; display: flex; flex-direction: column; gap: 14px;
  padding: 8px 20px max(16px, var(--sa-b));
}
.line { font: 500 10px/1 var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.name { font: 500 17px/1.25 var(--head); letter-spacing: -.005em; }
.dims { font: 400 14px/1 var(--body); color: var(--muted); margin-left: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.products { display: flex; gap: 6px; }
.prod {
  width: 52px; height: 52px; padding: 3px; cursor: pointer;
  background: #fff; border: 1px solid transparent; border-radius: 12px;
  transition: border-color .2s;
}
.prod img { width: 100%; height: 100%; object-fit: contain; }
.prod[aria-pressed="true"] { border-color: var(--ink); }
@media (hover: hover) { .prod:not([aria-pressed="true"]):hover { border-color: var(--line); } }

.decors { display: flex; align-items: center; gap: 10px; }
.decor-name { font-size: 13px; color: var(--muted); }
.swatches { display: flex; gap: 8px; }
.sw {
  position: relative; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: #ddd center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
  transition: box-shadow .2s;
}
.sw::before { content: ""; position: absolute; inset: -7px; }   /* 44 px touch target */
.sw[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 2px var(--bg), 0 0 0 3px var(--ink); }

.ar-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--ink);
  font: 500 15px/1 var(--head);
  transition: transform .15s, opacity .2s;
}
.ar-btn:active { transform: scale(.98); }
.ar-btn:disabled { opacity: .35; cursor: default; }

.qr-card { display: flex; align-items: center; gap: 14px; }
.qr { width: 72px; height: 72px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-card p { font-size: 13px; color: var(--muted); }

/* wide: desktop, and phones in landscape */
@media (min-width: 900px), (orientation: landscape) and (max-height: 540px) {
  body { padding-bottom: var(--sa-b); }
  .layout { flex-direction: row; }
  .stage { flex: 1 1 auto; }
  .panel {
    width: 300px; padding: 4px 24px 20px 8px; gap: 20px;
    justify-content: flex-end;
  }
  .pick { flex-direction: column; align-items: flex-start; gap: 18px; }
  .decors { flex-direction: row-reverse; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .top { height: 40px; }
  .panel { gap: 14px; padding-bottom: 12px; }
}
@media (min-width: 900px) and (min-height: 541px) {
  .top { height: 72px; padding: 0 40px; }
  .brand img { height: 18px; }
  .panel { width: 340px; padding: 0 40px 72px 0; gap: 28px; justify-content: center; }
  .line { margin-bottom: 8px; }
  .name { font-size: 22px; }
  .name .dims { display: block; margin: 6px 0 0; font-size: 15px; }
  .prod { width: 60px; height: 60px; }
  .qr-card { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
