/* ── Lead Leak Detector ── Deep Roots Marketing ── */

:root {
  /* Green scale */
  --deeproot: #0D1816;
  --undergrowth: #19302B;
  --canopy: #223C36;
  --sage: #647772;
  --silver-fern: #BCC2BC;

  /* Neutrals & accent */
  --bedrock: #141414;
  --ore: #C6A94D;
  --ore-dim: #8B7A3A;
  --limestone: #F4F0E8;
  --chalk: #FAF8F4;
  --charcoal: #2C2C2C;

  /* System alerts */
  --moss: #4A7C59;
  --amber: #D97706;
  --hearth: #D4A017;
  --ember: #C0392B;
  --ember-soft: #C97070;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "freight-sans-pro", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--charcoal);
  background: var(--chalk);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Typography ── */
h1, h2, .score-number {
  font-family: "sole-serif-titling", Georgia, serif;
  font-weight: 700;
}

.section-label, .hero-badge, .score-label {
  font-family: "freight-sans-pro", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.75rem;
}

/* ── Hero (100vh) ── */
.hero {
  background: var(--deeproot);
  color: var(--limestone);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 0;
}

.hero-inner {
  width: 100%;
}

.hero-badge {
  display: inline-block;
  color: var(--ore);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  color: var(--silver-fern);
  font-size: 1.125rem;
  max-width: 480px;
  margin: 0 auto 2.5rem;
}

/* ── Form ── */
.audit-form { max-width: 520px; margin: 0 auto; }

.input-mode[hidden] { display: none; }

.input-row {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: visible;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid var(--ore);
  transition: border-color 0.2s;
}

.input-row input {
  border-radius: 0;
  flex: 1;
  /* Left padding = 68px to match Google's layout:
     48px icon container + 20px (1.25rem) inner input padding */
  padding: 1rem 1.25rem 1rem 4.25rem;
  font-size: 1.0625rem;
  font-family: inherit;
  border: none;
  outline: none;
  background-color: #fff;
  /* Magnifying glass icon — same SVG Google paints inside gmp-place-autocomplete */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" fill="none" viewBox="0 0 25 24"><path fill="%235e5e5e" fill-rule="evenodd" d="M15.56 13.27 21.29 19l-1.49 1.49-5.73-5.73A6.4 6.4 0 0110.3 16a6.5 6.5 0 116.5-6.5c0 1.41-.47 2.7-1.24 3.77M10.3 5a4.5 4.5 0 10-.01 8.99A4.5 4.5 0 0010.3 5" clip-rule="evenodd"/></svg>');
  background-repeat: no-repeat;
  /* Center the 25px-wide icon inside a virtual 48px box → 11.5px from left */
  background-position: 11.5px center;
  background-size: 25px auto;
  color: var(--charcoal);
  color-scheme: light dark;
  min-width: 0;
}

.input-row input::placeholder { color: var(--sage); }

@media (prefers-color-scheme: dark) {
  .input-row input {
    /* Off-brand on purpose: matches the dark gray Google's Places widget paints in dark mode */
    background-color: #131314;
    /* Lighter icon fill for dark mode — matches what Google paints */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" fill="none" viewBox="0 0 25 24"><path fill="%239aa0a6" fill-rule="evenodd" d="M15.56 13.27 21.29 19l-1.49 1.49-5.73-5.73A6.4 6.4 0 0110.3 16a6.5 6.5 0 116.5-6.5c0 1.41-.47 2.7-1.24 3.77M10.3 5a4.5 4.5 0 10-.01 8.99A4.5 4.5 0 0010.3 5" clip-rule="evenodd"/></svg>');
    color: var(--limestone);
  }
}

.input-row button {
  padding: 1rem 1.75rem;
  background: var(--ore);
  color: var(--deeproot);
  font-family: "freight-sans-pro", sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  border-radius: 0;
}

.input-row:has(button:hover) { border-color: var(--ore-dim); }
.input-row button:hover { background: var(--ore-dim); color: var(--limestone); }
.input-row button:disabled { opacity: 0.7; cursor: not-allowed; }

.input-hint {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--sage);
}

