/* ==========================================================================
   home.css - Homepage-specific styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  padding: var(--space-16) 0 var(--space-20);
  text-align: center;
  background: #fff;
  position: relative;
  overflow: hidden;
}

/* Subtle grid pattern behind hero */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--clr-primary-light);
  color: var(--clr-primary-dark);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
  border: 1px solid var(--clr-primary-muted);
}
.hero__eyebrow svg { flex-shrink: 0; }

@media (max-width: 480px) {
  .hero__eyebrow {
    flex-direction: column;
    gap: var(--space-1);
    text-align: center;
  }
}

.hero__headline {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--clr-dark);
  margin-bottom: var(--space-5);
}
.hero__headline .accent { color: var(--clr-primary); }

.hero__subtext {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--clr-muted);
  line-height: 1.65;
  max-width: 540px;
  margin: 0 auto var(--space-10);
}

/* --------------------------------------------------------------------------
   Search Box
   -------------------------------------------------------------------------- */
.search-flash {
  max-width: 720px;
  margin: 0 auto var(--space-3);
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  color: #991b1b;
  font-size: 14px;
  text-align: center;
}

.search-box {
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 720px;
  margin: 0 auto;
  overflow: hidden;
}

.search-tabs {
  display: flex;
  border-bottom: 1px solid var(--clr-border);
  background: #fff;
}

.search-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--clr-muted);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color var(--dur-base) var(--ease),
              background var(--dur-base) var(--ease);
}
.search-tab:first-child { border-radius: var(--radius-xl) 0 0 0; }
.search-tab:last-child  { border-radius: 0 var(--radius-xl) 0 0; }

.search-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background: var(--clr-primary);
  transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease);
}
.search-tab:hover { color: var(--clr-text); }
.search-tab.is-active {
  color: var(--clr-primary);
  font-weight: 600;
}
.search-tab.is-active::after { transform: scaleX(1); }


.search-body { padding: 20px 24px 24px; }

.search-panel {
  display: none;
}
.search-panel.is-active { display: block; }

.search-form {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  column-gap: var(--space-3);
  /* Top-anchor fields so a validation error grows downward beneath its own
     input instead of pushing the other inputs around (which happens with
     bottom alignment when one field's error message wraps to a 2nd line). */
  align-items: start;
}

.search-form--four-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  row-gap: var(--space-4);
}
.search-form--four-col .btn--primary {
  grid-column: 1 / -1;
  height: 52px;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.search-field label {
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-muted);
  text-align: center;
}

.search-field input,
.search-field select {
  height: 48px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--clr-text);
  background: #fff;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.search-field input::placeholder { color: var(--clr-border); color: #B0BFCF; }

.search-field input:focus,
.search-field select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-field input.is-error,
.search-field select.is-error  { border-color: var(--clr-error); }
.search-field input.is-error:focus,
.search-field select.is-error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }

.field-error {
  font-size: 12px;
  color: var(--clr-error);
  display: none;
  margin-top: 2px;
}
.search-field.has-error .field-error { display: block; }

.search-form .btn--primary {
  height: 48px;
  padding: 0 22px;
}

/* The VIN form's button shares a row with labelled inputs. Since the row is
   now top-anchored, offset the button by the label's line box (11px * 1.4)
   plus the field gap so it lines up with the input boxes, not the labels. */
.search-form:not(.search-form--four-col) .btn--primary {
  align-self: start;
  margin-top: calc(11px * 1.4 + var(--space-2));
}

/* Submitting state - spinner inside the primary button */
.search-form .btn--primary.is-loading {
  cursor: progress;
  opacity: 0.92;
}
.search-form .btn--primary.is-loading .btn__label {
  letter-spacing: 0.01em;
}

.btn__spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 10px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

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

/* Dim inactive fields while the form is in flight */
.search-form.is-submitting .search-field input,
.search-form.is-submitting .search-field select {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* Geolocation ZIP button */
.geo-wrapper {
  position: relative;
  width: 100%;
}

.geo-wrapper input {
  width: 100%;
  padding-right: 40px !important;
}

.geo-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--clr-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

.geo-btn:hover:not(:disabled) {
  color: var(--clr-primary);
  background: var(--clr-primary-light);
}

.geo-btn:disabled { cursor: default; opacity: 0.35; }
.geo-btn svg { width: 14px; height: 14px; }

.geo-btn.is-loading {
  color: var(--clr-primary);
  pointer-events: none;
}

.geo-btn.is-loading svg { animation: geo-spin 0.9s linear infinite; }
.geo-btn.is-filled { color: var(--clr-success); }

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

.search-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--clr-muted);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--clr-border-light);
}
.search-privacy svg { color: var(--clr-success); flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Trust Stat
   -------------------------------------------------------------------------- */
.trust-stat {
  margin-top: var(--space-8);
}

.trust-stat__inner {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  background: #fff;
  border: 1.5px solid var(--clr-primary-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-6);
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.10);
}

