/* Shared tablet UI framework — leasing-office tablets.
 *
 * Design principles:
 *   - 56px minimum tap target (≥48px is iOS HIG, ≥48dp Android — go higher for gloved hands)
 *   - 22px+ body text, 28px+ form labels (readable across the office)
 *   - High contrast (always passes WCAG AA, often AAA)
 *   - Single column layout always — no horizontal scroll
 *   - Sticky bottom action bar — primary CTA always within thumb reach
 *   - Inline real-time validation (no submit-to-find-out-it's-broken)
 *   - Idle reset (90s default) returns to start screen
 */
:root {
  --brand: #2f4a62;
  --brand-dark: #1d3550;
  --accent: #dbe6cf;
  --accent-dark: #143;
  --warn: #ef6c00;
  --danger: #c62828;
  --success: #2e7d32;
  --ink: #111;
  --ink-soft: #444;
  --line: #d0d4d8;
  --line-soft: #e8eaec;
  --bg: #f7f8f9;
  --tap: 56px;
  --tap-lg: 72px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 22px; line-height: 1.45;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
  /* Stop the on-screen keyboard from squashing our layout into a scrolling mess */
  overflow-x: hidden;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Header ───────────────────────────────────────────────────── */
.tablet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.tablet-header .site {
  font-size: 24px; font-weight: 600; letter-spacing: 0.02em;
}
.tablet-header .who {
  font-size: 14px; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.06em;
}

/* ─── Main content area ────────────────────────────────────────── */
main.tablet {
  flex: 1; padding: 32px 28px 140px; /* extra bottom padding so sticky CTA doesn't cover content */
  max-width: 760px; margin: 0 auto; width: 100%;
}

h1.tablet { font-size: 36px; margin: 0 0 8px; color: var(--brand); font-weight: 700; }
.tablet-lede { font-size: 20px; color: var(--ink-soft); margin: 0 0 28px; }

/* ─── Field groups ─────────────────────────────────────────────── */
.field {
  display: flex; flex-direction: column; margin-bottom: 22px;
}
.field label {
  font-size: 18px; font-weight: 600; color: var(--brand-dark);
  margin-bottom: 8px; letter-spacing: 0.02em;
}
.field label .req { color: var(--danger); margin-left: 4px; }
.field input[type=text], .field input[type=email], .field input[type=tel],
.field input[type=number], .field textarea, .field select {
  font-size: 22px;
  padding: 0 18px;
  min-height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field textarea { min-height: 120px; padding: 14px 18px; resize: vertical; }
.field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'><path d='M1 1l7 7 7-7' stroke='%232f4a62' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 18px center;
  padding-right: 50px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 4px rgba(47,74,98,0.12);
}
.field.error input, .field.error textarea, .field.error select {
  border-color: var(--danger); background: #fff8f8;
}
.field .hint { font-size: 16px; color: var(--ink-soft); margin-top: 6px; }
.field .err  { font-size: 16px; color: var(--danger); margin-top: 6px; font-weight: 600; display: none; }
.field.error .err { display: block; }

/* ─── Big toggle buttons (Yes/No, option set rows) ─────────────── */
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle-row.three { grid-template-columns: 1fr 1fr 1fr; }
.toggle {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 16px;
  border: 2px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
  font-size: 20px; font-weight: 600;
  cursor: pointer; user-select: none;
  transition: all 0.12s;
}
.toggle:active { transform: scale(0.97); }
.toggle.selected {
  border-color: var(--brand); background: var(--accent); color: var(--accent-dark);
}

/* ─── Option-set list (How did you hear) ───────────────────────── */
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.opt {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 14px;
  border: 2px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 20px; font-weight: 500;
  cursor: pointer; user-select: none; text-align: center; line-height: 1.2;
}
.opt.selected { border-color: var(--brand); background: var(--accent); color: var(--accent-dark); font-weight: 700; }

/* ─── Sticky bottom action bar ─────────────────────────────────── */
.tablet-actions {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; gap: 14px;
  padding: 18px 28px env(safe-area-inset-bottom, 18px);
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  z-index: 10;
}
.tablet-actions .secondary,
.tablet-actions .primary {
  flex: 1; min-height: var(--tap-lg);
  font-size: 22px; font-weight: 700;
  border-radius: 12px; border: none;
  cursor: pointer; transition: transform 0.06s, background 0.12s;
  letter-spacing: 0.02em;
}
.tablet-actions .primary {
  background: var(--brand); color: #fff;
}
.tablet-actions .primary:active { transform: scale(0.98); background: var(--brand-dark); }
.tablet-actions .primary:disabled { background: #aab1b8; cursor: not-allowed; }
.tablet-actions .secondary {
  background: #fff; color: var(--brand); border: 2px solid var(--brand);
}
.tablet-actions .secondary:active { transform: scale(0.98); background: var(--accent); }
.tablet-actions.single .primary { flex: 1; }

/* ─── Success screen ───────────────────────────────────────────── */
.tablet-success {
  text-align: center; padding: 40px 28px;
}
.tablet-success .check {
  display: inline-block; width: 96px; height: 96px;
  background: var(--success); color: #fff;
  border-radius: 50%;
  font-size: 56px; line-height: 96px;
  margin-bottom: 16px;
  animation: pop 0.35s ease-out;
}
.tablet-success h2 { font-size: 32px; color: var(--brand); margin: 0 0 8px; }
.tablet-success p { font-size: 20px; color: var(--ink-soft); margin: 0; }
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* ─── Idle reset banner (subtle, shows the countdown) ──────────── */
.idle-banner {
  position: fixed; top: 12px; right: 24px;
  font-size: 14px; color: var(--ink-soft);
  background: rgba(255,255,255,0.85); border: 1px solid var(--line-soft);
  padding: 6px 10px; border-radius: 8px;
  opacity: 0; transition: opacity 0.3s;
}
.idle-banner.show { opacity: 1; }

/* Fair-housing modal trigger + link in footer */
.fhn-link {
  display: inline-block; margin-top: 14px;
  font-size: 14px; color: var(--ink-soft); text-decoration: underline;
}
.fhn-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.fhn-modal.show { display: flex; }
.fhn-modal .panel {
  background: #fff; border-radius: 14px; max-width: 640px; width: 100%;
  padding: 28px; font-size: 18px; line-height: 1.55; color: var(--ink);
  max-height: 80vh; overflow-y: auto;
}
.fhn-modal h2 { font-size: 24px; color: var(--brand); margin: 0 0 12px; }
.fhn-modal button {
  margin-top: 18px; width: 100%; min-height: var(--tap);
  background: var(--brand); color: #fff; border: none;
  font-size: 20px; font-weight: 600; border-radius: 10px; cursor: pointer;
}
