/* ===========================================================================
   WelcomeHome Antigua — mobile web app.
   Same design system as arriveantiguabarbuda.com: Open Sans, #116b57 primary,
   #1a3a4a dark, gradient step headers, #f9f9f9 question cards, Back/Continue
   bar pinned to the bottom, full-screen oval face capture.

   The shell is LOCKED to the device: the document itself never scrolls or
   pans, and the only scrollable element is .step-scroll inside a step.
   ======================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* --- viewport lock ------------------------------------------------------
   overflow:hidden alone is not enough on mobile — the document still pans
   and rubber-bands. Fixing the body and killing overscroll chaining is what
   actually pins the app to the screen. */
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background: #000;
}
body {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  margin: 0; padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #333;
  background: #000;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------ app shell */
.mobile-view {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 24px rgba(0,0,0,.4);
}

.progress-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: rgba(0,0,0,.12); z-index: 60;
  opacity: 0; transition: opacity .25s;
}
.progress-bar.show { opacity: 1; }
.progress-fill { height: 100%; width: 0; background: #116b57; transition: width .35s ease; }

/* ---------------------------------------------------------------- steps */
.step {
  position: absolute; inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  overflow: hidden;            /* the step never scrolls; .step-scroll does */
}
.step.active { display: flex; }

.step-header {
  position: relative; z-index: 50; flex: 0 0 auto;
  background: linear-gradient(135deg, #1a3a4a, #116b57);
  color: #fff;
  text-align: center;
  font-size: 16px; font-weight: 600;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 2px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
}
.step-header-text { flex: 1; padding: 0 46px; }
.header-a11y-wrap { position: absolute; left: 12px; bottom: 9px; }
.header-lang-wrap { position: absolute; right: 12px; bottom: 9px; }

.step-content {
  position: relative; z-index: 10;
  flex: 1 1 auto; min-height: 0;      /* min-height:0 lets the child scroll */
  display: flex; flex-direction: column;
  background: #fff;
}

/* The single scrollable region. overscroll-behavior:contain stops a scroll
   that reaches the end from chaining out to the document. */
.step-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 16px;
}

.form-title { font-size: 17px; font-weight: 700; color: #1a3a4a; margin: 0 0 12px; }
.splash-sub { font-size: 12px; color: #888; max-width: 300px; margin: 4px auto 16px; text-align: center; }

/* ------------------------------------------------------------- masthead */
/* Full width, square corners, terminating into the device edges — the mark
   becomes the app's header instead of a plate floating on the photo. */
.masthead {
  flex: 0 0 auto;
  background: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: center;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(135deg, #1a3a4a, #116b57) 1;
  box-shadow: 0 2px 14px rgba(0,0,0,.22);
  position: relative; z-index: 30;
}
.masthead-logo { width: min(260px, 74%); height: auto; display: block; }

/* -------------------------------------------------------------- landing */
.landing-body {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}
.bg-image {
  position: absolute; inset: 0;
  background: url('/assets/images/background.3ea6e13be1.jpg') center center / cover no-repeat;
  z-index: 0;
}
/* A touch darker at the foot so the glass cards sit on something. */
.bg-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.10) 0%, rgba(0,0,0,.18) 45%, rgba(3,20,30,.55) 100%);
}
.landing-stack {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}

.card.frosted {
  background-color: rgba(8,26,36,.46);
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 10px 30px rgba(0,0,0,.34);
  border-radius: 14px;
  padding: 20px 0 18px;
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
}
.welcome-text {
  font-size: 21px; font-weight: 700; color: #fff;
  text-align: center; line-height: 1.25; letter-spacing: .01em;
  width: 100%; padding: 0 16px; margin: 0 0 8px;
}
.disclaimer-text {
  font-size: 13px; color: rgba(255,255,255,.86);
  text-align: center; line-height: 1.5;
  max-width: 300px; padding: 0 14px; margin: 0 0 18px;
}
.landing-foot {
  font-size: 11.5px; color: rgba(255,255,255,.72);
  text-align: center; margin: 12px 0 0; padding: 0 20px;
}
/* Government attribution. The stack takes auto block margins so it stays
   centred in the space ABOVE this line; the line itself sits at the foot of
   the photo where the overlay is darkest, and can never overlap the cards. */
.landing-stack { margin-block: auto; }
.gov-attrib {
  position: relative; z-index: 2; flex: 0 0 auto;
  margin: 14px 0 0; padding: 0 16px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-align: center; color: #fff; line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
}
.gov-attrib::before {
  content: ""; width: 34px; height: 2px; border-radius: 1px; margin-bottom: 8px;
  background: rgba(255,255,255,.55);
}
.gov-pre  { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.78); }
.gov-name { font-size: 13px; font-weight: 600; letter-spacing: .01em; text-wrap: balance; max-width: 100%; }
body.a11y-text-lg .gov-pre { font-size: 11px; }
body.a11y-text-lg .gov-name { font-size: 15px; }