.trust-stat__count {
  font-size: 30px;
  font-weight: 800;
  color: var(--clr-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 11ch;
}

.trust-stat__divider {
  width: 48px;
  height: 1.5px;
  background: var(--clr-border);
  flex-shrink: 0;
}

.trust-stat__text {
  text-align: center;
}

.trust-stat__label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--clr-dark);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.trust-stat__sub {
  display: block;
  font-size: 12px;
  color: var(--clr-muted);
  margin-top: 3px;
}

@media (min-width: 481px) {
  .trust-stat__inner {
    flex-direction: row;
    gap: var(--space-5);
    padding: var(--space-5) var(--space-8);
  }
  .trust-stat__count   { font-size: clamp(34px, 5vw, 44px); }
  .trust-stat__divider { width: 1.5px; height: 40px; }
  .trust-stat__text    { text-align: left; }
  .trust-stat__label   { font-size: 15px; }
  .trust-stat__sub     { font-size: 13px; }
}

/* --------------------------------------------------------------------------
   Vehicle Location Diagram
   -------------------------------------------------------------------------- */
.vehicle-diagram {
  max-width: 600px;
  margin: var(--space-6) auto 0;
}

.vehicle-diagram__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--clr-muted);
  text-align: center;
  margin: 0 0 var(--space-3);
}

.vehicle-diagram__panels {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--clr-bg-alt);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
}

.vehicle-diagram__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.vehicle-diagram__img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

.vehicle-diagram__info {
  text-align: center;
}

.vehicle-diagram__name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--clr-dark);
  letter-spacing: -0.01em;
}

.vehicle-diagram__hint {
  display: block;
  font-size: 11px;
  color: var(--clr-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.vehicle-diagram__sep {
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding: 5px 10px;
  background: var(--clr-border-light);
  border-radius: var(--radius-full);
  line-height: 1;
}

@media (max-width: 480px) {
  .vehicle-diagram__panels {
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-5);
  }
  .vehicle-diagram__panel { width: 100%; }
  .vehicle-diagram__sep { display: none; }
  .vehicle-diagram__img { max-width: 280px; }
}

/* --------------------------------------------------------------------------
   How It Works
   -------------------------------------------------------------------------- */
.how-it-works {
  padding: var(--space-20) 0;
  background: #fff;
}

.how-it-works__header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.how-it-works__header .section-title {
  margin-bottom: var(--space-3);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  position: relative;
}

/* Connector line between steps */
.steps::before {
  content: '';
  position: absolute;
  top: 60px;
  left: calc(50% / 3 + 36px);
  right: calc(50% / 3 + 36px);
  height: 1px;
  background: linear-gradient(90deg, var(--clr-primary-muted), var(--clr-primary-muted));
  pointer-events: none;
}

.step {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg);
  position: relative;
  transition: background var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}
.step:hover {
  background: var(--clr-bg-alt);
  box-shadow: var(--shadow-sm);
}

.step__number {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--clr-primary);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  position: relative;
  z-index: 1;
}

.step__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--clr-dark);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.step__desc {
  font-size: 15px;
  color: var(--clr-muted);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Why Section
   -------------------------------------------------------------------------- */
.why-section {
  padding: var(--space-20) 0;
  background: var(--clr-bg-alt);
}

.why-section__header {
  text-align: center;
  margin-bottom: var(--space-12);
}
.why-section__header .section-title {
  margin-bottom: var(--space-3);
}
.why-section__header .section-subtitle {
  margin: 0 auto;
}

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.feature {
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  transition: border-color var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.feature:hover {
  border-color: var(--clr-primary-muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.feature__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--clr-primary-light);
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
}
.feature__icon svg { width: 24px; height: 24px; }

.feature__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--clr-dark);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.feature__desc {
  font-size: 14px;
  color: var(--clr-muted);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   CTA Banner
   -------------------------------------------------------------------------- */
.cta-banner {
  background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 50%, #3B82F6 100%);
  padding: var(--space-16) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(255,255,255,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.cta-banner__inner { position: relative; }

.cta-banner__title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
}

.cta-banner__sub {
  font-size: 17px;
  color: rgba(255,255,255,0.75);
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .steps {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .steps::before { display: none; }

  .step { padding: var(--space-6); text-align: left; }
  .step__number { margin: 0 0 var(--space-4); }

}

@media (max-width: 600px) {
  .hero { padding: var(--space-10) 0 var(--space-12); }

  .search-form,
  .search-form--four-col {
    grid-template-columns: 1fr;
    row-gap: var(--space-4);
  }
  .search-form .btn--primary {
    width: 100%;
    height: 52px;
    margin-top: 0;
  }
  .search-box { border-radius: var(--radius-lg); }
}

@media (max-width: 480px) {
  .features { grid-template-columns: 1fr; }
}
