/* Shared look for the BBCred holder demo. Also mirrored (near-identically) at
   verifier/static/css/style.css so the holder and the demo shop feel like one system,
   even though they're two separate FastAPI apps with their own static mounts. */

:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c1e26;
  --muted: #6b7280;
  --border: #e2e4ea;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.page {
  max-width: 640px;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

p.lede {
  color: var(--muted);
  margin-top: 0;
}

nav.top-links {
  margin: 0.75rem 0 1.5rem;
  display: flex;
  gap: 0.75rem;
}

nav.top-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
nav.top-links a:hover { text-decoration: underline; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 0;
  padding: 0.6rem 1rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover {
  background: transparent;
  color: var(--text);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

textarea { resize: vertical; }

.field {
  margin-bottom: 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

video {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: 8px;
  background: #000;
  margin: 0.75rem auto;
}

/* QR-scan preview (qr_scan.js) -- used to carry width="240" height="180" attributes. The base
   `video` rule above overrides the width attribute but not height, so the picture was squashed
   into a fixed 180px-tall strip instead of scaling with width -- this is "can't see the live
   image on a smartphone" (2026-09-01): the box was there, just too short and warped to aim a
   phone camera with. height: auto (no forced aspect-ratio) lets it scale by its own intrinsic
   ratio instead, whatever the camera actually negotiates (qr_scan.js requests 16:9, but that's
   only a hint the browser/camera can still ignore) -- this only resizes the on-screen box; the
   decode itself reads the camera's native videoWidth/videoHeight via canvas either way, so this
   can't affect whether scanning succeeds, only how comfortably it can be aimed. */
.qr-scan-video {
  max-width: 560px;
  height: auto;
}

/* Capture guidance overlay (added 2026-09-01) -- static target only, no live face tracking.
   capture.js wraps a <video> in this on first use; see startCapture()'s ensureCaptureFrame().
   max-width bumped 320px -> 480px and centered (added 2026-09-01, owner request) so the capture
   preview reads as the page's focal point on desktop instead of a small corner element; the
   <480px media query below then lets it go full-width on a phone, where 480px would otherwise
   be wider than the screen anyway. */
.capture-frame {
  position: relative;
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0.75rem auto;
  /* Fixed regardless of what the camera actually negotiates (added 2026-09-01) -- the guide
     oval's rx/ry below are tuned for THIS ratio; without pinning it, a phone camera that
     negotiates e.g. 16:9 instead of the requested 4:3 (getUserMedia's width/height in
     capture.js are hints, not guarantees) stretches the same oval into a flat, "lying down"
     shape instead of the intended upright one. object-fit: cover below crops the video to
     match instead of squashing it. */
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
}
.capture-frame video {
  margin: 0; /* the wrapper now owns the spacing */
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.capture-frame svg.capture-guide-oval {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.capture-frame .capture-guide-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  color: #fff;
  font-size: 0.8rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.capture-frame .capture-guide-countdown {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 1.8rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: none;
}

button {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s ease;
}
button:hover { background: var(--accent-hover); }
button:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }

.pre-wrap {
  position: relative;
}
.pre-wrap pre {
  margin: 0;
}
.copy-icon-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #d1d5db;
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.copy-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.copy-icon-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }

button.icon-btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 6px;
  flex-shrink: 0;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.secondary:hover { background: #eef2ff; }

#status, .status {
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 0.5rem 0;
}

pre, #result, #tryResult, #deleteResult, #challengeOut {
  background: #0f1117;
  color: #d1d5db;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

ul.bundle-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.bundle-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--card);
}
ul.bundle-list a {
  color: var(--accent);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}
ul.bundle-list a:hover { text-decoration: underline; }

table.bundle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.bundle-table th, table.bundle-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
table.bundle-table th {
  background: #f9fafb;
  width: 140px;
}
table.bundle-table code {
  font-size: 0.82rem;
  word-break: break-all;
}

.verdict {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0.5rem 0;
}
.verdict.pass { color: var(--success); }
.verdict.fail { color: var(--danger); }

ul.ticklist {
  list-style: none;
  padding: 0;
}
ul.ticklist li {
  padding: 0.3rem 0;
  font-size: 0.92rem;
}

/* QR code <img> tags from qrcode-generator have a fixed pixel width baked into the tag
   itself -- without this, a dense QR for a long payload (session cookie, presentation JWT)
   can overflow a narrow phone screen instead of shrinking to fit. */
img {
  max-width: 100%;
  height: auto;
}

/* Mobile: this demo is routinely used on a phone (both as a public holder instance and for
   scanning QR codes), and the desktop-oriented layout above renders too small/cramped at
   phone widths without this -- requires the <meta name="viewport"> tag in each template's
   <head> to actually take effect; this alone does nothing on a page missing that tag. */
@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
  }
  .card {
    padding: 1rem;
  }
  h1 {
    font-size: 1.3rem;
  }
  /* Full-width, stacked primary actions are easier to tap accurately than side-by-side
     small buttons -- but not the small inline icon buttons (copy/delete), which should stay
     compact regardless of screen size. */
  button:not(.copy-icon-btn):not(.icon-btn-sm):not(.tab-btn) {
    width: 100%;
    margin-top: 0.4rem;
  }
  nav.top-links {
    flex-direction: column;
    gap: 0.5rem;
  }
  video, .capture-frame, .qr-scan-video {
    max-width: 100%;
  }
}
