/* ============================================================
   Public site shell — header, welcome band, two-column layout,
   footer — for pages the public uses without signing in
   (apply.html, events-public.html). Components (panels, fields,
   buttons, badges) come from ui-kit.css; this file only frames them.
   Same rules as the kit: flat colour, tokens only, no gradients.
   ============================================================ */

/* Bootstrap's reboot is not loaded here; fields need border-box sizing
   or their padding pushes them past the panel edge. */
body.public *, body.public *::before, body.public *::after { box-sizing: border-box; }

body.public {
  margin: 0;
  background: var(--ui-ground);
  color: var(--ui-text);
}
.pub-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* --- Header --- */
.pub-header {
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
}
.pub-header .pub-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  flex-wrap: wrap;
}
.pub-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.pub-brand img { width: 48px; height: 48px; }
.pub-brand-name { display: block; font-size: 1.0625rem; font-weight: 700; color: var(--ui-text); }
.pub-brand-sub { display: block; font-size: 0.9375rem; color: var(--ui-text-muted); }
.pub-nav { display: flex; gap: 8px; align-items: center; }

/* --- Welcome band --- */
.pub-hero {
  background: var(--ui-brand);
  color: #fff;
  border-bottom: 4px solid var(--ui-gold);
}
.pub-hero .pub-wrap { padding-top: 36px; padding-bottom: 32px; }
.pub-hero h1 { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.25; color: #fff; }
.pub-hero p { margin: 8px 0 0; max-width: 720px; font-size: 1.0625rem; line-height: 1.55; color: rgba(255, 255, 255, 0.88); }
.pub-hero-steps { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; }
.pub-hero-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--ui-radius-control);
}
.pub-hero-steps b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  color: var(--ui-brand);
  font-size: 0.875rem;
}

/* --- Main layout: content + side column --- */
.pub-main { padding-top: 24px; padding-bottom: 40px; }
.pub-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.pub-aside { position: sticky; top: 16px; }
.pub-aside .ui-panel { margin-bottom: 16px; }
@media (max-width: 992px) {
  .pub-layout { grid-template-columns: 1fr; }
  .pub-aside { position: static; }
}
.pub-checklist { margin: 0; padding: 0; list-style: none; }
.pub-checklist li { display: flex; gap: 10px; padding: 6px 0; font-size: 0.9375rem; color: var(--ui-text-soft); }
.pub-checklist i { color: var(--ui-success-solid); margin-top: 2px; }
.pub-contact { margin: 0; padding: 0; list-style: none; }
.pub-contact li { display: flex; gap: 10px; padding: 6px 0; font-size: 0.9375rem; color: var(--ui-text-soft); overflow-wrap: anywhere; }
.pub-contact i { color: var(--ui-brand-text); margin-top: 2px; }
.pub-sections { margin: 0; padding: 0; list-style: none; }
.pub-sections li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 0.9375rem; border-bottom: 1px solid var(--ui-border); }
.pub-sections li:last-child { border-bottom: 0; }
.pub-sections li span:first-child { color: var(--ui-text); font-weight: 500; }
.pub-sections li span:last-child { color: var(--ui-text-soft); white-space: nowrap; }

/* Honeypot: present for bots, invisible and unreachable for people */
.pub-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Confirmation (after submitting) --- */
.pub-done { text-align: center; padding: 16px 8px 8px; }
.pub-done-icon { font-size: 3rem; line-height: 1; color: var(--ui-success-solid); }
.pub-done h2 { margin: 12px 0 6px; font-size: 1.5rem; font-weight: 700; color: var(--ui-text); }
.pub-done > p { margin: 0 auto; max-width: 560px; color: var(--ui-text-soft); }

.pub-receipt-container {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px auto 12px;
  max-width: 680px;
}
.pub-ticket {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  min-width: 220px;
  padding: 16px 24px;
  background: var(--ui-brand-soft);
  border: 2px dashed var(--ui-brand);
  border-radius: var(--ui-radius-panel);
}
.pub-ticket-label { display: block; font-size: 0.875rem; color: var(--ui-text-soft); }
.pub-ticket-number {
  display: block;
  margin-top: 4px;
  font-family: var(--ui-font-mono);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ui-brand-text);
}
.pub-ticket-applicant {
  display: block;
  margin-top: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ui-text);
}

