/* ============================================================
   Roofing Form — responsive styles
   Brand color is injected at runtime via --brand-color
   ============================================================ */

:root {
  --brand-color: #1a5276;
  --brand-color-dark: #134060;
  --brand-color-secondary: #1a1a1a;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #d1d5db;
  --border-focus: var(--brand-color);
  --bg: #ffffff;
  --bg-soft: #f9fafb;
  --error: #b91c1c;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.loader {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.error-banner {
  margin: 1rem;
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--error);
  text-align: center;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

/* ---------- Brand header ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 1.5rem;
  border-bottom: 2px solid var(--brand-color);
  margin-bottom: 1.5rem;
}

.brand__logo {
  max-height: 64px;
  width: auto;
}

.brand__text { display: flex; flex-direction: column; }

.brand__name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-color);
}

.brand__phone {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
}

.brand__phone:hover { color: var(--brand-color); }

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 1.5rem; }

.form__section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.form__heading {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.field {
  display: block;
  margin: 0 0 1.1rem;
  border: none;
  padding: 0;
}

.field:last-child { margin-bottom: 0; }

.field label,
.field legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  padding: 0;
}

.req { color: var(--error); margin-left: 2px; }

.field__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0.5rem;
}

.field__error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
  min-height: 1em;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.15);
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid {
  border-color: var(--error);
}

.field textarea { resize: vertical; min-height: 80px; }

/* ---------- Radio rows ---------- */
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  flex: 1 1 auto;
  min-width: 90px;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.radio input { accent-color: var(--brand-color); }

.radio:hover { border-color: var(--brand-color); }

.radio:has(input:checked) {
  border-color: var(--brand-color);
  background: rgba(26, 82, 118, 0.06);
}

/* ---------- Checkbox ---------- */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.checkbox input { accent-color: var(--brand-color); margin-top: 0.2rem; }

/* ---------- Pitch picker ---------- */
.pitch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.pitch-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pitch-card img {
  width: 100%;
  height: auto;
  max-height: 70px;
  object-fit: contain;
}

.pitch-card input { position: absolute; opacity: 0; pointer-events: none; }

.pitch-card:hover { border-color: var(--brand-color); }

.pitch-card:has(input:checked) {
  border-color: var(--brand-color);
  background: rgba(26, 82, 118, 0.08);
}

/* ---------- Skip to inspection ---------- */
.skip-section {
  text-align: center;
  padding: 0.5rem 0;
}

.skip-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-color);
  background: #fff;
  border: 2px solid var(--brand-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.skip-btn:hover:not(:disabled) {
  background: var(--brand-color);
  color: #fff;
}

.skip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.skip-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0;
}

/* ---------- Consent + submit ---------- */
.consent-section { background: var(--bg); }

.consent {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 1rem;
}

.consent a {
  color: var(--text-muted);
  text-decoration: underline;
}

.consent a:hover {
  color: var(--brand-color);
}

.submit-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand-color);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.submit-btn:hover:not(:disabled) { background: var(--brand-color-dark); }
.submit-btn:active:not(:disabled) { transform: translateY(1px); }

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-error {
  color: var(--error);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  text-align: center;
}

/* ---------- Thank-you page ---------- */
.thanks-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.thanks-card__heading {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  color: var(--brand-color);
}

.thanks-card__subheading {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.thanks-card__phone-cta {
  font-size: 1.1rem;
  margin: 0;
}

.thanks-card__phone-cta a {
  color: var(--brand-color);
  text-decoration: none;
}

.thanks-card__phone-cta a:hover {
  text-decoration: underline;
}

.calendly-container {
  margin-bottom: 2rem;
}

.call-btn {
  display: inline-block;
  padding: 1rem 2rem;
  background: var(--brand-color);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1.15rem;
  text-align: center;
  width: 100%;
  transition: background 0.15s ease;
}

.call-btn:hover {
  background: var(--brand-color-dark);
}

/* ---------- Inactive message ---------- */
.inactive-message {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.inactive-message h2 {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: 1.3rem;
}

.inactive-message p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.inactive-message a {
  color: var(--brand-color);
  text-decoration: none;
  font-weight: 600;
}

.inactive-message a:hover {
  text-decoration: underline;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 480px) {
  .app { padding: 0.75rem; }
  .form__section { padding: 1rem; }
  .brand__name { font-size: 1.1rem; }
  .pitch-grid { gap: 0.4rem; }
  .pitch-card { font-size: 0.8rem; padding: 0.45rem; }
  .radio { min-width: 0; }
  .thanks-card { padding: 1.5rem 1rem; }
  .thanks-card__heading { font-size: 1.2rem; }
}