.input-fallback {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.input-fallback a {
  color: var(--silver-fern);
  text-decoration: none;
  border-bottom: 1px solid var(--sage);
  transition: color 0.2s, border-color 0.2s;
}

.input-fallback a:hover {
  color: var(--ore);
  border-bottom-color: var(--ore);
}

/* ── Places Autocomplete (New) — PlaceAutocompleteElement ── */
.places-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  /* Transparent so the white doesn't flash through before Google's widget paints its own background */
  background: transparent;
  border-radius: 0;
}

.places-input-wrap gmp-place-autocomplete {
  flex: 1;
  min-width: 0;
  display: block;
  border: none;
  outline: none;
  border-radius: 0;
}

/* Tell the autocomplete widget it can render either theme */
.places-input-wrap {
  color-scheme: light dark;
}

/* Style the internal input via the shadow DOM part, if exposed.
   Default to dark text (light-mode widget background); flip to light text in dark mode. */
.places-input-wrap gmp-place-autocomplete::part(input) {
  font-family: "freight-sans-pro", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  padding: 1rem 1.25rem;
  color: var(--charcoal);
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
}

/* Fallback: style the element itself in case ::part is not supported */
.places-input-wrap gmp-place-autocomplete input {
  font-family: "freight-sans-pro", system-ui, -apple-system, sans-serif !important;
  font-size: 1.0625rem !important;
  padding: 1rem 1.25rem !important;
  color: var(--charcoal) !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  width: 100% !important;
}

@media (prefers-color-scheme: dark) {
  .places-input-wrap gmp-place-autocomplete::part(input) {
    color: var(--limestone);
  }

  .places-input-wrap gmp-place-autocomplete input {
    color: var(--limestone) !important;
  }
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--deeproot);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Score Section ── */
.score-section {
  background: var(--limestone);
  padding: 3rem 0;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.score-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-ring-bg {
  fill: none;
  stroke: var(--limestone);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--moss);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1s ease, stroke 0.3s;
}

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.score-label { color: var(--sage); margin-bottom: 0.25rem; }
.score-site { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.score-verdict { color: var(--sage); font-size: 0.9375rem; }

/* ── Impact ── */
.impact-section { padding: 0 0 2rem; background: var(--limestone); }

.impact-card {
  background: var(--undergrowth);
  color: var(--limestone);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 1.0625rem;
}

.impact-card strong { color: var(--ore); }

/* ── Checks ── */
.checks-section { padding: 3rem 0; }

.checks-section .section-label {
  color: var(--sage);
  margin-bottom: 1.5rem;
}

.checks-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.check-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--sage);
}

.check-card[data-status="pass"] { border-left-color: var(--moss); }
.check-card[data-status="warning"] { border-left-color: var(--amber); }
.check-card[data-status="fail"] { border-left-color: var(--ember); }

.check-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.check-name {
  font-weight: 700;
  font-size: 1rem;
}

.check-badge {
  font-family: "freight-sans-pro", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.6875rem;
  padding: 0.2em 0.6em;
  border-radius: 3px;
}

.check-card[data-status="pass"] .check-badge { background: #e8f5e9; color: var(--moss); }
.check-card[data-status="warning"] .check-badge { background: #fff3e0; color: var(--amber); }
.check-card[data-status="fail"] .check-badge { background: #fbe9e7; color: var(--ember); }

.check-detail {
  color: var(--sage);
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}

.check-recommendation {
  font-size: 0.875rem;
  color: var(--charcoal);
  padding-top: 0.5rem;
  border-top: 1px solid var(--limestone);
}

/* ── CTA ── */
.cta-section {
  padding: 2rem 0 4rem;
}

.cta-card {
  background: var(--deeproot);
  color: var(--limestone);
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
}

.cta-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.75rem;
}

.cta-desc {
  color: var(--silver-fern);
  max-width: 440px;
  margin: 0 auto 1.5rem;
}

.cta-btn {
  display: inline-block;
  background: var(--ore);
  color: var(--deeproot);
  padding: 0.875rem 2rem;
  font-family: "freight-sans-pro", sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
}

.cta-btn:hover { background: var(--ore-dim); color: var(--limestone); }

.cta-retry {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
}

.cta-retry a {
  color: var(--silver-fern);
  text-decoration: none;
  border-bottom: 1px solid var(--sage);
  transition: color 0.2s, border-color 0.2s;
}

.cta-retry a:hover {
  color: var(--ore);
  border-bottom-color: var(--ore);
}

/* ── Error ── */
.error-msg {
  background: #fbe9e7;
  padding: 1.5rem 0;
  text-align: center;
  color: var(--ember);
}

.error-msg button {
  margin-top: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: var(--ember);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

/* ── Footer ── */
.footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--sage);
  border-top: 1px solid var(--limestone);
}

.footer a { color: var(--ore-dim); text-decoration: none; }
.footer a:hover { color: var(--ore); }

/* ── Results Container & Grid ── */
.results-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 900px) {
  .results-grid {
    grid-template-columns: minmax(0, 65fr) minmax(320px, 35fr);
    align-items: start;
  }
}

