:root {
  --cream: #f7f9fb;
  --cream-2: #eef1f5;
  --white: #ffffff;
  --ink: #16181b;
  --muted: #6b6f72;
  --line: #e1e5ea;
  --dark: #0e0f11;
  --dark-2: #17181b;
  --blue: #1c9ae0;
  --blue-2: #0e7ec2;
  --blue-bright: #38b6ff;
  --blue-bg: #dcf0ff;
  --gradient-blue: linear-gradient(135deg, #52c6ff 0%, #1c66e0 55%, #142e9e 100%);
  --rust: #c2481f;
  --rust-bg: #f6ddd0;
  --gold: #b5810f;
  --gold-bg: #f5ecd2;
  --sage: #3f7a55;
  --sage-bg: #dcecdc;
  --shadow: 0 20px 45px -25px rgba(19, 24, 27, 0.35);
  font-family: "Hanken Grotesk", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#page-content {
  transition: filter 0.35s ease;
}

#page-content.blurred {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(247, 249, 251, 0.55);
}

.loading-overlay[hidden] { display: none; }
.loading-overlay:not([hidden]) { display: flex; }

.loading-overlay p {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.98rem;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(28, 154, 224, 0.18);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

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

h1, h2, h3 {
  font-family: "Bricolage Grotesque", sans-serif;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

p { margin: 0; }

a { color: inherit; }

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 8px;
}

.logo-mark {
  height: 56px;
  width: auto;
  display: block;
}

.header-tag {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--white);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  overflow: visible;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 0;
  pointer-events: none;
}

.hero-blob-a {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--blue-bright) 0%, transparent 70%);
  opacity: 0.28;
  top: -80px;
  right: -60px;
}

.hero-blob-b {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--blue-2) 0%, transparent 70%);
  opacity: 0.14;
  bottom: -60px;
  left: -80px;
}

.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue-bg);
  border: 1px solid rgba(28, 154, 224, 0.25);
  color: var(--blue-2);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  animation: rise 0.6s ease both;
}

.badge svg { flex-shrink: 0; }

.hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.6rem);
  font-weight: 700;
  margin: 22px 0 18px;
  animation: rise 0.6s ease 0.08s both;
}

.accent-text {
  background: var(--gradient-blue);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  white-space: nowrap;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
  animation: rise 0.6s ease 0.16s both;
}

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

/* ---------- Search card ---------- */

.search-card {
  margin: 36px auto 0;
  max-width: 680px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 10px 10px 10px 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease 0.24s both;
}

.field {
  flex: 1;
  text-align: left;
  padding: 6px 4px;
  position: relative;
}

.suggestions {
  position: absolute;
  top: calc(100% + 12px);
  left: -14px;
  right: -14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 20;
  text-align: left;
}

.suggestion-item {
  padding: 11px 16px;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}

.suggestion-item + .suggestion-item { border-top: 1px solid var(--line); }
.suggestion-item:hover,
.suggestion-item.active { background: var(--blue-bg); color: var(--blue-2); }

.suggestion-item.suggestion-empty {
  color: var(--muted);
  cursor: default;
}
.suggestion-item.suggestion-empty:hover { background: transparent; color: var(--muted); }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  margin-bottom: 2px;
}

.field input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  padding: 2px 0;
}

.field input::placeholder { color: #a6acb3; }

.field-divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 4px 2px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient-blue);
  color: var(--white);
  border: none;
  border-radius: 14px;
  padding: 15px 22px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(28, 102, 224, 0.55);
  transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(28, 102, 224, 0.6); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ---------- How it works ---------- */

.how {
  background: var(--cream-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.how-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 24px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
}

.how h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 10px 0 40px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  text-align: left;
}

.how-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
}

.how-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: var(--blue-bright);
}

.how-icon img {
  width: 24px;
  height: 24px;
  display: block;
}

.how-card h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.how-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* ---------- Results ---------- */

.results-section { background: var(--cream); }

.results-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

#status {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 1.4em;
  margin-bottom: 24px;
}

#status.error { color: var(--rust); font-weight: 600; }

.results-grid {
  display: grid;
  gap: 16px;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 26px;
  animation: rise 0.4s ease both;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
}

.card h3 {
  font-size: 1.08rem;
  font-weight: 600;
  display: inline;
}

.category-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue-2);
  background: var(--blue-bg);
  padding: 3px 10px;
  border-radius: 999px;
}

.br-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #2e7d32;
  background: linear-gradient(90deg, #e8f5e9 0%, #fffde7 100%);
  border: 1px solid #c8e6c9;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: help;
}

.address {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 6px 0 14px;
}

.score-badge {
  flex-shrink: 0;
  min-width: 68px;
  text-align: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
}

.score-high { background: var(--rust-bg); color: var(--rust); }
.score-mid { background: var(--gold-bg); color: var(--gold); }
.score-low { background: var(--sage-bg); color: var(--sage); }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.meta-row .tag {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--cream-2);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 999px;
}

.meta-row a.tag {
  color: var(--blue-2);
  border-color: rgba(28, 154, 224, 0.25);
  background: var(--blue-bg);
  text-decoration: none;
  font-weight: 600;
}

.meta-row a.tag:hover { background: var(--blue); color: var(--white); }

.card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.analysis {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.btn-send-agent {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--blue);
  background: transparent;
  color: var(--blue);
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-send-agent:hover {
  background: var(--gradient-blue);
  border-color: transparent;
  color: var(--white);
}

.btn-send-agent:active { transform: translateY(1px); }

.analysis li {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
  padding-left: 18px;
  position: relative;
}

.analysis li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-bright);
}

#load-more-wrap {
  text-align: center;
  margin-top: 28px;
}

.btn-outline {
  padding: 13px 28px;
  border-radius: 999px;
  border: 1.5px solid var(--blue);
  background: transparent;
  color: var(--blue);
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-outline:hover {
  background: var(--gradient-blue);
  border-color: transparent;
  color: var(--white);
  box-shadow: 0 10px 24px -10px rgba(28, 102, 224, 0.5);
}
.btn-outline:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  background: var(--dark);
  border-top: 4px solid var(--blue-bright);
  padding: 48px 24px 0;
  overflow: hidden;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
  padding-bottom: 32px;
}

.logo-mark-footer {
  height: 20px;
  width: auto;
  display: inline-block;
}

.footer-inner p {
  color: #8a8d90;
  font-size: 0.85rem;
  margin-top: 10px;
}

.footer-tagline {
  height: 16px;
  width: auto;
  display: inline-block;
  margin-top: 12px;
}

.footer-watermark {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 6rem);
  text-align: center;
  color: rgba(255, 255, 255, 0.05);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  user-select: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .search-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  .field-divider { display: none; }
  .btn-primary { justify-content: center; margin-top: 6px; }
  .site-header { flex-direction: column; gap: 10px; text-align: center; }
  .card-bottom { flex-direction: column; align-items: stretch; }
  .btn-send-agent { width: 100%; text-align: center; }
}