/* Hugs its two pills instead of stretching the full width. */
.card.frosted.card-tools { width: auto; padding: 10px 16px; }
.tools-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
#landingA11yWrap, #landingLangWrap, .header-a11y-wrap, .header-lang-wrap { position: relative; }
#landingA11yWrap .a11y-panel, #landingLangWrap .lang-panel { bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); }
.header-a11y-wrap .a11y-panel { top: calc(100% + 10px); left: 0; }
.header-lang-wrap .lang-panel { top: calc(100% + 10px); right: 0; }

/* -------------------------------------------------------------- buttons */
.btn-primary {
  display: block; width: 100%; max-width: 340px;
  background-color: #116b57; color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600; text-align: center;
  padding: 14px 20px; border: none; border-radius: 8px; cursor: pointer;
  transition: background-color .2s;
}
.btn-primary:active { background-color: #0d5645; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-start { margin: 0 auto; width: calc(100% - 32px); box-shadow: 0 4px 14px rgba(0,0,0,.28); }

.btn-back {
  background: #eee; color: #555;
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 14px 22px; border: none; border-radius: 8px; cursor: pointer;
}

/* Pinned by flex rather than sticky, so it can never scroll away. */
.btn-row {
  flex: 0 0 auto;
  display: flex; gap: 12px; align-items: center;
  background: #fff;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e8e8e8;
}
.btn-row .btn-primary { max-width: none; flex: 1; }

/* --------------------------------------------------------------- fields */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 14px; font-weight: 700; color: #1a3a4a; margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%; font-family: inherit; font-size: 16px; color: #333;
  padding: 12px 14px; border: 2px solid #ddd; border-radius: 8px; background: #fff;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #116b57; }
.form-group select:disabled { background: #f5f5f5; color: #999; }
.form-group input.required-empty { border-color: #e74c3c; }
.field-hint { font-size: 12px; color: #888; margin: 6px 0 0; }
.field-err { font-size: 12px; font-weight: 600; color: #e74c3c; margin: 6px 0 0; }

/* ------------------------------------------------------------ questions */
.customs-question { background: #f9f9f9; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.q-text { font-size: 14px; color: #333; line-height: 1.45; margin: 0 0 10px; }
.yn-buttons { display: flex; gap: 10px; }
.btn-yn {
  flex: 1; padding: 11px;
  border: 2px solid #ccc; border-radius: 8px; background: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600; color: #333;
  cursor: pointer; transition: all .2s;
}
.btn-yn.selected-yes { background: #e8f5e9; border-color: #4caf50; color: #2e7d32; }
.btn-yn.selected-no  { background: #ffebee; border-color: #ef5350; color: #c62828; }

/* ------------------------------------------------------- declared items */
.declared-items-section { margin-top: 16px; margin-bottom: 24px; }
.declared-items-section.hidden { display: none; }
.declared-items-heading { font-size: 15px; font-weight: 600; color: #333; margin: 0 0 4px; }
.declared-items-sub { font-size: 13px; color: #666; margin: 0 0 10px; }
.declared-items-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.declared-item-card {
  display: flex; align-items: center; justify-content: space-between;
  background: #f9f9f9; border: 1px solid #e0e0e0; border-radius: 8px; padding: 10px 12px;
  font-size: 14px;
}
.declared-item-card .d-val { color: #666; font-size: 13px; white-space: nowrap; margin-left: auto; padding-right: 6px; }
.d-remove { border: none; background: none; color: #cc3333; font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1; }
.declared-items-form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.declared-items-form-row .declared-item-input:first-child { flex: 1 1 100%; }
.declared-items-form-row .declared-item-value-group { flex: 1 1 0; min-width: 0; display: flex; }
.declared-items-form-row .btn-add-item { flex: 0 0 auto; margin-left: auto; }
.declared-item-input {
  flex: 1; padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 14px; background: #fff; font-family: inherit; color: #333; min-width: 0;
}
.declared-item-currency {
  padding: 10px 4px 10px 8px; border: 1px solid #ccc; border-right: none;
  border-radius: 8px 0 0 8px; font-size: 14px; background: #f5f5f5;
  color: #333; appearance: auto; cursor: pointer; font-family: inherit;
}
.declared-item-value { max-width: 120px; border-radius: 0 8px 8px 0; }
.btn-add-item {
  padding: 10px 16px; background: #116b57; color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap; font-family: inherit;
}
.declared-items-error { color: #cc3333; font-size: 13px; margin-top: 6px; }
.declared-items-error.hidden { display: none; }

/* ---------------------------------------------------------- signature */
/* Presented as an attestation the traveller is signing against, rather than
   a grey caption. Same wording as ArriveAntigua, given weight. */
.attest-box {
  border: 2px solid #1a3a4a; border-left-width: 5px; border-radius: 8px;
  background: #f7f9fa; padding: 14px 16px; margin: 4px 0 6px;
}
.attest-text { margin: 0; font-size: 14px; line-height: 1.55; color: #1a3a4a; font-weight: 600; }

.signature-container {
  width: 100%; height: 200px; border: 2px solid #ccc; border-radius: 10px;
  background: #fff; overflow: hidden; margin: 12px 0;
}
.signature-container canvas { width: 100%; height: 100%; touch-action: none; display: block; }
.btn-link {
  background: none; border: none; color: #116b57; font-size: 14px; font-weight: 600;
  text-decoration: underline; cursor: pointer; margin: 8px auto; display: block;
  font-family: inherit;
}

/* --------------------------------------------------------------- review */
.review-section { border-bottom: 1px solid #eee; padding: 10px 0; }
.review-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.review-row .k { color: #777; }
.review-row .v { font-weight: 600; color: #333; text-align: right; }
.review-row .v.flag { color: #e74c3c; }
.attest { font-size: 12px; color: #888; margin: 14px 0 0; }

/* ------------------------------------------------------------ face scan */
#step-face-scan { background: #000; }
#step-face-scan .step-content { padding: 0; background: #000; }
.scan-content { padding: 0; }
.camera-container { position: relative; width: 100%; flex: 1 1 auto; min-height: 0; background: #000; overflow: hidden; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.oval-guide {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%);
  width: 58%; aspect-ratio: 0.78;
  border: 3px solid rgba(255,255,255,.7); border-radius: 50%;
  pointer-events: none; transition: border-color .3s;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
}
.scanning .oval-guide { border-color: #ffd54f; }
.matched .oval-guide { border-color: #4caf50; border-width: 4px; }
.scan-close {
  position: absolute; z-index: 20;
  top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(60,60,60,.75); color: #fff; border: none;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.scan-hint {
  position: absolute; left: 0; right: 0; z-index: 20;
  bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  text-align: center; color: #fff; font-size: 15px; padding: 0 28px;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.scan-hint.bad { color: #ff8a80; }
.scan-hint.good { color: #69f0ae; font-weight: 700; font-size: 17px; }
.scan-actions {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center;
}
.btn-capture {
  width: 68px; height: 68px; border-radius: 50%;
  background: #fff; border: 5px solid rgba(255,255,255,.45);
  cursor: pointer;
}
.btn-capture:disabled { opacity: .5; }

/* ------------------------------------------------------------- complete */
.complete-content { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 30px; }
.complete-check { width: 84px; height: 84px; margin: 0 auto 18px; display: block; }
.complete-title { font-size: 20px; font-weight: 700; color: #116b57; margin: 0 0 8px; }
.complete-sub { font-size: 14px; color: #555; margin: 0 0 18px; max-width: 300px; }
.reference-box {
  background: #e8f5f1; border: 2px dashed #116b57; border-radius: 10px;
  padding: 14px 20px; margin: 0 0 14px;
}
.reference-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #116b57; margin: 0 0 4px; }
.reference-code { font-size: 24px; font-weight: 700; color: #1a3a4a; letter-spacing: .06em; margin: 0; }

/* ------------------------------------------ a11y + language pill widgets */
.a11y-btn, .lang-btn {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.45);
  color: #fff; border-radius: 8px; padding: 8px 13px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.header-a11y-wrap .a11y-btn, .header-lang-wrap .lang-btn { padding: 6px 10px; font-size: 13px; }
/* In a step header the language control is flag-only, as on ArriveAntigua —
   the label would push the title onto a second line on a small phone. */
.header-lang-wrap .lang-btn span:last-child { display: none; }
.header-lang-wrap .lang-btn span:first-child { font-size: 16px; }
.a11y-panel, .lang-panel {
  position: absolute; z-index: 80; min-width: 200px;
  background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.32);
  padding: 12px; color: #333; text-align: left;
}
.a11y-panel[hidden], .lang-panel[hidden] { display: none; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.a11y-row:last-child { margin-bottom: 0; }
.a11y-row span { font-size: 13px; font-weight: 600; color: #1a3a4a; }
.a11y-seg { display: flex; gap: 4px; }
.a11y-seg button, .a11y-toggle {
  border: 2px solid #ddd; background: #fff; border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: 700; color: #555;
  padding: 6px 10px; cursor: pointer;
}
.a11y-seg button.on, .a11y-toggle.on { background: #116b57; border-color: #116b57; color: #fff; }
.lang-panel button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; font-family: inherit; font-size: 14px;
  color: #333; padding: 10px 8px; border-radius: 6px; cursor: pointer;
}
.lang-panel button.on { background: #e8f5f1; color: #116b57; font-weight: 700; }

/* ------------------------------------------------- accessibility classes */
body.a11y-text-sm { font-size: 13px; }
body.a11y-text-lg { font-size: 17px; }
body.a11y-text-lg .form-title { font-size: 19px; }
body.a11y-text-lg .q-text, body.a11y-text-lg .btn-yn { font-size: 16px; }
body.a11y-text-lg .welcome-text { font-size: 23px; }
body.a11y-bold, body.a11y-bold .q-text, body.a11y-bold .disclaimer-text { font-weight: 700; }
body.a11y-contrast .step-header { background: #000 !important; border-bottom-color: #555 !important; }
body.a11y-contrast .masthead { border-image: none; border-bottom: 3px solid #000; }
body.a11y-contrast .bg-overlay { background: #000 !important; }
body.a11y-contrast .card.frosted {
  background: #000 !important; backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important; border: 2px solid #fff !important;
}
body.a11y-contrast .btn-primary { background: #000 !important; color: #fff !important; border: 2px solid #fff !important; }
body.a11y-contrast .customs-question { background: #fff !important; border: 2px solid #333; }
body.a11y-contrast .btn-yn { border: 2px solid #333 !important; color: #000 !important; }
body.a11y-contrast .btn-yn.selected { background: #000 !important; color: #fff !important; }

.hidden { display: none !important; }

/* ---------------------------------------------------------- desktop note */
.desk-note { display: none; }
@media (min-width: 760px) and (pointer: fine) {
  html, body { position: static; overflow: auto; height: auto; }
  .mobile-view { display: none; }
  .desk-note {
    display: flex; align-items: center; justify-content: center;
    min-height: 100svh; padding: 2rem; text-align: center;
    background: #0e1b22 url('/assets/images/background.3ea6e13be1.jpg') center center / cover no-repeat;
  }
  .desk-note-inner {
    background: rgba(0,0,0,.58); border-radius: 14px; padding: 34px 30px; max-width: 430px;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  /* The mark needs a light ground, so it gets a plate rather than a recolour. */
  .desk-note img.logo {
    width: 300px; max-width: 100%; height: auto; margin: 0 auto 22px;
    display: block; background: #fff; padding: 14px 16px; border-radius: 10px;
  }
  .desk-note h1 { font-size: 21px; color: #fff; margin: 0 0 10px; }
  .desk-note p { font-size: 14px; color: rgba(255,255,255,.85); margin: 0 0 8px; }
  .desk-note .qr { width: 150px; height: 150px; background: #fff; padding: 10px; border-radius: 10px; margin: 20px auto 8px; display: block; }
  .desk-note .url { font-weight: 700; color: #fff; letter-spacing: .03em; }
  .desk-note .gov-attrib { margin: 26px 0 0; padding: 0; text-shadow: none; }
  .desk-note .gov-attrib::before { margin-bottom: 12px; }
  .desk-note .gov-pre { font-size: 10.5px; color: rgba(255,255,255,.7); margin: 0; }
  .desk-note .gov-name { font-size: 14px; color: #fff; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