/* Mobile: form appears ABOVE the audit report */
@media (max-width: 899px) {
  .results-side {
    order: -1;
  }
}

/* ── Business Header ── */
.business-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--limestone);
}

.business-name {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  color: var(--deeproot);
  margin-bottom: 0.35rem;
}

.business-address {
  color: var(--sage);
  font-size: 1rem;
}

/* Override score section padding inside the new layout */
.results-main .score-section {
  padding: 0 0 1.5rem;
  background: transparent;
}

.results-main .score-card {
  padding: 1.75rem;
}

.results-main .impact-section {
  padding: 0 0 1.5rem;
  background: transparent;
}

.results-main .checks-section {
  padding: 1rem 0 1.5rem;
}

.results-main .checks-section .section-label {
  margin-bottom: 1rem;
}

/* ── Sticky Booking Sidebar (desktop) ── */
.results-side {
  width: 100%;
}

@media (min-width: 900px) {
  .results-side {
    position: sticky;
    top: 2rem;
  }
}

.booking-card {
  background: var(--deeproot);
  color: var(--limestone);
  border-radius: 8px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.booking-title {
  font-size: 1.375rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.booking-desc {
  color: var(--silver-fern);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.booking-embed {
  background: var(--chalk);
  border-radius: 6px;
  min-height: 380px;
  overflow: hidden;
}

.booking-embed iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 380px;
}

.booking-placeholder {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--sage);
}

.booking-placeholder strong {
  display: block;
  color: var(--charcoal);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.booking-placeholder p {
  font-size: 0.875rem;
}

/* ── Mobile-only scroll-up CTAs scattered through the report ── */
.mobile-cta {
  display: none;
  margin: 1.5rem 0;
}

@media (max-width: 899px) {
  .mobile-cta {
    display: block;
  }
}

.mobile-cta-btn {
  display: block;
  width: 100%;
  background: var(--ore);
  color: var(--deeproot);
  padding: 1rem 1.25rem;
  font-family: "freight-sans-pro", sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  text-align: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.mobile-cta-btn:hover {
  background: var(--ore-dim);
  color: var(--limestone);
}

/* Inline CTA that appears between check cards (injected by JS) */
.mobile-cta-inline {
  display: none;
}

@media (max-width: 899px) {
  .mobile-cta-inline {
    display: block;
    margin: 0.5rem 0;
  }
}

/* ── Scan another (subtle link below report) ── */
.scan-another-wrap {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8125rem;
}

.scan-another-wrap a {
  color: var(--sage);
  text-decoration: none;
  border-bottom: 1px solid var(--silver-fern);
  transition: color 0.2s, border-color 0.2s;
}

.scan-another-wrap a:hover {
  color: var(--ore);
  border-bottom-color: var(--ore);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem 0;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .input-row {
    flex-direction: column;
    border-radius: 6px;
  }

  .input-row input { border-radius: 6px 6px 0 0; }
  border-radius: 0;

  .input-row button {
    border-radius: 0 0 6px 6px;
    padding: 0.875rem;
  }

  .places-input-wrap {
    border-radius: 6px 6px 0 0;
  }

  .score-card {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
    padding: 1.5rem;
  }
}
