/* Every camera view of Signet, one look (camera-ui.js): the picture, one thin outline, one thin line along the bottom edge while something is
   going on, and one short line of text under the picture. The hosted pages' capture screen (plan 22, IV11, below) draws the same parts as a
   panel: the instruction above, a ring of progress around the outline, a hint in a pill under it. Nothing else is drawn on a camera, and nothing is ever drawn into a frame that is
   measured. This is the only sheet that styles one (a test compares). The hosted pages' --foil-hi is the color a subscriber's branding makes
   readable on the camera's black; other pages use the fallback.

   Looking, ready, taking, checking, done (and "retry", which is words only). */

/* ---------- the picture ---------- */
.cam, .try-cam, .pd-view { position: relative; overflow: hidden; background: #05080f; width: 100%; }
.cam { border-radius: min(var(--radius), 18px); aspect-ratio: 3 / 4; max-height: 62vh; }
.cam.wide { aspect-ratio: 4 / 3; }
.cam video, .cam img.shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.selfie video, .cam.selfie .still { transform: scaleX(-1); }
.cam .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* A photo of a thing: the box takes the camera's own shape, as tall as the screen allows, and shows the whole frame. */
.cam.whole { --ar: .75; aspect-ratio: var(--ar); max-height: none; width: min(100%, calc(52vh * var(--ar))); min-width: 200px; margin: 0 auto; }
.cam.whole video, .cam.whole img.shot { object-fit: contain; }
.try-cam, .pd-view { aspect-ratio: 4 / 3; border-radius: var(--radius); border: 1px solid var(--line-strong); }
.try-cam:not(.live):not(.held), .pd-view:not(.live) { background: var(--bg-tint, #e4f1ef); }
.try-cam video, .try-cam .still, .pd-view video, .pd-view .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.try-cam video, .try-cam .still { transform: scaleX(-1); }
/* The capture screen inside a try-it panel's camera box (tryit.js): the 4:3 box gives way to it, so the whole face shows, not the top of it. */
.try-cam:has(> .cui-view) { aspect-ratio: auto; overflow: visible; border: 0; background: transparent; }
.try-cam > .cui-view .cam:not(.wide):not(.whole) { flex: none; min-height: 0; aspect-ratio: 3 / 4; max-height: 60vh; }
.try-cam .try-cam-idle { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: .9062rem; text-align: center; padding: 20px; }

/* ---------- one thin outline ---------- */
/* The card's outline: its box is what is cropped and measured (verify-flow.js, guideRect), so the line is drawn outside it. */
.cam .guide { position: absolute; left: 50%; top: 50%; width: 88%; aspect-ratio: 1.586; transform: translate(-50%, -50%); border-radius: 14px; outline: 2px solid rgba(255,255,255,.8); outline-offset: 1px; box-shadow: 0 0 0 100vmax rgba(5,8,15,.15); pointer-events: none; transition: outline-color .2s; }
.cam .guide.passport { aspect-ratio: 1.42; }
.cam .oval { position: absolute; left: 50%; top: 46%; width: 64%; aspect-ratio: .78; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: 0 0 0 100vmax rgba(5,8,15,.15); pointer-events: none; transition: box-shadow .18s linear; }
.cam .oval::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); transition: border-color .25s; }
.cam.good .oval::after { border-color: var(--foil-hi, #7c9bff); border-width: 4px; inset: -4px; }   /* good: the accent, and a thicker line (more than a colour) */
.cui-face { position: absolute; left: 50%; top: 48%; height: 72%; aspect-ratio: .78; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(255,255,255,.8); pointer-events: none; opacity: 0; transition: opacity .3s; z-index: 1; }
.live > .cui-face, .held > .cui-face { opacity: 1; }
.cam.ready .guide { outline-color: var(--foil-hi, #7c9bff); outline-width: 4px; }
.cam.whole.ready { outline: 4px solid var(--foil-hi, #7c9bff); outline-offset: 2px; }
.cam.accepted .guide, .cam[data-state="done"] .guide { outline-color: #62d6a0; outline-width: 4px; }   /* done: a thicker line too, not only the green */
.cam[data-state="done"] .oval::after { border-color: #62d6a0; }

/* The screen-light check: everything around the face becomes the color, so that the screen lights the face with it. Measured: nothing else colored
   may be near the face while it runs. */
.cam.selfie.lit .oval { box-shadow: 0 0 0 100vmax var(--light, #fff); }
.cam.selfie.lit .oval::after { border-color: rgba(5,8,15,.5); }
.cam.selfie.lit .arrow, .cam.selfie.lit .cui-bar { display: none; }
.cam.selfie.lit .cui-ring { display: none; }

/* ---------- the line along the bottom edge ---------- */
.cui-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(5,8,15,.35); overflow: hidden; pointer-events: none; z-index: 1; }
.cui-bar[hidden] { display: none; }
.cui-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--k, 0%); background: var(--foil-hi, #7c9bff); transition: width .3s linear; }
.cui-bar.moving i { width: 30%; transition: none; animation: cui-move 1.4s ease-in-out infinite; }
@keyframes cui-move { from { left: -30%; } to { left: 100%; } }
[data-state="done"] > .cui-bar i { background: #62d6a0; }

/* ---------- the words, under the picture ---------- */
.cui-say { margin: 12px 2px 0; min-height: 46px; text-align: center; color: var(--ink); font-weight: 600; font-size: 1rem; line-height: 1.4; }
.cui-say b { display: block; font-weight: 650; font-size: 1.1875rem; line-height: 1.3; }
.cui-say span { display: block; color: var(--muted); font-weight: 500; font-size: .9375rem; min-height: 21px; }

/* ---------- what a person presses or follows ---------- */
.cam .arrow { position: absolute; top: 46%; width: 54px; height: 54px; margin-top: -27px; color: var(--foil-hi, #7c9bff); opacity: 0; }
.cam .arrow.left { left: 6px; } .cam .arrow.right { right: 6px; transform: scaleX(-1); }
.cam .arrow.show { opacity: 1; animation: nudge 1s ease-in-out infinite; }
.cam .arrow.right.show { animation-name: nudge-r; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-7px); } }
@keyframes nudge-r { 0%, 100% { transform: scaleX(-1) translateX(0); } 50% { transform: scaleX(-1) translateX(-7px); } }
.cam .badge { position: absolute; left: 12px; top: 12px; font: 600 .6875rem/1 var(--sans, sans-serif); color: #fff; background: rgba(5,8,15,.6); padding: 7px 9px; border-radius: 999px; }
.cam .lamp { position: absolute; right: 10px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; background: rgba(5,8,15,.6); cursor: pointer; }
.cam .lamp[aria-pressed="true"] { background: var(--foil-hi, #7c9bff); color: #05080f; box-shadow: 0 0 0 3px #ffffff; }   /* on: a ring around it as well */
.cam .lamp[hidden] { display: none; }
/* Done: the seal, pressed once. */
.cam .stamp { position: absolute; left: 50%; top: 50%; width: 108px; height: 108px; margin: -54px 0 0 -54px; color: var(--foil-hi, #7c9bff); z-index: 2; pointer-events: none; }
.cam .stamp.on-oval { top: 46%; }
.cam .stamp::before { content: ""; position: absolute; inset: 7%; border-radius: 50%; background: rgba(5,8,15,.8); }
.cam .stamp svg { position: relative; } .cam .stamp .tick { stroke: #05080f; }

/* ---------- the capture screen of the hosted pages (camera-ui.js, o.screen; plan 22, IV11) ----------
   A dark panel the camera fills: one instruction above the picture, large; the picture with its oval or card outline and the ring of progress
   around it; one hint under it in a pill, only when something must change. Its own few colours are the dark ground of the site's ink tiles
   (theme.css, .on-dark); the accent is the hosted pages' --foil-hi, which a subscriber's branding makes readable on a camera. */
.cui-view { --cui-ground: #10201f; --cui-on: #f5f6f3; --cui-soft: #c9d3d0; --cui-line: #3a504d; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px 16px; border-radius: 24px; background: var(--cui-ground); color: var(--cui-on); }
.cui-view .cam { border-radius: 20px; background: #05080f; }
.cui-view .cam:not(.wide):not(.whole) { flex: 1 1 auto; aspect-ratio: auto; min-height: min(62vh, 520px); max-height: none; }
.cui-view .cam.whole { width: 100%; max-width: calc(52vh * var(--ar)); }
.cui-ask { margin: 0; min-height: 2.2em; display: grid; place-items: center; text-align: center; font: 700 1.875rem/1.08 var(--serif, sans-serif); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; color: var(--cui-on); }
.cui-hint { position: relative; z-index: 2; align-self: center; margin: -34px 0 0; max-width: 92%; display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 999px; background: var(--cui-on); color: var(--cui-ground); font-weight: 650; font-size: 1rem; line-height: 1.25; text-align: left; animation: cui-appear .2s ease both; }
.cui-hint::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cui-ground); }
.cui-hint[hidden] { display: none; }
/* What a screen reader hears: the same words, once, kept off the screen. */
.cui-say.cui-quiet { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; min-height: 0; }
/* The ring: progress around the oval or the card, not a line along the bottom. pathLength is 100, so the dash is the share. */
.cui-ring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; fill: none; stroke-linecap: round; }
.cui-track { stroke: rgba(245,246,243,.28); stroke-width: 6px; }
.cui-fill { stroke: var(--foil-hi, #7c9bff); stroke-width: 6px; transition: stroke-dasharray .3s linear; }
.cui-ring.idle .cui-fill { stroke-dasharray: 0 100; }
.cui-ring.moving .cui-fill { stroke-dasharray: 22 78; animation: cui-go-round 1.6s linear infinite; }
@keyframes cui-go-round { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -100; } }
.cam[data-state="done"] .cui-fill { stroke: #62d6a0; }
/* A turn: that side of the oval lights up (wider, the accent), beside the arrow that points the way. */
.cui-side { stroke: var(--foil-hi, #7c9bff); stroke-width: 12px; opacity: 0; transition: opacity .2s; }
.cam[data-turn="left"] .cui-side.left, .cam[data-turn="right"] .cui-side.right { opacity: 1; animation: cui-side-glow 1.2s ease-in-out infinite; }
@keyframes cui-side-glow { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
/* The moment of capture: the flash below, and a tick drawn in the middle of the shape. */
.cui-tick { stroke: #ffffff; stroke-width: 7px; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.cam.cui-flash .cui-tick { animation: cui-tick 650ms ease-out both; }
@keyframes cui-tick { 0% { opacity: 1; stroke-dashoffset: 1; } 45% { opacity: 1; stroke-dashoffset: 0; } 80% { opacity: 1; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 0; } }
.cui-view .shutter { margin-top: 2px; }
/* After the face step (plan 22, IV12): under the last frame, kept still, one line per answer the page waits for. An open ring until it is back, then a
   filled disc with a tick (a shape, not only a colour); ": done" is said to screen readers. */
.cui-checks { list-style: none; margin: 0; padding: 4px 6px 0; display: grid; gap: 10px; }
.cui-checks li { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.0625rem; line-height: 1.3; color: var(--cui-soft); }
.cui-checks li.done { color: var(--cui-on); }
.cui-mark { position: relative; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--cui-line); }
.cui-checks li.done .cui-mark { border-color: var(--foil-hi, #7c9bff); background: var(--foil-hi, #7c9bff); animation: cui-check-in .3s ease-out both; }
.cui-checks li.done .cui-mark::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid var(--cui-ground); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
@keyframes cui-check-in { from { transform: scale(.6); } to { transform: none; } }
.cui-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The document step (plan 22, IV13). The card's outline: each straight edge lights as the page sees the card's edge in place there (wider, the
   accent), and when all four are, the whole outline closes in the accent. */
.cui-edge { stroke: var(--foil-hi, #7c9bff); stroke-width: 6px; opacity: 0; transition: opacity .15s; }
.cui-edge.on { opacity: 1; }
.cam.cui-closed .cui-track { stroke: var(--foil-hi, #7c9bff); stroke-width: 8px; }   /* closed: a solid, wider line all round, not only another colour */
.cam.cui-closed .cui-edge { stroke-width: 8px; }
/* Between sides: a small card turns over in the middle of the picture, front (a photo and lines) to back (a barcode). */
.cui-turn { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(5,8,15,.72); perspective: 700px; pointer-events: none; animation: cui-appear .15s ease both; }
.cui-card { position: relative; width: 46%; aspect-ratio: 1.586; transform-style: preserve-3d; animation: cui-card-turn 1.1s cubic-bezier(.45,0,.25,1) .1s both; }
.cui-card > div { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; background: #f5f6f3; box-shadow: 0 0 0 2px var(--foil-hi, #7c9bff); overflow: hidden; }
.cui-face-back { transform: rotateY(180deg); }
.cui-photo { position: absolute; left: 9%; top: 18%; width: 26%; height: 58%; border-radius: 6px; background: #b9c4c1; }
.cui-lines { position: absolute; left: 42%; right: 10%; top: 24%; height: 7%; border-radius: 4px; background: #b9c4c1; box-shadow: 0 2.2em 0 #b9c4c1, 0 4.4em 0 #d3dbd8; }
.cui-code { position: absolute; left: 10%; right: 10%; top: 30%; height: 40%; display: flex; gap: 3%; }
.cui-code b { flex: 1 1 0; background: #10201f; }
.cui-code b:nth-child(3n) { opacity: 0; }
@keyframes cui-card-turn { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
.cui-turn.still .cui-card { animation: none; }
.cui-turn.still .cui-face-front { animation: cui-fade-out .5s ease .1s both; }
.cui-turn.still .cui-face-back { transform: none; backface-visibility: visible; animation: cui-appear .5s ease .1s both; }
@keyframes cui-fade-out { to { opacity: 0; } }
/* On a turned-back photo: where the problem is. A ring around the glare, a bracket at a corner of the card that is outside the photo, each
   with a short label in a pill; the shapes say it without the colour. */
.cui-marks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cui-spot { position: absolute; color: #05080f; }
.cui-spot.area { border: 3px dashed #ffd166; border-radius: 14px; box-shadow: 0 0 0 2px rgba(5,8,15,.55); }
.cui-spot.corner { width: 34px; height: 34px; border: 0 solid #ffd166; }
.cui-spot.corner.top-left { border-width: 5px 0 0 5px; border-top-left-radius: 8px; }
.cui-spot.corner.top-right { border-width: 5px 5px 0 0; border-top-right-radius: 8px; transform: translateX(-100%); }
.cui-spot.corner.bottom-right { border-width: 0 5px 5px 0; border-bottom-right-radius: 8px; transform: translate(-100%, -100%); }
.cui-spot.corner.bottom-left { border-width: 0 0 5px 5px; border-bottom-left-radius: 8px; transform: translateY(-100%); }
.cui-spot span { position: absolute; left: 0; top: calc(100% + 6px); white-space: nowrap; padding: 5px 10px; border-radius: 999px; background: #ffd166; font: 700 .8125rem/1.2 var(--sans, sans-serif); }
.cui-spot.corner.bottom-left span, .cui-spot.corner.bottom-right span { top: auto; bottom: calc(100% + 6px); }
.cui-spot.corner.top-right span, .cui-spot.corner.bottom-right span { left: auto; right: 0; }

/* On a phone the panel takes the screen's width and height: the camera fills it. */
@media (max-width: 559px) {
  .cui-view { margin: 4px -20px 0; border-radius: 0; padding: 16px 12px 18px; }
  .cui-view:first-child { margin-top: -22px; }   /* the face step: the panel starts under the header */
  .cui-view:has(> .cam.selfie) { min-height: calc(100svh - 120px); }   /* the face fills the screen; a card or a photo keeps its shape */
  .cui-ask { font-size: 1.75rem; }
}

/* The capture flash. One sheet styles every camera. */
.cam.sg-core.sg-flash, .cam.cui-flash { animation: sg-capture-flash 180ms ease-out; }
@keyframes sg-capture-flash {
  from { box-shadow: inset 0 0 0 240px rgba(255, 255, 255, .7); }
  to { box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Less motion: nothing travels. */
@media (prefers-reduced-motion: reduce) {
  .cui-bar.moving i { animation: none !important; width: 100%; opacity: .6; }
  .cam .arrow.show { animation: none !important; }
  .cam .stamp.pressed { animation: cui-appear .35s ease both !important; }
  .cam.sg-core.sg-flash { animation: none; }
  .cam.cui-flash { animation: none; }
  .cui-hint { animation: none !important; }
  .cui-ring.moving .cui-fill { animation: none !important; stroke-dasharray: 100 0; opacity: .45; }
  .cam[data-turn] .cui-side { animation: none !important; }
  .cam.cui-flash .cui-tick { animation: cui-tick-still 650ms linear both !important; }
  .cui-fill, .cui-hint { transition: none !important; }
  .cui-checks li.done .cui-mark { animation: none !important; }
  .cui-edge { transition: none !important; }
  .cui-turn, .cui-card { animation: none !important; }
}
@keyframes cui-tick-still { 0%, 80% { opacity: 1; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 0; } }
@keyframes cui-appear { from { opacity: 0; } to { opacity: 1; } }
