:root {
  /* Surfaces (kept light/white per request) */
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f5f8fb;
  --border: #e3eaf1;
  --border-strong: #c7d4e0;

  /* Brand palette (from economyroofing.la) */
  --navy: #063554;        /* primary brand */
  --navy-deep: #04263d;
  --blue: #3796d4;        /* secondary / selection */
  --blue-soft: #e7f3fb;
  --blue-tint: #cfecff;
  --orange: #ea492e;      /* call-to-action */
  --orange-hover: #d23a20;
  --green: #1f9d57;       /* completed step */

  /* Text */
  --text: #1c2b38;
  --heading: #063554;
  --muted: #6b7d8c;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(6, 53, 84, 0.06), 0 1px 3px rgba(6, 53, 84, 0.08);
  --shadow-md: 0 4px 14px rgba(6, 53, 84, 0.10), 0 2px 5px rgba(6, 53, 84, 0.05);
  --shadow-lg: 0 14px 36px rgba(6, 53, 84, 0.16);

  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keep section tops clear of the sticky header (~112px) on scroll. */
  scroll-padding-top: 120px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* ----------------------------- top bar ----------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 30px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  /* Above #step-address (z-index 20) so the address dropdown never covers the header. */
  z-index: 50;
}

.brand { display: flex; align-items: center; }
.brand-link { display: inline-flex; align-items: center; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
/* Fixed height + min-width so the two buttons render the same size regardless of
   their different borders/padding. */
.topbar-actions button {
  box-sizing: border-box;
  height: 40px;
  min-width: 140px;
  padding: 0 18px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-logo {
  display: block;
  height: 80px;
  width: auto;
}

/* ------------------------------- hero ------------------------------ */
.hero {
  text-align: center;
  padding: 60px 20px 56px;
  background: radial-gradient(1100px 480px at 50% -8%, var(--blue-soft), #fff 70%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 920px; margin: 0 auto; }
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5.5vw, 54px);
  line-height: 1.05;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.01em;
  margin: 0 0 16px;
}
.hero-sub {
  font-size: clamp(16px, 2.2vw, 20px);
  color: var(--muted);
  line-height: 1.55;
  max-width: 660px;
  margin: 0 auto 36px;
}
.hero-compare { margin: 40px auto 0; max-width: 880px; }
.hero-compare-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.compare-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.compare-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(6, 53, 84, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 11px;
  border-radius: 999px;
}
.compare-tag.after { background: var(--orange); }
.hero-compare figcaption { color: var(--muted); font-size: 13.5px; margin-top: 14px; }
.hero-cta {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 15px 36px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 12px rgba(234, 73, 46, 0.32);
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
}
.hero-cta:hover { background: var(--orange-hover); box-shadow: 0 5px 18px rgba(234, 73, 46, 0.42); }
.hero-cta:active { transform: translateY(1px); }

@media (max-width: 640px) {
  .hero-compare-imgs { grid-template-columns: 1fr; }
}

/* ------------------------------ layout ----------------------------- */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
/* Offset anchor scroll so the sticky header doesn't cover Step 1. */
#step-address { scroll-margin-top: 130px; }

.step {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.step h2 {
  font-family: var(--font-serif);
  font-size: 27px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: 0.01em;
}

.step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.2s;
}

/* Completed step: same number, circle turns green. */
.step .num.done {
  background: var(--green);
}

/* --------------------------- edit button --------------------------- */
.edit-btn {
  display: none; /* shown only when the step is collapsed */
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--navy);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.edit-btn:hover { background: var(--blue-soft); border-color: var(--blue); }
.edit-btn svg { display: block; }

/* ------------------------ collapsed step --------------------------- */
.step-summary { display: none; }

.step.collapsed { padding: 16px 24px; }
.step.collapsed h2 { margin: 0; font-size: 20px; }
.step.collapsed .num { width: 26px; height: 26px; font-size: 13px; }
.step.collapsed .step-body { display: none; }
.step.collapsed .edit-btn { display: inline-flex; }
.step.collapsed .step-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 0 46px; /* align under the title text, past the circle */
}
.summary-thumb {
  width: 58px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.summary-swatch {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.summary-text { font-size: 14.5px; color: var(--text); }

.hint { color: var(--muted); margin: 0 0 18px; font-size: 15px; }

/* Utility: always wins over component display rules (.result, .action-row, …). */
.hidden { display: none !important; }

/* --------------------------- address input ------------------------- */
#addressInput {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-sans);
  font-size: 16px;
  background: var(--panel-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
#addressInput::placeholder { color: var(--muted); }
#addressInput:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
#addressInput:disabled { background: var(--panel-2); color: var(--muted); }

/* --------------------- street view preview window ------------------ */
.preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 280px;
  max-height: 460px;
  overflow: hidden;
  margin-bottom: 16px;
}
.preview img {
  display: none;
  max-width: 100%;
  max-height: 460px;
  object-fit: contain;
}
/* Interactive Street View panorama fills the preview window. */
.preview-pano {
  display: none;
  width: 100%;
  height: 400px;
}
.preview-empty { color: var(--muted); font-size: 15px; padding: 24px; text-align: center; }

.upload-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.upload-hint { color: var(--muted); font-size: 14.5px; }
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-soft);
  color: var(--navy);
  border: 1px solid var(--blue-tint);
  border-radius: 8px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.upload-btn:hover { background: var(--blue-tint); border-color: var(--blue); }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px;
}
.link-btn:hover { color: var(--navy); }

/* ----------------------- shingle categories ------------------------ */
.shingle-category { margin-bottom: 30px; }
.shingle-category:last-child { margin-bottom: 0; }
.shingle-category h3 {
  font-family: var(--font-sans);
  font-size: 13px;
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.shingle-category h3::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--orange);
}
.category-note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
  line-height: 1.5;
}

