/* PCE Store, scan microchip screen.
   Styles for the components in app_pce_store_scan, from the approved Scan
   microchip spec. Loaded by the PCEStore Layout when one of them is on the
   page. Bump ASSET_REV in app_pce_store/.../pceStoreLayout.isml after editing. */

/* This screen has 17px side margins (356px of content in a 390px frame). */
:root { --ps-gutter: 17px; }
html.pce-app {
  --ps-gutter: max(17px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}

/* ---------- Back row ---------- */

/* Starts 12px under the brand header: the page content padding is 20px. */
.ps-navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: -8px;
}

.ps-navbar__back {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding-right: 8px;
  border-radius: 4px;
  font-family: var(--ps-mono);
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.66px;
  color: var(--ps-blue);
  -webkit-tap-highlight-color: transparent;
}

.ps-navbar__back svg { width: 24px; height: 24px; flex: none; }
.ps-navbar__back:active { opacity: 0.5; }

.ps-navbar__title {
  margin: 0;
  font-family: var(--ps-sans);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 20px;
  color: var(--ps-ink);
}

/* ---------- Screen intro ---------- */

.ps-title { margin-top: 8px; }

.ps-title__heading {
  margin: 0;
  font-family: var(--ps-serif);
  font-weight: 400;
  font-size: 23px;
  line-height: 25px;
  letter-spacing: -0.345px;
  color: var(--ps-ink);
}

.ps-title__text {
  margin: 8px 0 0;
  font-weight: 400;
  font-size: 13.5px;
  line-height: 20px;
  color: var(--ps-text);
}

/* ---------- QR finder ---------- */

.ps-scanner-wrap { margin-top: 28px; }

/* Lengths inside the finder are in cqw, so the pack, corners and hint keep
   their proportions on any phone width. 1cqw is 3.56px at the design size. */
.ps-scanner {
  position: relative;
  aspect-ratio: 356 / 352;
  overflow: hidden;
  border-radius: 16px;
  background: radial-gradient(50% 50% at 50% 50%, #304654 0%, #0B1B2E 100%);
  color: #FFFFFF;
  container-type: inline-size;
}

.ps-scanner__video {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 240ms ease-out;
}

.ps-scanner--live .ps-scanner__video { opacity: 1; }

/* The card supplied with a microchip, as a stand-in until the camera is live. */
.ps-pack {
  position: absolute;
  left: 18.54%;
  top: 17.47%;
  width: 52.8%;
  height: 65.06%;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 3.1cqw;
  background: #FFFFFF;
  box-shadow: 0 4.8cqw 10.7cqw rgba(11, 27, 46, 0.45);
  transform: rotate(4deg);
  transition: opacity 200ms ease-out;
}

.ps-scanner--live .ps-pack { opacity: 0; }

.ps-pack__mark {
  margin-top: 4.5cqw;
  font-family: var(--ps-sans);
  font-style: italic;
  font-weight: 700;
  font-size: 8.15cqw;
  line-height: 8.4cqw;
  color: var(--ps-blue);
}

.ps-pack__registration {
  margin-top: 0.4cqw;
  font-family: var(--ps-mono);
  font-weight: 500;
  font-size: 2.1cqw;
  line-height: 2.5cqw;
  letter-spacing: 0.16em;
  white-space: nowrap;
  color: var(--ps-text);
}

.ps-pack__qr {
  width: 33.7cqw;
  height: 33.7cqw;
  margin-top: 2.6cqw;
  color: var(--ps-ink);
}

.ps-pack__caption {
  margin-top: 1.6cqw;
  font-family: var(--ps-sans);
  font-weight: 400;
  font-size: 2.25cqw;
  line-height: 3.1cqw;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--ps-text);
}

.ps-scanner__frame {
  position: absolute;
  top: 9.09%;
  right: 9.09%;
  bottom: 9.09%;
  left: 9.09%;
}

.ps-scanner__corner {
  position: absolute;
  width: 11.8%;
  height: 11.8%;
  border: 0 solid #FFFFFF;
}

.ps-scanner__corner--tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 8px; }
.ps-scanner__corner--tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 8px; }
.ps-scanner__corner--bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 8px; }
.ps-scanner__corner--br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 8px; }

.ps-scanner__laser {
  position: absolute;
  left: 8.43%;
  right: 9.55%;
  top: 25.57%;
  height: 2px;
  background: linear-gradient(90deg, rgba(18, 108, 40, 0) 0%, #126C28 50%, rgba(18, 108, 40, 0) 100%);
  filter: drop-shadow(0 0 8px rgba(18, 108, 40, 0.7));
}

/* The laser sweeps only while the camera is really looking. */
.ps-scanner--live .ps-scanner__laser {
  animation: ps-scan-sweep 2.4s ease-in-out infinite alternate;
}

.ps-scanner--done .ps-scanner__laser { opacity: 0; }
.ps-scanner--done .ps-scanner__corner { border-color: #2FB157; }

.ps-scanner__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3.98%;
  margin: 0;
  font-family: var(--ps-mono);
  font-weight: 500;
  font-size: 10px;
  line-height: 13px;
  letter-spacing: 0.13em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: #FFFFFF;
  opacity: 0.72;
}

/* In a browser the camera waits for a tap, anywhere on the finder. */
.ps-scanner__start {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  padding: 4.2% 0 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ps-scanner__start[hidden] { display: none; }

.ps-scanner__start-label {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(11, 27, 46, 0.72);
  font-weight: 600;
  font-size: 11.5px;
  line-height: 16px;
  color: #FFFFFF;
}

/* Camera problems are explained under the finder, clear of the artwork. */
.ps-scanner__status {
  margin: 8px 0 0;
  font-weight: 400;
  font-size: 12.5px;
  line-height: 18px;
  text-align: center;
  color: var(--ps-text);
}

.ps-scanner__status:empty { display: none; }

@keyframes ps-scan-sweep {
  from { top: 12%; }
  to   { top: 88%; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-scanner--live .ps-scanner__laser { animation: none; }
}

/* ---------- Divider ---------- */

/* 36px from the finder to the line, and from the line to the next control. */
.ps-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 25px 0 25px;
  font-family: var(--ps-sans);
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
  color: #6B7C8C;
}

.ps-divider::before,
.ps-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ps-line);
}

.ps-divider:not(:has(.ps-divider__label))::after { display: none; }

/* ---------- Older browsers ----------
   Without container units the finder uses the lengths of the 356px design
   width, which is what the fitted viewport gives it on a phone anyway. */
@supports not (width: 1cqw) {
  .ps-pack { border-radius: 11.04px; box-shadow: 0 17.09px 38.09px rgba(11, 27, 46, 0.45); }
  .ps-pack__mark { margin-top: 16.02px; font-size: 29.01px; line-height: 29.9px; }
  .ps-pack__registration { margin-top: 1.42px; font-size: 7.48px; line-height: 8.9px; }
  .ps-pack__qr { width: 119.97px; height: 119.97px; margin-top: 9.26px; }
  .ps-pack__caption { margin-top: 5.7px; font-size: 8.01px; line-height: 11.04px; }
}

@supports not (aspect-ratio: 1) {
  .ps-scanner { height: 352px; }
}
