/* Tradesperson website intake form. Mobile-first. */
:root {
  --navy: #1C2B4F;
  --navy-2: #2A3D69;
  --gold: #F5B935;
  --gold-soft: #FDF0CC;
  --cream: #FBF7EE;
  --paper: #FFFFFF;
  --ink: #1C2333;
  --muted: #5A6275;
  --line: #DDD5C3;
  --error: #B42318;
  --error-soft: #FDECEA;
  --ok: #1E7A46;
  --radius: 12px;
  --tap: 48px;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: var(--navy); }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--gold); color: var(--navy); padding: 10px 14px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--navy); }

/* Header */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-inner { max-width: 680px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--gold); border-radius: 2px; margin-right: 8px; transform: rotate(45deg) translateY(-2px); }
.save-status { margin: 0; font-size: .8rem; color: #C9D2E6; text-align: right; }
.save-status.warn { color: var(--gold); }
.progress { max-width: 680px; margin: 0 auto; padding: 0 16px 10px; }
.progress-track { height: 8px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--gold); border-radius: 99px; transition: width .3s ease; }
.progress-text { margin: 6px 0 0; font-size: .85rem; color: #E4E9F3; }

.offline-banner { margin: 0; background: var(--gold-soft); color: var(--navy); padding: 10px 16px; font-size: .9rem; text-align: center; }

main { max-width: 680px; margin: 0 auto; padding: 20px 16px 24px; }

/* Typography */
h1, h2, h3, .h3 { font-family: var(--font-head); color: var(--navy); line-height: 1.2; font-weight: 700; }
.step-title { font-size: 1.75rem; margin: 4px 0 8px; }
.step-title:focus { outline: none; }
.h3 { font-size: 1.1rem; margin: 0 0 6px; }
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 20px; }
.small { font-size: .875rem; color: var(--muted); }
.center { text-align: center; }

