:root {
  /* Tokens */
  --bg: #ffffff;
  --fg: #000000;
  --header-bg: #000000;
  --header-fg: #ffffff;
  --border: #000000;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-8: 2rem;
  --space-16: 4rem;

  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 2rem;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.8;
}

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

.filter-btn-search {
  background: #333;
  color: white;
  border-color: #333;
}

#filter-offmarket {
  background: white;
  color: #E53935;
  border-color: #E53935;
  font-weight: 600;
}

#filter-offmarket.active {
  background: #E53935;
  color: white;
  border-color: #E53935;
}

.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
}

.input {
  padding: var(--space-2);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: var(--text-base);
  width: 100%;
  border-radius: 0;
  /* Strict square corners */
}

.input:focus {
  outline: 2px solid var(--fg);
  outline-offset: -2px;
}

/* Header */
.header {
  background-color: var(--header-bg);
  color: var(--header-fg);
  padding: var(--space-2) var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-start;
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  width: 100%;
}

.header-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-title-now {
  --glow-spread: 6px;
  --glow-blur: 14px;
  animation: now-glow 4s ease-in-out infinite;
}

@keyframes now-glow {
  0%, 100% { color: #E53935; text-shadow: 0 0 var(--glow-spread) rgba(229, 57, 53, 0.6), 0 0 var(--glow-blur) rgba(229, 57, 53, 0.3); }
  50%      { color: #2a0a09; text-shadow: 0 0 2px rgba(229, 57, 53, 0.1); }
}

.header-scroll-btn {
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  background: none;
  padding: 0;
  margin-left: auto;
  transition: color 0.2s;
}
.header-scroll-btn:hover {
  color: #fff;
}

/* Map Section */
.map-section {
  position: relative;
  height: calc(100dvh - 38px - 28px);
  min-height: 400px;
  border-bottom: 1px solid var(--border);
}

@supports not (height: 100dvh) {
  .map-section { height: calc(100vh - 38px - 28px); }
}

#map {
  position: absolute;
  inset: 0;
}

.map-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: opacity 0.3s;
}

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.map-loading-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #E53935;
  animation: loading-pulse 1.2s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.8); }
}

.waitlist-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Sections */
.section {
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.1rem;
  margin-bottom: var(--space-4);
  font-weight: 600;
}

/* Pulse Bar */
.pulse-bar {
  background: #111;
  color: #ccc;
  padding: 6px var(--space-4);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.pulse-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pulse-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.pulse-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #999;
}

.pulse-legend-label {
  color: #777;
  margin-right: 2px;
}

.pulse-legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E53935;
  animation: loading-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

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

.card {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.card-subtitle {
  font-size: 0.8rem;
  color: #888;
  margin: 0 0 var(--space-1);
}

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

.card-link {
  font-size: 0.85rem;
  color: #E53935;
  text-decoration: none;
  font-weight: 500;
  margin-top: auto;
}

.card-link:hover { text-decoration: underline; }

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.article-list li a {
  font-size: 0.85rem;
  color: #111;
  text-decoration: none;
  border-bottom: 1px solid #eee;
  padding-bottom: var(--space-1);
  display: block;
}

.article-list li a:hover { color: #E53935; }

/* Testimonials */
.testimonial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

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

.testimonial {
  border-left: 3px solid #E53935;
  padding: var(--space-4);
  margin: 0;
}

.testimonial p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #333;
  margin: 0 0 var(--space-2);
}

.testimonial cite {
  font-size: 0.75rem;
  color: #999;
  font-style: normal;
}

.alert-config-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  margin-bottom: var(--space-2);
}

.alert-config-input {
  width: 80px;
  min-width: 0;
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
}

.alert-config-input-wide {
  flex: 1;
  min-width: 140px;
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
}

.map-search-alert-row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-1);
  padding-top: var(--space-1);
  align-items: center;
  font-size: 0.75rem;
}

.map-search-alert-input {
  width: 120px;
  min-width: 0;
  padding: var(--space-1);
  font-size: 0.75rem;
}

.section-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}

@media (max-width: 640px) {
  .section-split {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

.footer {
  padding: var(--space-4) 0;
  text-align: center;
  font-size: 0.75rem;
  color: #999;
}

.footer a {
  color: #999;
  text-decoration: none;
}

.footer a:hover { color: #E53935; }

.founders {
  color: rgba(255, 152, 0, 0.35);
  font-size: 0.6rem;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* Utility classes for text */
.text-center {
  text-align: center;
}

.text-sm {
  font-size: var(--text-sm);
}

/* ── Postcode search bar ──────────────────────────────────────────────────── */
.map-search {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: calc(100vw - var(--space-8));
}

.map-search .filter-btn,
.map-search .input {
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.map-search .input {
  background: white;
}

.map-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.map-search-input {
  width: auto;
  min-width: 0;
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
}

.filter-toggle {
  display: inline-flex;
}

.filter-toggle .filter-btn {
  border-radius: 0;
}

.filter-toggle .filter-btn:first-child {
  border-right: none;
}

@media (max-width: 480px) {
  .map-search-row {
    gap: 2px;
  }
  .map-search-input {
    width: auto;
  }
  .map-search-row .btn,
  .map-search-row .filter-btn {
    padding: var(--space-1) 6px;
    font-size: 0.7rem;
  }
  .map-search-alert-row {
    font-size: 0.65rem;
  }
  .map-search-alert-input {
    width: 90px;
    font-size: 0.65rem;
  }
}

.map-search-filters {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  align-items: center;
}

.map-search-price-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding-top: var(--space-1);
}

.filter-btn {
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
  font-family: inherit;
  background: white;
  color: black;
  border: 1px solid black;
  cursor: pointer;
  white-space: nowrap;
}

.filter-btn.active {
  background: black;
  color: white;
}

.filter-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Hover tooltip ───────────────────────────────────────────────────────── */
.map-tooltip {
  position: absolute;
  display: none;
  z-index: 20;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: var(--space-4);
  pointer-events: auto;
  max-width: 220px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
}

.tt-address {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
  text-transform: capitalize;
}

.tt-price {
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.tt-details {
  font-size: 0.75rem;
  color: #555;
  margin-bottom: var(--space-1);
}

.tt-age {
  font-size: 0.75rem;
  color: #888;
}

@media (max-width: 480px) {
  .map-tooltip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    max-width: none;
    max-height: 40%;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
  }
}

.tt-link {
  margin-top: var(--space-2);
}

.tt-link a {
  font-size: 0.75rem;
  color: var(--fg);
  text-decoration: underline;
}

.tt-listing-link {
  color: var(--fg);
  text-decoration: none;
}

.tt-listing-link:hover {
  text-decoration: underline;
}

