/* NORDIKA Mockup Studio viewer. Layout: one full-bleed 3D stage, proof-sheet notes in the corners,
   a side panel for print checks. */
:root {
  --ground-a: #d6d8d1;
  --ground-b: #a9ada4;
  --bg: #bfc2ba;
  --fg: #23251f;
  --muted: #4e5149;
  --rule: rgba(35, 37, 31, .32);
  --panel: #f1f1ec;
  --warn: #9a5b00;
  --fail: #b3261e;
  --ok: #2f6b3a;
  --font-ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-data: "DM Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground-a: #4a4c47; --ground-b: #1d1e1b; --bg: #2c2d29;
    --fg: #eeefe9; --muted: #b6b8b0; --rule: rgba(238, 239, 233, .3);
    --panel: #252622; --warn: #f0b45a; --fail: #ff8a80; --ok: #8fd19e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground-a: #4a4c47; --ground-b: #1d1e1b; --bg: #2c2d29;
  --fg: #eeefe9; --muted: #b6b8b0; --rule: rgba(238, 239, 233, .3);
  --panel: #252622; --warn: #f0b45a; --fail: #ff8a80; --ok: #8fd19e;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 14px/1.45 var(--font-ui); overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline-offset: -3px; }
#stage canvas:active { cursor: grabbing; }

.hud {
  position: fixed; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding-block: max(20px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-bottom, 0px));
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.name { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.name a { color: inherit; text-decoration: none; pointer-events: auto; }
.name small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.variants { display: flex; gap: 4px; pointer-events: auto; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; vertical-align: 0; box-shadow: inset 0 0 0 1px var(--rule); }
.foot { display: flex; flex-wrap: nowrap; align-items: flex-end; justify-content: space-between; gap: 14px 32px; }
.note { flex: 1 1 240px; min-width: 0; max-width: 40ch; display: grid; gap: 2px; }
.note h2 { margin: 0; font-size: 14px; font-weight: 600; }
.note p { margin: 0; color: var(--muted); font-size: 13px; }
#note-body { white-space: pre-line; }
.note .dims { color: var(--fg); font: 400 12.5px/1.5 var(--font-data); font-variant-numeric: tabular-nums; }
.tools { display: grid; justify-items: end; gap: 8px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.bar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 18px; pointer-events: auto; }
.views, .zoom, .extras { display: flex; align-items: center; gap: 4px; }
button, .btn {
  appearance: none; border: 0; background: none; color: var(--fg); cursor: pointer; text-decoration: none;
  font: 500 14px/1 var(--font-ui); padding: 10px 8px; min-height: 36px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 2px; border-bottom: 1.5px solid transparent;
  transition: border-color .18s ease, opacity .18s ease;
}
button:hover, .btn:hover { border-bottom-color: var(--rule); }
button[aria-pressed="true"] { border-bottom-color: var(--fg); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.zoom button { width: 36px; font-size: 18px; font-weight: 400; padding: 8px 0; justify-content: center; }
.badge { font: 500 11px/1 var(--font-data); padding: 3px 5px; border-radius: 9px; background: var(--warn); color: var(--bg); }
.badge.ok { background: var(--ok); }
.badge.fail { background: var(--fail); }
.badge.change, .panel .dot.change { background: #f5a524; color: #1c1408; }

#status { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }

/* Print check panel */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); z-index: 5; pointer-events: auto;
  background: var(--panel); border-left: 1px solid var(--rule);
  display: flex; flex-direction: column;
  padding-block: max(20px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-bottom, 0px));
  padding-left: 20px; padding-right: max(20px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}
.panel header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.panel h2 { margin: 0; font-size: 15px; }
.panel .summary { margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.panel ol { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: grid; gap: 2px; align-content: start; }
.panel li button {
  width: 100%; text-align: left; display: grid; grid-template-columns: 14px 1fr; gap: 2px 10px; align-items: start;
  padding: 10px 8px; border-radius: 4px; border: 0; font-weight: 400; line-height: 1.4;
}
.panel li button:hover { background: var(--rule); }
.panel li button[aria-current="true"] { background: var(--rule); }
.panel .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--warn); }
.panel .dot.fail { background: var(--fail); }
.panel .dot.info { background: var(--muted); }
.panel .dot.ok { background: var(--ok); }
.panel .t { font-weight: 600; font-size: 13.5px; }
.panel .d { grid-column: 2; color: var(--muted); font-size: 12.5px; }
#changes-list .d { white-space: pre-line; }
.panel .passed { margin: 12px 0 0; color: var(--muted); font-size: 12.5px; }
.panel footer { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 12px; display: grid; gap: 6px; }
.panel footer p { margin: 0; color: var(--muted); font-size: 12px; }

/* Background panel */
.pop {
  position: fixed; z-index: 5; right: max(24px, env(safe-area-inset-right, 0px)); bottom: 96px; width: min(320px, calc(100vw - 32px));
  box-sizing: border-box; background: var(--panel); color: var(--fg); border: 1px solid var(--rule); border-radius: 10px;
  padding: 14px 16px 12px; display: grid; gap: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
}
.pop header { display: flex; justify-content: space-between; align-items: center; }
.pop h2 { margin: 0; font-size: 15px; }
.pop header button { padding: 6px 4px; min-height: 30px; }
.pop .sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; min-height: 32px; }
.sw {
  width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 50%; border: 0; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); transition: transform .15s ease;
}
.sw:hover { border: 0; transform: scale(1.08); }
.sw[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), 0 0 0 2px var(--panel), 0 0 0 4px var(--fg); }
.choices { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 2px; }
.choices label { position: relative; }
.choices label[data-on] { border-bottom-color: var(--fg); }
.choices input[type="color"] { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.choices input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.choices input[type="color"]::-webkit-color-swatch { border: 1px solid var(--rule); border-radius: 50%; }
.choices input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.choices label:focus-within { outline: 2px solid var(--fg); outline-offset: 1px; }

/* AR chooser on Home */
.picks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.picks button {
  width: 100%; text-align: left; display: grid; gap: 3px; padding: 10px 8px; min-height: 44px;
  border-radius: 4px; border: 0; line-height: 1.35;
}
.picks button:hover, .picks button:focus-visible { background: var(--rule); border: 0; }
.picks .t { font-weight: 600; font-size: 14px; }
.picks .d { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* HUD text follows a custom backdrop: dark text on light colours and photos, light text on dark ones. */
.hud[data-tone] { color: var(--fg); }
.hud[data-tone="light"] { --fg: #23251f; --muted: #4e5149; --rule: rgba(35, 37, 31, .32); }
.hud[data-tone="dark"] { --fg: #f3f3ee; --muted: #d4d5cf; --rule: rgba(243, 243, 238, .34); }
.hud[data-busy][data-tone="light"] { text-shadow: 0 0 10px rgba(255, 255, 255, .85), 0 0 2px rgba(255, 255, 255, .9); }
.hud[data-busy][data-tone="dark"] { text-shadow: 0 0 10px rgba(0, 0, 0, .7), 0 0 2px rgba(0, 0, 0, .8); }
#stage.transparent { background: repeating-conic-gradient(#e4e4e0 0 25%, #fafaf8 0 50%) 50% / 22px 22px; }

/* AR dialog */
.modal { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(0, 0, 0, .45); padding: 16px; }
.modal .card { background: var(--panel); color: var(--fg); border-radius: 10px; padding: 22px; max-width: 320px; display: grid; gap: 10px; justify-items: center; text-align: center; }
.modal h2 { margin: 0; font-size: 16px; }
.modal p { margin: 0; color: var(--muted); font-size: 13px; }
.modal .qr { background: #fff; padding: 10px; border-radius: 6px; }

@media (max-width: 620px) {
  .foot { flex-direction: column; align-items: stretch; }
  .tools { justify-items: stretch; }
  .hint { display: none; }
  .bar { justify-content: space-between; gap: 2px 4px; }
  .note { flex: 0 0 auto; max-width: none; }
  button, .btn { font-size: 13px; padding: 10px 6px; }
  .zoom button { width: 30px; }
  .note p { font-size: 12.5px; }
  .pop { right: 16px; left: 16px; width: auto; bottom: 150px; }
}

/* "See what changed": the client's first stop, centred at the top of the stage */
.changes-cta {
  position: fixed; top: max(14px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 4;
  pointer-events: auto; gap: 10px; padding: 11px 16px 11px 14px; min-height: 42px; border: 0; border-radius: 999px;
  background: #f5a524; color: #1c1408; font: 600 14px/1 var(--font-ui); white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28), 0 1px 0 rgba(255, 255, 255, .35) inset;
  transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.changes-cta:hover { background: #ffb53f; border-bottom-color: transparent; transform: translateX(-50%) translateY(-1px); }
.changes-cta:active { transform: translateX(-50%) translateY(0); }
.changes-cta[aria-pressed="true"] { background: #1c1408; color: #f5a524; border-bottom-color: transparent; }
.changes-cta:focus-visible { outline: 2px solid #1c1408; outline-offset: 3px; }
.changes-cta .count { font: 600 12px/1 var(--font-data); background: #1c1408; color: #f5a524; border-radius: 9px; padding: 3px 7px; }
.changes-cta[aria-pressed="true"] .count { background: #f5a524; color: #1c1408; }
.changes-cta .pulse { width: 8px; height: 8px; border-radius: 50%; background: #1c1408; box-shadow: 0 0 0 0 rgba(28, 20, 8, .5); animation: changes-pulse 2s ease-out infinite; }
.changes-cta[aria-pressed="true"] .pulse { background: #f5a524; animation: none; }
@keyframes changes-pulse { 0% { box-shadow: 0 0 0 0 rgba(28, 20, 8, .45); } 70%, 100% { box-shadow: 0 0 0 9px rgba(28, 20, 8, 0); } }
@media (prefers-reduced-motion: reduce) { .changes-cta .pulse { animation: none; } }
/* below the title and box tabs where they would collide */
@media (max-width: 1180px) { .changes-cta { top: calc(max(20px, env(safe-area-inset-top, 0px)) + 46px); } }
@media (max-width: 620px) { .changes-cta { top: calc(max(20px, env(safe-area-inset-top, 0px)) + 84px); font-size: 13px; padding: 9px 14px 9px 12px; min-height: 38px; } }

/* many boxes: Home + a picker instead of a row of tabs */
.variants.many { align-items: center; gap: 10px; }
.picker { display: inline-flex; align-items: center; gap: 8px; pointer-events: auto; position: relative; }
.picker .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.picker .swatch { margin: 0; width: 12px; height: 12px; }
.picker select {
  appearance: none; -webkit-appearance: none; font: 500 14px/1 var(--font-ui); color: var(--fg); cursor: pointer;
  background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 9px 34px 9px 14px; min-height: 36px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.picker select:hover { border-color: var(--fg); }
.picker select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.picker select option { color: #23251f; background: #f1f1ec; }