.intro-list { padding: 0; list-style: none; margin: 0 0 20px; }
.intro-list li { padding: 12px 0 12px 32px; border-bottom: 1px solid var(--line); position: relative; }
.intro-list li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 12px; height: 12px; background: var(--gold); border-radius: 50%; }
.intro-actions { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.resume { background: var(--paper); border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: 8px; margin-top: 16px; }
.resume p { margin: 0; }

/* Panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 20px; }
.panel ul { margin: 0; padding-left: 20px; }
.panel p:first-child { margin-top: 0; }
.panel p:last-child { margin-bottom: 0; }
.panel-soft { background: #F4EEDF; border-color: transparent; }
.panel-gold { background: var(--gold-soft); border-color: var(--gold); }
.panel-error { background: var(--error-soft); border-color: var(--error); }

/* Questions */
.q { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; min-width: 0; }
fieldset.q { margin-inline: 0; }
.q-label { display: block; font-weight: 600; font-size: 1.05rem; color: var(--navy); margin: 0 0 6px; padding: 0; }
legend.q-label { float: left; width: 100%; }
legend.q-label + * { clear: both; }
.req { font-weight: 500; font-size: .85rem; color: var(--error); white-space: nowrap; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: .92rem; }
label { display: block; font-weight: 500; margin: 12px 0 6px; }
.q-label + input, .q-label + textarea, .hint + input, .hint + textarea { margin-top: 2px; }

input[type="text"], input[type="tel"], input[type="email"], input[type="number"], input[type="time"], textarea, select {
  width: 100%; min-height: var(--tap); padding: 11px 12px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1.5px solid #B9B2A2; border-radius: 10px;
  appearance: none; -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 80px; }
input::placeholder, textarea::placeholder { color: #8C8F99; }
[aria-invalid="true"] { border-color: var(--error) !important; background: #FFF8F7; }
.field-error { color: var(--error); font-weight: 500; font-size: .9rem; margin: 6px 0 0; }

.two-col { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* Choice tiles */
.choices { display: grid; gap: 8px; margin-top: 4px; }
.choice {
  display: flex; align-items: center; gap: 12px; margin: 0;
  min-height: var(--tap); padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; font-weight: 500;
}
.choice input { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--navy); }
.choice:has(input:checked) { border-color: var(--navy); background: #EEF1F8; }
.choice:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 1px; }
.choice-consent { align-items: flex-start; font-weight: 500; }
.choice-consent input { margin-top: 2px; }
.q-consent { border-color: var(--navy); }

.reveal { margin-top: 10px; padding: 4px 0 0 12px; border-left: 3px solid var(--gold); }

/* Skip */
.skip-btn {
  display: inline-flex; align-items: center; min-height: 40px; margin-top: 12px; padding: 6px 12px;
  background: transparent; border: 1px dashed #A8A291; border-radius: 99px;
  color: var(--muted); font: inherit; font-size: .88rem; cursor: pointer;
}
.skip-btn:hover { color: var(--navy); border-color: var(--navy); }
.q.is-skipped { background: #F6F2E8; border-style: dashed; }
.q.is-skipped > *:not(.q-label):not(.skip-btn) { display: none !important; }
.q.is-skipped .skip-btn { color: var(--navy); border-style: solid; border-color: var(--navy); background: #fff; }

/* Repeaters */
.rep-row { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 8px 0 0; min-width: 0; }
.rep-row:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.rep-row legend { font-family: var(--font-head); font-weight: 700; color: var(--navy); padding: 0; margin-top: 8px; }

/* Accreditations */
.accred-list { display: grid; gap: 8px; }
.accred .reveal { margin-bottom: 8px; }

/* Hours */
.hours { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hours-row .day { font-weight: 600; }
.hours-row .times { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.hours-row .choice { min-height: 40px; padding: 6px 10px; }
.hours-row.is-closed .times { opacity: .4; }
@media (min-width: 560px) {
  .hours-row { grid-template-columns: 110px 1fr auto; }
  .hours-row .times { grid-column: auto; }
}

/* Uploads */
.vh, .vh-file { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.upload {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 64px; margin: 6px 0 0; padding: 12px;
  border: 2px dashed var(--navy-2); border-radius: 12px; background: #F3F5FA;
  color: var(--navy); font-weight: 600; cursor: pointer;
}
.upload-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--navy); font-size: 1.4rem; line-height: 1; }
.vh-file:focus-visible + .upload, .upload:has(+ .vh-file:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.upload-status { font-size: .9rem; color: var(--muted); margin: 8px 0 0; min-height: 1px; }
.upload-status.warn { color: var(--error); }
.thumbs { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .thumbs { grid-template-columns: 1fr 1fr; } }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.thumb-img { position: relative; aspect-ratio: 4 / 3; background: #EEE; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.thumb-file { display: grid; place-items: center; height: 100%; padding: 12px; text-align: center; font-weight: 600; color: var(--navy); word-break: break-all; }
.thumb-remove {
  position: absolute; top: 6px; right: 6px; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: rgba(28,43,79,.9); color: #fff;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.thumb-fields { padding: 4px 10px 10px; }
.thumb-fields label { margin: 8px 0 4px; font-size: .88rem; }
.thumb-fields input, .thumb-fields select { min-height: 44px; padding: 8px 10px; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px;
  border: 1.5px solid var(--navy); border-radius: 10px; background: #fff; color: var(--navy);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-primary:hover { background: #F0AD1A; border-color: #F0AD1A; }
.btn-lg { min-height: 56px; font-size: 1.1rem; padding: 12px 28px; }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: .9rem; margin-top: 12px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-link { background: none; border: 0; padding: 8px 4px; min-height: 44px; color: var(--navy); font: inherit; text-decoration: underline; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.send-row { margin: 20px 0 8px; }
.send-row .btn { width: 100%; }

/* Bottom nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(251,247,238,.97); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.nav-inner { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.nav-inner .btn { width: 100%; }

/* Review */
.review section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-head h3 { margin: 0; font-size: 1.1rem; }
.review dl { margin: 8px 0 0; }
.review dt { font-weight: 600; font-size: .9rem; color: var(--muted); margin-top: 10px; }
.review dd { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.review .empty { color: var(--muted); font-style: italic; margin: 8px 0 0; }
.review .skipped { color: var(--navy-2); font-style: italic; }

.cf-turnstile { margin: 16px 0 0; }

/* Honeypot */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.done .step-title { font-size: 2rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
