/* "Take a picture" (camera.js, owner 2026-11-07): the popup, the live camera and its help. Scoped under .cam-pick / .cam-live. */

/* The popup: a sheet from the bottom on a phone, like the password sheet (kit.css .ul-sheet) */
.cam-pick { margin: auto auto 0; width: min(480px, 100%); max-width: 100%; max-height: 100%; box-sizing: border-box; border: 0;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--paper, #fff);
  color: var(--carbon, #0f172a); display: flex; flex-direction: column; gap: 10px; }
.cam-pick:not([open]) { display: none; }
.cam-pick::backdrop { background: rgba(15, 23, 42, 0.6); }
.cam-pick-title { font-size: 1.15rem; margin: 0; }
.cam-modes { display: grid; gap: 8px; }
.cam-mode { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left; min-height: 60px; padding: 10px 12px; border: 1px solid var(--line-2, #cbd5e1); border-radius: 12px; background: var(--paper, #fff);
  color: var(--carbon, #0f172a); font: inherit; cursor: pointer; }
.cam-mode:focus-visible { outline: 3px solid var(--ink, #4338ca); outline-offset: 2px; }
.cam-mode-icon { grid-row: 1 / 3; font-size: 1.6rem; text-align: center; line-height: 1; }
.cam-mode strong { font-size: 1.05rem; }
.cam-mode small { color: var(--muted, #475569); }
.cam-pick-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.cam-btn { min-width: 44px; min-height: 44px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line-2, #cbd5e1); background: var(--paper, #fff);
  color: var(--carbon, #0f172a); font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.cam-btn.primary { background: var(--ink, #4338ca); border-color: var(--ink, #4338ca); color: var(--on-ink, #fff); font-weight: 700; }
.cam-link { min-height: 44px; padding: 6px 4px; border: 0; background: none; color: var(--ink, #4338ca); font: inherit; text-decoration: underline; cursor: pointer; }
.cam-pick .lang-switch { border-color: var(--line-2, #94a3b8); }
.cam-pick .lang-switch .lang-btn:not(.on) { color: var(--carbon, #0f172a); }

/* The live camera: the whole screen */
.cam-live { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; box-sizing: border-box; background: #000; color: #fff; display: flex; flex-direction: column; overscroll-behavior: contain; }
.cam-live:not([open]) { display: none; }
.cam-live::backdrop { background: #000; }
.cam-live [hidden] { display: none !important; }
.cam-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
.cam-title { flex: 1; min-width: 0; margin: 0; font-size: 1.05rem; color: #fff; }
.cam-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.2rem; cursor: pointer; }
.cam-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; }
/* the whole picture shows (contain): what is inside the guide is what is saved */
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-guide { position: absolute; box-sizing: border-box; border: 3px solid #fff; border-radius: 12px; pointer-events: none; }
.cam-shade { position: absolute; background: rgba(0, 0, 0, 0.45); pointer-events: none; }
.cam-guide-long { border-radius: 8px; }
.cam-guide-doc { border-radius: 4px; }
.cam-guide-photo { border: 2px dashed rgba(255, 255, 255, 0.75); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.25s ease-out; }
.cam-flash.on { opacity: 0.8; transition: none; }
.cam-status { position: absolute; left: 16px; right: 16px; top: 40%; margin: 0; text-align: center; font-size: 1.05rem; }
.cam-status p { margin: 0; }
.cam-status .cam-allow { display: block; margin-top: 6px; color: #cbd5e1; }
.cam-status .cam-btn { margin-top: 12px; }
.cam-tip { margin: 0; padding: 8px 16px; min-height: 2.8em; text-align: center; font-size: 1rem; line-height: 1.35; background: rgba(0, 0, 0, 0.6); }
.cam-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 8px 12px; }
.cam-strip { display: flex; gap: 6px; overflow-x: auto; min-width: 0; }
.cam-thumb { position: relative; flex: none; width: 48px; height: 64px; border-radius: 6px; overflow: hidden; background: #222; }
.cam-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-thumb-label { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.65rem; text-align: center; background: rgba(0, 0, 0, 0.65); }
.cam-thumb-x { position: absolute; top: 0; right: 0; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 0 0 0 6px;
  background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.75rem; cursor: pointer; }
.cam-shoot { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; cursor: pointer; }
.cam-shoot:disabled { opacity: 0.4; cursor: default; }
.cam-shoot:not(:disabled):active { background: #cbd5e1; }
.cam-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; }
.cam-light { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); font-size: 1.2rem; cursor: pointer; }
.cam-light[aria-pressed="true"] { background: #ffd21f; }
.cam-live .cam-bar .cam-btn { background: rgba(255, 255, 255, 0.92); color: #0f172a; border-color: transparent; }
.cam-live .cam-bar .cam-btn.primary { background: #4338ca; color: #fff; }
.cam-native { align-self: center; color: #c7d2fe; padding: 4px 12px calc(10px + env(safe-area-inset-bottom)); }
.cam-ask { position: absolute; left: 12px; right: 12px; bottom: calc(110px + env(safe-area-inset-bottom)); padding: 14px; border-radius: 14px;
  background: var(--paper, #fff); color: var(--carbon, #0f172a); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.cam-ask p { flex: 1 0 100%; margin: 0; font-weight: 600; }

/* The help when the camera cannot open: on white, for reading */
.cam-help { flex: 1; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: var(--paper, #fff); color: var(--carbon, #0f172a); }
.cam-help-title { margin: 0 0 8px; font-size: 1.15rem; }
.cam-help p { margin: 0 0 10px; line-height: 1.45; }
.cam-steps { margin: 0 0 12px; padding-left: 1.4em; line-height: 1.5; }
.cam-steps li + li { margin-top: 6px; }
.cam-more { margin: 0 0 12px; }
.cam-more summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--ink, #4338ca); font-weight: 600; }
.cam-help-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.cam-help .cam-btn { border-color: var(--line-2, #94a3b8); }
.cam-gallery { color: var(--muted, #475569); font-size: 0.95rem; }

/* the camera app's file chooser: in the page (an iPhone needs it there) but never seen */
.cam-file { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* the sheet between two pictures of the phone's camera app */
.cam-strip-sheet { padding: 4px 0; }
.cam-strip-sheet .cam-thumb { width: 64px; height: 84px; }
.cam-strip-sheet .cam-thumb-label { color: #fff; }
.cam-sheet-tip { margin: 0; line-height: 1.4; }
.cam-ask-sheet { position: static; box-shadow: none; padding: 10px 0 0; }
.cam-url { flex: 1 0 100%; min-height: 44px; box-sizing: border-box; padding: 6px 10px; font: inherit; border: 1px solid var(--line-2, #94a3b8);
  border-radius: 10px; background: var(--paper-2, #f6f7fb); color: var(--carbon, #0f172a); }
@media (prefers-reduced-motion: reduce) { .cam-flash { transition: none; } }

/* The live guide (camscan.js): the outline found, green when right; one tip at a time; Auto's ring on the shutter */
.cam-outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.cam-outline polygon { fill: none; stroke: #fff; stroke-width: 4; stroke-linejoin: round; }
.cam-outline.amber polygon { stroke: #f59e0b; }
.cam-outline.green polygon { stroke: #22c55e; fill: rgba(34, 197, 94, 0.14); }
.cam-guide-dim { opacity: 0.35; }
.cam-coach { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: calc(100% - 24px); box-sizing: border-box;
  padding: 8px 14px; border-radius: 18px; background: rgba(0, 0, 0, 0.72); color: #fff; font-weight: 700; text-align: center;
  display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.cam-coach[data-colour="green"] { background: #15803d; }
.cam-coach small { font-weight: 400; color: #e2e8f0; }
.cam-shoot { position: relative; }
.cam-shoot.cam-ring::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(#22c55e calc(var(--ring, 0) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0); }
.cam-shoot.cam-pulse { animation: cam-pulse 1.2s ease-in-out infinite; }
@keyframes cam-pulse { 50% { box-shadow: inset 0 0 0 4px #000, 0 0 0 8px rgba(255, 255, 255, 0.45); } }
.cam-auto { min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff;
  font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.cam-auto::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.cam-auto[aria-pressed="true"]::before { background: #22c55e; }
/* the picture just taken: a card's waits for Keep or Retake; a page's shows small for 3 s */
.cam-review { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.88); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 16px; box-sizing: border-box; }
.cam-review .cam-prev { max-width: 100%; max-height: calc(100% - 120px); border-radius: 8px; background: #fff; }
.cam-review p { margin: 0; text-align: center; font-weight: 600; }
.cam-review-acts { display: flex; gap: 12px; }
.cam-review-acts .cam-btn { min-width: 120px; }
.cam-peek { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 8px 9px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.78); overflow: hidden; }
.cam-peek .cam-prev { width: 56px; height: auto; max-height: 76px; object-fit: contain; border-radius: 4px; background: #fff; }
.cam-peek .cam-btn { min-height: 40px; background: rgba(255, 255, 255, 0.92); color: #0f172a; border-color: transparent; }
.cam-peek-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #22c55e; transform-origin: left;
  animation: cam-peek 3s linear forwards; }
@keyframes cam-peek { to { transform: scaleX(0); } }
/* the camera app's picture looked wrong: say so, Keep first */
.cam-warn { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 10px; background: #fef3c7; color: #78350f; }
.cam-warn p { flex: 1 0 100%; margin: 0; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .cam-shoot.cam-pulse, .cam-peek-bar { animation: none; } }
