/*
 * Design brief: the user is a farm worker, on a phone, often outdoors in bright
 * sun, frequently reading their second language, sometimes with limited
 * literacy. So: very large type, very large tap targets, high contrast, one
 * decision per screen, and no jargon anywhere in the UI.
 *
 * Palette matches the H-2A Payroll app so the two products feel related.
 */

:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --green-light: #dcfce7;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f9fafb;
  --card: #ffffff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warn: #d97706;
  --warn-light: #fffbeb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  /* Base size is deliberately large. Do not shrink this. */
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ── App bar ─────────────────────────────────────────────────────────────── */
.appbar {
  background: var(--green);
  color: #fff;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar .brand { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.appbar .sub { font-size: 13px; opacity: .9; }
.appbar .spacer { flex: 1; }

.langtoggle {
  display: flex;
  background: rgba(255, 255, 255, .2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.langtoggle button {
  border: 0;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  /* 44px is the minimum reliable finger target. Do not shrink this. */
  min-height: 44px;
  min-width: 52px;
}
.langtoggle button.on { background: #fff; color: var(--green-dark); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}

h1 { font-size: 27px; line-height: 1.25; margin: 0 0 10px; letter-spacing: -.4px; }
h2 { font-size: 21px; line-height: 1.3; margin: 0 0 8px; }
p  { margin: 0 0 14px; }
.lead { font-size: 19px; color: #374151; }
.muted { color: var(--muted); font-size: 16px; }
.center { text-align: center; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 17px; }

input[type=text], input[type=tel], input[type=email], input[type=number], select {
  width: 100%;
  /* 18px+ prevents iOS from zooming the viewport on focus. */
  font-size: 19px;
  padding: 16px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  min-height: 58px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-light);
}

/* One-time code: big, spaced, numeric keypad. */
.codeinput {
  font-size: 34px !important;
  letter-spacing: 12px;
  text-align: center;
  font-weight: 800;
  padding: 18px 10px !important;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 60px;
  font-size: 19px;
  font-weight: 800;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  padding: 16px;
  transition: transform .06s ease, background .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:hover:not(:disabled) { background: var(--green-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.secondary { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn.secondary:hover:not(:disabled) { background: var(--bg); }
.btn.link {
  background: transparent;
  color: var(--green-dark);
  min-height: 48px;
  font-size: 17px;
  text-decoration: underline;
}
.btn.link:hover:not(:disabled) { background: transparent; }

/* Big yes/no choice buttons — the main interaction pattern. */
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  min-height: 72px;
  padding: 16px 18px;
  font-size: 19px;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 12px;
  color: var(--ink);
}
.choice:hover { border-color: var(--green); background: var(--green-light); }
.choice.on { border-color: var(--green); background: var(--green-light); }
.choice .emoji { font-size: 28px; line-height: 1; }
.choice .sub { display: block; font-weight: 500; font-size: 15px; color: var(--muted); margin-top: 2px; }

/* ── Messages ────────────────────────────────────────────────────────────── */
.alert {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 17px;
  border: 2px solid;
}
.alert.error { background: var(--danger-light); border-color: #fecaca; color: #991b1b; }
.alert.warn  { background: var(--warn-light);  border-color: #fde68a; color: #92400e; }
.alert.ok    { background: var(--green-light); border-color: #bbf7d0; color: #166534; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps .dot { flex: 1; height: 6px; border-radius: 999px; background: var(--line); }
.steps .dot.on { background: var(--green); }

/* ── Year / return cards ─────────────────────────────────────────────────── */
.yearcard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: var(--ink);
}
.yearcard:hover { border-color: var(--green); }
.yearcard .year { font-size: 26px; font-weight: 800; min-width: 76px; }
.yearcard .grow { flex: 1; }
.yearcard .status { font-size: 15px; color: var(--muted); }
.pill {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-light);
  color: #166534;
}
.pill.warn { background: var(--warn-light); color: #92400e; }
.pill.danger { background: var(--danger-light); color: #991b1b; }

.deadline { font-size: 14px; color: var(--danger); font-weight: 700; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hr { height: 1px; background: var(--line); margin: 22px 0; border: 0; }

.footnote {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  padding: 0 8px;
  margin-top: 18px;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 16px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 10px 0;
  min-height: 44px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LANDING PAGE
   Mobile-first. The app views stay a narrow centered card (correct for forms
   at any width); the landing page is full-bleed and scales up to desktop.
   ═══════════════════════════════════════════════════════════════════════════ */

.landing { flex: 1; }

/* Full-bleed section with a centered, width-capped inner container. */
.section { padding: 48px 20px; }
.section-inner { max-width: 1120px; margin: 0 auto; }
.section.tint { background: #fff; }
.section.deep { background: #0f3d26; color: #e8f5ee; }
.section.deep h2 { color: #fff; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, #16a34a 0%, #15803d 55%, #0f5132 100%);
  color: #fff;
  padding: 44px 20px 52px;
}
.hero-inner { max-width: 1120px; margin: 0 auto; }
.hero h1 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -.6px;
  margin: 0 0 14px;
  color: #fff;
}
.hero p.sub { font-size: 19px; line-height: 1.5; color: #e7f6ed; margin: 0 0 26px; max-width: 60ch; }
.hero .cta { max-width: 380px; }
.hero .btn { background: #fff; color: var(--green-dark); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.hero .btn:hover:not(:disabled) { background: #f0fdf4; }
.hero .reassure { font-size: 15px; color: #cfe9da; margin-top: 14px; }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  background: rgba(255,255,255,.18);
  color: #fff;
  padding: 7px 13px;
  border-radius: 999px;
  margin-bottom: 16px;
}

/* ── Urgency strip ───────────────────────────────────────────────────────── */
.urgency {
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  padding: 16px 20px;
}
.urgency-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; color: #92400e; font-weight: 600;
}
.urgency .big { font-size: 26px; line-height: 1; }

/* ── Feature / step grids ────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.feature {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.feature .ico { font-size: 30px; line-height: 1; margin-bottom: 12px; display: block; }
.feature h3 { font-size: 18px; margin: 0 0 6px; }
.feature p { font-size: 16px; color: #4b5563; margin: 0; }

.step { display: flex; gap: 16px; align-items: flex-start; }
.step .num {
  /* Fixed box, never flex-sized: in a column-direction parent a flex-basis
     would apply to height and collapse this circle into an oval. */
  flex: none;
  width: 40px; height: 40px;
  background: var(--green); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.step h3 { font-size: 18px; margin: 6px 0 4px; }
.step p { font-size: 16px; color: #4b5563; margin: 0; }

.section h2 { font-size: 26px; letter-spacing: -.3px; margin: 0 0 8px; }
.section .lede { font-size: 18px; color: var(--muted); margin: 0 0 28px; max-width: 62ch; }
.section.deep .lede { color: #b9d8c7; }

/* ── Honest note (trust) ─────────────────────────────────────────────────── */
.note {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  padding: 22px;
}
.note h3 { margin: 0 0 8px; font-size: 19px; color: #fff; }
.note p { margin: 0; color: #cfe4d8; font-size: 16px; }

/* ── FAQ ─────────────────────────────────────────────────────────────────── */
.faq details {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.faq summary {
  font-weight: 700; font-size: 17px; cursor: pointer;
  list-style: none; display: flex; justify-content: space-between;
  align-items: center; gap: 12px;
  /* Meet the 44px tap target; the row is the control, not just the text. */
  min-height: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 22px; color: var(--green); line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq p { margin: 12px 0 0; color: #4b5563; font-size: 16px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.foot {
  background: #111827; color: #9ca3af;
  padding: 32px 20px 40px;
  font-size: 15px;
}
.foot-inner { max-width: 1120px; margin: 0 auto; }
.foot strong { color: #fff; display: block; margin-bottom: 6px; font-size: 16px; }
.foot a { color: #d1d5db; }
.foot .legal { margin-top: 18px; font-size: 13px; color: #6b7280; line-height: 1.6; }

/* ═══ Tablet ════════════════════════════════════════════════════════════════ */
@media (min-width: 720px) {
  .section { padding: 64px 32px; }
  .hero { padding: 72px 32px 80px; }
  .hero h1 { font-size: 44px; }
  .hero p.sub { font-size: 21px; }
  .section h2 { font-size: 32px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .urgency-inner { font-size: 17px; }
}

/* ═══ Desktop ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .hero { padding: 96px 40px 104px; }
  .hero-inner {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 56px;
    align-items: center;
  }
  .hero h1 { font-size: 54px; }
  .hero p.sub { font-size: 22px; margin-bottom: 32px; }
  .hero .cta { max-width: none; }
  .section { padding: 80px 40px; }
  /* Four features across, so none of them orphans onto a second row. */
  .grid.three { grid-template-columns: repeat(4, 1fr); }
  .grid.steps { grid-template-columns: repeat(4, 1fr); }
  .grid.steps .step { flex-direction: column; gap: 12px; }
  .faq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
  .faq-grid details { margin-bottom: 0; }
}

/* The hero card that holds the sign-up prompt on desktop. */
.hero-card {
  background: #fff;
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0,0,0,.22);
  color: var(--ink);
}
.hero-card h3 { margin: 0 0 6px; font-size: 20px; }
.hero-card p { font-size: 15px; color: var(--muted); margin: 0 0 16px; }
.hero-card .btn { background: var(--green); color: #fff; box-shadow: none; }
.hero-card .btn:hover:not(:disabled) { background: var(--green-dark); }
/* The secondary action stays a link, not a second solid button competing
   with the primary CTA. Needs to out-specify `.hero-card .btn` above. */
.hero-card .btn.link,
.hero .btn.link {
  background: transparent;
  color: var(--green-dark);
  box-shadow: none;
}
.hero-card .btn.link:hover:not(:disabled),
.hero .btn.link:hover:not(:disabled) { background: transparent; }