.pub-receipt-qr-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  text-align: left;
  max-width: 380px;
}
.pub-receipt-qr-card .pub-qr-frame {
  flex-shrink: 0;
}
.pub-receipt-qr-card .pub-qr-frame img {
  width: 104px;
  height: 104px;
}
.pub-receipt-qr-text {
  flex: 1;
  min-width: 0;
}
.pub-receipt-qr-text h4 {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ui-brand-text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pub-receipt-qr-text p {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: var(--ui-text-soft);
  line-height: 1.4;
}
.pub-receipt-qr-actions {
  display: flex;
  gap: 6px;
}

/* --- QR Code Widgets --- */
.pub-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.pub-qr-frame {
  padding: 8px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.pub-qr-frame img {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 4px;
}
.pub-qr-note {
  font-size: 0.8125rem;
  color: var(--ui-text-soft);
  margin: 0;
  line-height: 1.45;
}
.pub-qr-actions {
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.pub-done-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pub-next { margin: 24px auto 0; max-width: 560px; text-align: left; }
.pub-next h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 600; }
.pub-next ol { margin: 0; padding-left: 20px; color: var(--ui-text-soft); }
.pub-next li + li { margin-top: 4px; }

/* --- Tracking result --- */
.pub-track-result { margin-top: 14px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-panel); background: var(--ui-surface-sunken); }
.pub-track-result h3 { margin: 8px 0 4px; font-size: 1.0625rem; font-weight: 600; }
.pub-track-result p { margin: 0; font-size: 0.9375rem; color: var(--ui-text-soft); }
.pub-track-result .ui-dl { margin-top: 10px; grid-template-columns: 1fr 1fr; }

/* --- Footer --- */
.pub-footer { margin-top: 24px; background: var(--usa-plum-deep); color: rgba(255, 255, 255, 0.82); }
.pub-footer .pub-wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  padding-top: 32px;
  padding-bottom: 24px;
}
@media (max-width: 768px) { .pub-footer .pub-wrap { grid-template-columns: 1fr; gap: 20px; } }
.pub-footer h2 { margin: 0 0 10px; font-size: 1rem; font-weight: 600; color: #fff; }
.pub-footer p, .pub-footer li { font-size: 0.9375rem; line-height: 1.55; }
.pub-footer ul { margin: 0; padding: 0; list-style: none; }
.pub-footer li { display: flex; gap: 10px; padding: 3px 0; overflow-wrap: anywhere; }
.pub-footer a { color: #fff; }
.pub-footer-brand { display: flex; gap: 12px; align-items: flex-start; }
.pub-footer-brand img { width: 44px; height: 44px; flex-shrink: 0; }
.pub-footer-bottom {
  padding: 14px 20px;
  text-align: center;
  font-size: 0.875rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 640px) {
  .pub-hero h1 { font-size: 1.5rem; }
  .pub-hero .pub-wrap { padding-top: 24px; padding-bottom: 22px; }
  .pub-brand-sub { display: none; }
}

/* --- Printing the confirmation: just the receipt --- */
@media print {
  .pub-header, .pub-hero, .pub-aside, .pub-footer, .ui-stepper, .pub-done-actions, .pub-receipt-qr-actions, .pub-qr-actions { display: none !important; }
  body.public { background: #fff; color: #000; }
  .pub-layout { display: block; }
  .pub-receipt-container {
    border: 2px solid #333;
    padding: 16px;
    border-radius: 8px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .pub-ticket {
    border: 2px dashed #000 !important;
    background: #f8f8f8 !important;
  }
  .pub-ticket-number {
    color: #000 !important;
  }
  .pub-receipt-qr-card {
    border: 1px solid #666 !important;
    box-shadow: none !important;
  }
}

/* Layout helpers used by the public form */
.pub-field-end { justify-content: flex-end; }
.pub-review-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.pub-review-actions .ui-spinner { width: 16px; height: 16px; border-color: rgba(255, 255, 255, 0.4); border-top-color: #fff; }

/* Bootstrap is not loaded on public pages; the few spacing utilities they use */
body.public .mt-0 { margin-top: 0 !important; }
body.public .mt-2 { margin-top: 8px !important; }
body.public .mt-3 { margin-top: 16px !important; }
body.public .mb-0 { margin-bottom: 0 !important; }
body.public [hidden] { display: none !important; }

/* Optional fields left blank are normal for an applicant: say so quietly */
body.public .ui-missing { color: var(--ui-text-faint); }

/* Phones: keep the brand and the Track button on one line, and drop the
   hero step chips (the progress bar below already shows the steps) */
@media (max-width: 640px) {
  .pub-header .pub-wrap { flex-wrap: nowrap; min-height: 64px; }
  .pub-brand img { width: 40px; height: 40px; }
  .pub-brand-name { font-size: 1rem; }
  .pub-nav-long { display: none; }
  .pub-hero-steps { display: none; }
}

/* --- Certificate verification (verify.html) --- */
.vf-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-top: 12px; }
.vf-submit { justify-content: flex-end; }
@media (max-width: 720px) { .vf-form { grid-template-columns: 1fr; } }
.vf-result { margin-top: 16px; }
.vf-card { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-panel); overflow: hidden; }
.vf-card-head { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; }
.vf-card-head > i { font-size: 2.5rem; line-height: 1; }
.vf-card-head h2 { margin: 0 0 4px; font-size: 1.375rem; font-weight: 700; }
.vf-card-head p { margin: 0; color: var(--ui-text-soft); }
.vf-card--valid .vf-card-head { background: var(--ui-success-bg); box-shadow: inset 4px 0 0 var(--ui-success-solid); }
.vf-card--valid .vf-card-head > i, .vf-card--valid .vf-card-head h2 { color: var(--ui-success); }
.vf-card--expired .vf-card-head { background: var(--ui-warning-bg); box-shadow: inset 4px 0 0 var(--ui-warning-solid); }
.vf-card--expired .vf-card-head > i, .vf-card--expired .vf-card-head h2 { color: var(--ui-warning); }
.vf-card--revoked .vf-card-head { background: var(--ui-danger-bg); box-shadow: inset 4px 0 0 var(--ui-danger-solid); }
.vf-card--revoked .vf-card-head > i, .vf-card--revoked .vf-card-head h2 { color: var(--ui-danger); }
.vf-card--unknown .vf-card-head { background: var(--ui-surface-sunken); box-shadow: inset 4px 0 0 var(--ui-border-strong); }
.vf-card--unknown .vf-card-head > i { color: var(--ui-text-muted); }
.vf-card-body { padding: 20px 22px 22px; border-top: 1px solid var(--ui-border-soft); }
.vf-holder-label { margin: 0; font-size: 0.875rem; color: var(--ui-text-muted); text-transform: none; }
.vf-holder { margin: 2px 0 16px; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 2rem; font-weight: 700; color: var(--ui-text); line-height: 1.2; }
.vf-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0 0 18px; }
.vf-facts dt { font-size: 0.875rem; font-weight: 500; color: var(--ui-text-muted); }
.vf-facts dd { margin: 2px 0 0; font-weight: 600; color: var(--ui-text); }
.vf-muted { color: var(--ui-text-muted); font-weight: 400; }
.vf-fingerprint { display: grid; gap: 4px; padding: 14px 16px; background: var(--ui-brand-tint); border: 1px dashed var(--ui-brand); border-radius: var(--ui-radius-panel); }
.vf-fingerprint-label { font-size: 0.875rem; font-weight: 600; color: var(--ui-brand-text); }
.vf-fingerprint-value { font-family: var(--ui-font-mono); font-size: 1.375rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ui-text); }
.vf-fingerprint-help { font-size: 0.875rem; color: var(--ui-text-soft); }
.vf-features { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.vf-features li { display: flex; gap: 12px; }
.vf-features i { font-size: 1.25rem; color: var(--ui-brand-text); margin-top: 2px; }
.vf-features b { display: block; font-size: 0.9375rem; color: var(--ui-text); }
.vf-features span { display: block; font-size: 0.875rem; color: var(--ui-text-soft); line-height: 1.45; }

/* --- Camera Modal & Face Guide Overlay --- */
.pub-camera-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pub-camera-modal[hidden] {
  display: none !important;
}
.pub-camera-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}
.pub-camera-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pub-camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface-sunken);
}
.pub-camera-header h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ui-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pub-camera-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ui-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.pub-camera-close:hover {
  color: var(--ui-text);
  background: rgba(0, 0, 0, 0.05);
}
.pub-camera-body {
  padding: 16px 20px;
}
.pub-camera-viewfinder {
  position: relative;
  width: 100%;
  height: 360px;
  background: #000;
  border-radius: var(--ui-radius-control);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pub-camera-viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror for front camera */
}
.pub-camera-viewfinder video.is-back-camera {
  transform: scaleX(1);
}
.pub-camera-viewfinder canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pub-camera-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pub-camera-guide-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.pub-camera-oval {
  fill: none;
  stroke: var(--usa-gold, #f8d800);
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
}
.pub-camera-eye-line {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.pub-camera-eye-label {
  fill: rgba(255, 255, 255, 0.9);
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.pub-camera-shoulder-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}
.pub-camera-guide-hint {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}
.pub-camera-guide-hint span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 9999px;
  backdrop-filter: blur(4px);
}
.pub-camera-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.pub-camera-flash.is-flashing {
  opacity: 0.9;
  transition: none;
}
.pub-camera-instructions {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ui-text-soft);
  text-align: center;
}
.pub-camera-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--ui-border);
  background: var(--ui-surface-sunken);
}
.pub-camera-live-actions,
.pub-camera-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pub-photo-picker .ui-photo-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.pub-photo-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pub-upload-label {
  cursor: pointer;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pub-hidden-file {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