/* ------------------------------ grids ------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.grid .card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--panel-2);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.grid .card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.grid .card img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
  background: #eaeef5;
}
.grid .card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft), var(--shadow-md);
}
.grid .card.selected::after {
  content: "✓";
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(55, 150, 212, 0.5);
}
.grid .card .label {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* ----------------------------- buttons ----------------------------- */
button.primary {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 28px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(234, 73, 46, 0.28);
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
}
button.primary:hover:not(:disabled) {
  background: var(--orange-hover);
  box-shadow: 0 4px 16px rgba(234, 73, 46, 0.4);
}
button.primary:active:not(:disabled) { transform: translateY(1px); }
button.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* ----------------------------- status ------------------------------ */
.status { margin-top: 14px; min-height: 20px; color: var(--muted); font-size: 15px; font-weight: 400; }
.status.error { color: var(--orange); }
.status.busy::after { content: ""; animation: dots 1.2s steps(3, end) infinite; }
@keyframes dots { 0% { content: ""; } 33% { content: "."; } 66% { content: ".."; } 100% { content: "..."; } }

/* ----------------------------- result ------------------------------ */
.result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
  align-items: start; /* Before column shouldn't stretch to the taller After column */
}
.result figure { margin: 0; }
.result figcaption {
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
}
/* Before & After render in identical fixed-size windows side by side, regardless
   of each image's intrinsic dimensions. */
.result img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

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

/* ------------- candidate result thumbnails (under "After") --------- */
.result-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.option-card {
  position: relative;
  width: 84px;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel-2);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.option-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.option-card img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #eaeef5; }
.option-card.selected { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft), var(--shadow-md); }
.opt-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.version-badge {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--muted);
}

/* Small inline download control in the "After" caption (replaces the Save button). */
.icon-btn {
  border: none;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  padding: 2px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 0;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--blue-soft); color: var(--orange); }
.icon-btn:active { transform: translateY(1px); }

/* --------------------------- refine feedback ----------------------- */
.feedback {
  margin-bottom: 14px;
}
.feedback label {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}
#feedbackInput {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 15px;
  background: var(--panel-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  resize: vertical;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
#feedbackInput::placeholder { color: var(--muted); }
#feedbackInput:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

/* --------------------- step 1: address field ----------------------- */
/* Elevate step 1 so its prediction dropdown overlaps the step-2 card below it. */
#step-address { position: relative; z-index: 20; }
.address-field { position: relative; }
.address-field #addressInput { padding-right: 52px; }
.go-btn {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--blue);
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.15s, background 0.15s;
}
.go-btn:hover { color: var(--navy); background: var(--blue-soft); }

.predictions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.predictions li {
  padding: 10px 12px;
  font-size: 14.5px;
  border-radius: 8px;
  cursor: pointer;
}
.predictions li:hover { background: var(--blue-soft); color: var(--navy); }

/* ------------------------ step 2: groups + next -------------------- */
.group-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--navy);
  margin: 20px 0 10px;
}
.group-label:first-of-type { margin-top: 4px; }

/* Next/Save button lives in the step header (top-right). */
.head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.step-next { padding: 9px 20px; font-size: 14px; }
.step.collapsed .step-next { display: none; }

/* Steps 2 & 3: keep the header (number, title, Next) fixed while the long list
   of options scrolls inside the section, so Next stays in view. */
#step-streetview .step-head,
#step-shingles .step-head {
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
#step-streetview .step-body,
#step-shingles .step-body {
  max-height: 58vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Full-width scroll: gap under the fixed header, no left/right inset so the
     scrollbar sits flush with the section's content edge. */
  padding: 14px 0 4px;
}

/* ----------------------- step 4: action rows ---------------------- */
.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 4px;
}
#resultActions { margin-top: 18px; }
.secondary-btn {
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.secondary-btn:hover { background: var(--panel-2); border-color: var(--blue); }

/* ----------------------- step 5: quote form ----------------------- */
.quote-form { display: flex; flex-direction: column; max-width: 520px; }
.quote-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin: 14px 0 6px;
}
.quote-form input,
.quote-form textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 15px;
  background: var(--panel-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.quote-form input:focus,
.quote-form textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.quote-form button { margin-top: 18px; align-self: flex-start; }
.quote-form :disabled { opacity: 0.6; }

/* ----------------------------- footer ------------------------------ */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  padding: 30px;
}

/* ------------------- google autocomplete dropdown ------------------ */
.pac-container {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  margin-top: 6px;
  font-family: var(--font-sans);
}
.pac-item { padding: 9px 13px; font-size: 14px; cursor: pointer; }
.pac-item:hover { background: var(--blue-soft); }
.pac-item-query { color: var(--navy); }
